Follow Discord
Sweep 03 Dec 2026 · 19:13Z Build v2.1.336 553 read Stable v2.1.332 Latest v2.1.336 Next v2.1.336 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Run tool calls from code with Code Mode changedcode-mode

Nearest release: v2.1.335, published an hour after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 2 Dec 2026 20:51 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 2 Dec 2026 21:07 UTC.

Upstream edited
Recorded here
Lines+5added
Lines−5removed
From line 176 where the diff opens
First seen 13 Nov 2026 this site's first read of the page
Recorded edits19to this page, all time

The whole hunk

from line 176, old and new numbered
/
lines
from line 176
176176 
177177#### Trace calls from code
178178 
179On v2.1.333 or later, look for calls from code under the `claude_code.tool.execution` span of the `REPL` call that ran the code. Expect the same [span types](https://code.claude.com/docs/en/monitoring-usage.md#span-hierarchy) as for a call that Claude makes directly. Before your users turn on Code Mode, decide what you export and what you audit from:
179On v2.1.333 or later, look for calls from code under the `claude_code.tool.execution` span of the `REPL` call that ran the code. These calls have the same [span types](https://code.claude.com/docs/en/monitoring-usage.md#span-hierarchy) as a call that Claude makes directly. Before your users turn on Code Mode, decide what you export and what you audit from:
180180 
181181* **Keep tool output out of your backend**: code can read far more than it shows Claude. Leave `OTEL_LOG_TOOL_CONTENT` unset if your backend shouldn't receive what calls from code return. In that case, also leave `OTEL_LOG_TOOL_DETAILS`, `OTEL_LOG_RAW_API_BODIES`, `OTEL_LOG_ASSISTANT_RESPONSES`, and `OTEL_LOG_USER_PROMPTS` unset, because each can send parts of that output
182182* **Audit from events**: after code makes many calls, you can lose spans if Claude Code exits right away or your collector falls behind. Export [events](https://code.claude.com/docs/en/monitoring-usage.md#events) too and audit from those. To avoid losing events as well, run a collector that responds quickly and accepts large requests
from line 257
257257* **You're on a version before v2.1.328 and picked the session from the `claude --resume` list**: exit, [update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code), then run the same `claude --resume` command with Code Mode on. To stay on your version, replace `--resume` with `--continue`. If Claude still waits after the update, start a new session in auto mode
258258* **You passed tool names to `--tools`**: start a new session in auto mode, with Code Mode on and without that flag
259259* **The session first started in auto or `bypassPermissions` mode**: press `Shift+Tab` until you're back in that mode. If that doesn't help, exit, then run `claude --continue --permission-mode auto` with Code Mode on
260* **The session first started in another mode**: if [auto mode is available](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) to you, exit, then run `claude --permission-mode auto` with Code Mode on to start a new session. On v2.1.331 or later, expect Claude to keep waiting if you resume the old session instead
260* **The session first started in another mode**: if [auto mode is available](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) to you, exit, then run `claude --permission-mode auto` with Code Mode on to start a new session. On v2.1.331 or later, Claude can keep waiting if you resume the old session instead
261261 
262262### Stop code in progress
263263 
from line 357
357357 
358358### Permission prompt with a countdown
359359 
360In auto mode, if you approve code yourself after [repeated classifier blocks](https://code.claude.com/docs/en/permission-modes.md#when-auto-mode-falls-back), you can be asked about tool calls in that code and in earlier code that's still running. Expect the same in auto mode after an [`ask` rule](#approve-each-piece-of-code-first) or a `PreToolUse` hook on `REPL` has you approve the code.
360In auto mode, if you approve code yourself after [repeated classifier blocks](https://code.claude.com/docs/en/permission-modes.md#when-auto-mode-falls-back), you can be asked about tool calls in that code and in earlier code that's still running. You can also be asked about those calls in auto mode when you approved the code because of an [`ask` rule](#approve-each-piece-of-code-first) or a `PreToolUse` hook on `REPL`.
361361 
362362With no IDE connected, the prompt can show a countdown:
363363 
from line 374
374374If Claude reports a refused call, ask it for the error text. These errors mean your [`PreToolUse` hook](https://code.claude.com/docs/en/hooks#pretooluse) gave no decision:
375375 
376376* **`the hook did not finish`**: your hook timed out, or your agent hook ended without a decision. Raise the hook's [`timeout`](https://code.claude.com/docs/en/hooks#common-fields), or set [`"onFailure": "continue"`](#tool-call-ran-after-a-hook-failed) on a `command` or `http` hook. If an agent hook still gives this error, move the check to a `command` hook. After Claude runs code, you can see this error on calls outside code too
377* **`the hook failed`**: your hook failed on a call from code, for example because it couldn't start. Find the failure in the [debug log](https://code.claude.com/docs/en/hooks.md#debug-hooks) and fix it. Expect this error before v2.1.329. On later versions, you can see it after you turn off [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) during a session
377* **`the hook failed`**: your hook failed on a call from code, for example because it couldn't start. Find the failure in the [debug log](https://code.claude.com/docs/en/hooks.md#debug-hooks) and fix it. You see this error on versions before v2.1.329. On later versions, you can see it after you turn off [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) during a session
378378 
379379### Tool call ran after a hook failed
380380 
381381To stop a call from code when its `PreToolUse` hook fails, use a `command` or `http` hook and set [`"onFailure": "block"`](https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails). If several settings files have that hook, give it the same `onFailure` value in each.
382382 
383On v2.1.329 or later, expect these results for `command` and `http` hooks:
383On v2.1.329 or later, the call has these outcomes with `command` and `http` hooks:
384384 
385385| `onFailure` | Hook times out | Hook fails another way, such as a missing script |
386386| :- | :- | :- |
Feedback