You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arm the console-log callback before anything that can fail (addin path)
ClaudeR 0.14.2. From a user report with screenshot: on 0.14.1 the addin
checkbox "Also log my own console commands" logged nothing, while the
same feature started from the console worked.
globalCallingHandlers() may only be called with an empty handler stack.
The addin checkbox is handled inside a Shiny observer, where handlers
are on the stack, so it errors with "should not be called with handlers
on the stack". 0.14.1 had moved that call to the front of
start_console_logging(), so the error aborted the function before
addTaskCallback() ran and the user's commands were never recorded. (It
also fails inside task callbacks, later() callbacks and tryCatch, so it
cannot be deferred or guarded; only a bare top-level call works.)
Now: the task callback is registered first and unconditionally, the
sink and options(error=) follow, and globalCallingHandlers() is
attempted last and only when sys.nframe() shows a bare top-level call.
Without it, warnings are read from last.warning after each command
(reported only when changed, since it lingers); message() output is not
captured from the addin path and the startup message says so.
stop_console_logging() likewise removes the handlers only at top level;
otherwise they stay installed as no-ops (console_note_condition checks
the active flag). start also re-arms if the callback has gone missing.
Verified: start/stop from inside withCallingHandlers register/remove the
callback without error and log commands, printed output and warnings;
bare top-level start installs the handlers and captures message().
R CMD check: Status OK.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,8 @@ claudeAddin()
50
50
<details>
51
51
<summary><b>Recent Updates</b> (click to expand)</summary>
52
52
53
+
-**Console logging from the addin fixed (R 0.14.2).** Ticking "Also log my own console commands" in the addin armed nothing on 0.14.1, while calling `start_console_logging()` in the console worked. Cause: `globalCallingHandlers()` (used to observe warnings and messages) can only be called with an empty handler stack, and inside the Shiny observer that handles the checkbox it errors, which aborted the function before the console callback was registered. The callback is now registered first and unconditionally; the handlers are installed only when logging is started from the console, and otherwise warnings are read from `last.warning` after each command. Started from the addin, `message()` output is the one thing not captured, and the addin says so.
54
+
53
55
-**Logging fixes (R 0.14.1).** Two problems from a user report. Agent output was never written to the log, only the code, because the entry was written before the code ran; the log now records what each call printed. And the output capture added in 0.14.0 could stop console logging entirely: it opened its own output sink before registering the console callback, so if that sink could not be opened, nothing was logged at all. Opening it is now optional and failing back to logging commands and their values, the sink is restored if another execution unwinds it, and an agent run no longer pops a sink it did not open. Logged output lines are marked so that replay, history and notebook export skip them.
54
56
55
57
-**Console logging now captures output, not just results (R 0.14.0).** From follow-up on the logging request. The log recorded the value a command returned, so anything printed as a side effect was missing: `cat()`, progress output, and `print()` called inside a function. Running `f()` showed the call but not what `f()` printed, which is exactly the context an agent needs when you hand it an error you hit yourself. Standard output is now teed to the log and grouped under the command that produced it, alongside the warnings, messages, and errors already captured. Your console still shows everything as normal.
0 commit comments