Repository navigation
tools: copyable examples for wrong calls; tool-layer review fixes (deny floor, atomic writes, git) - #417
Merged
Conversation
A call that misuses a tool (missing param, unknown action, an action of another
tool) now gets, ahead of the tool's schema, a ready-to-copy arguments object for
the action it meant: the model's own values for declared params, a <placeholder>
for each required one it left out, undeclared keys dropped, long values never
carried truncated. A garbled action name ("read_file") maps to the one action it
contains or is contained in; an ambiguous one gets no example. Encoded without
HTML escaping, so the model sees <path>, not <path>.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
- An action of another tool gets that tool's example, named as such — only when
the params sent fit it (run + action "run" + command is not agent's run).
- A garbled action matches an action by whole word ("readFile" → read, not
"catalog" → log), never a mutating one, and never ambiguously.
- No example when it would correct nothing (a call that failed for another
reason, such as a remote MCP tool's own validation).
- Optional values are kept as sent, a lone space included; blank required ones
become placeholders.
- Values are capped by their JSON size at any depth, and one of the wrong JSON
type for its param is a placeholder. Placeholders are always marked slots
("<content>", never a sentence or a bare 1/true).
- The unparseable-params note no longer carries a file.write example.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ring; integral ints
- A garbled name matching two actions gets no example even when one of them
mutates ("read_then_write" on the real file tool is not a read).
- A list or object sent for a str param goes in as the JSON string the param
takes (file.edit's edits, mcp's args), instead of a placeholder.
- A fractional number is not a correct value for an int param.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Raw memory raises auto's cap and the agent raises one below 2; the row showed the configured number either way. It now shows what is in force, and "2 (set 1)" when that differs from what was set. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Deny floor: also judged on every command the shell grammar nests (shellsplit:
$( ), backticks, { }, ( ), if/while bodies, sh -c code), and past leading
VAR=val assignments and keywords. `FOO=1 rm -fr ~`, `echo $(rm -fr ~)`,
`then rm -fr ~` ran under run.default=allow.
- write/edit replace a file whole (temp file, fsync, rename, mode kept), so a
failure part-way can't leave half of it; in place only where no temp file can
be made. append reports a failed flush on close.
- write/edit refuse a pipe or device (opening one blocked with the file lock
held); append to a pipe opens without blocking and fails if nothing reads it.
- edit: find and replace follow a CRLF file's line endings; a find occurring
more than once is refused (with the count) unless replace_all. write keeps a
UTF-8 BOM the file had.
- git push refuses a refspec that deletes a remote branch (":main").
- git commit checks the staged set for secrets, failing closed, and names the
staged files in the approval.
- git push/pull/fetch: with no remote named, resolve the one git will use;
every remote's URL is checked against the jail and named in the approval.
- run keeps the start and the end of long output (the end holds the failures),
cutting the middle; its approval names the directory when not the default.
- search/find look in .github, .gitlab, .circleci and .devcontainer; an empty
result says which dot-directories were skipped. find matches with slashes on
Windows.
Not taken: lingering-child exit masking (os/exec returns ErrWaitDelay only on a
successful exit; checked), disabling filter drivers on status/diff (ADR 0017,
and it breaks LFS), plan-mode branch listing and offline local fetch (low).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Deny floor: words are split the way the shell splits them (FOO='a b' rm -fr x ran past it); a command nested deeper than the parser follows is asked, never auto-run. - replaceFile: a new file is created directly, under the user's umask; a file with other hard links is written in place; owner and group are kept where we may; a rename that fails (a file held open on Windows) falls back to writing in place. - write keeps a BOM however large the file, and not into an empty write. - edit's note says a find must match once, or replace_all. - git: clone no longer resolves the workspace's default remote; a detached-HEAD push names no destination; remote URLs are taken a line each (a path may hold a space); commit's staged list skips the empty-output sentinel and keeps names exactly as git gives them. - HeadTailWriter drops at most one incomplete rune at the cut; tests pin the cut count. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Deny floor: leading redirections (>out, 2>/dev/null, "> out") are skipped like assignments before naming the program. - replaceFile writes in place a file a replacement can't stand in for: other hard links (now counted on Windows too), extended attributes / POSIX ACLs, or an owner other than us. - edit tries the find exactly as given before its CRLF form: in a mixed file the CRLF form could match — and edit — a different place. - git: a detached-HEAD push resolves remote.pushDefault (it can push with a push refspec); a remote with more URLs than fit the output cap is refused rather than half-checked; commit doesn't refuse staging the removal of a tracked secret (deletions are named, not content-checked). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch: copyable examples for wrong tool calls, and fixes from a review of the tool layer.
tools: answer a wrong call with a filled-in correct one
A call that misuses a tool (missing param, unknown action, an action of another
tool) now gets, ahead of the tool's schema, a ready-to-copy arguments object for
the action it meant: the model's own values for declared params, a
for each required one it left out, undeclared keys dropped, long values never
carried truncated. A garbled action name ("read_file") maps to the one action it
contains or is contained in; an ambiguous one gets no example. Encoded without
HTML escaping, so the model sees , not .
tools: example review fixes for #417
the params sent fit it (run + action "run" + command is not agent's run).
"catalog" → log), never a mutating one, and never ambiguously.
reason, such as a remote MCP tool's own validation).
become placeholders.
type for its param is a placeholder. Placeholders are always marked slots
("", never a sentence or a bare 1/true).
tools: example — ambiguity before the mutation rule; edits as JSON string; integral ints
mutates ("read_then_write" on the real file tool is not a read).
takes (file.edit's edits, mcp's args), instead of a placeholder.
config: the max_history row shows the cap in force
Raw memory raises auto's cap and the agent raises one below 2; the row showed
the configured number either way. It now shows what is in force, and
"2 (set 1)" when that differs from what was set.
tools: fixes from a review of the tool layer
$( ), backticks, { }, ( ), if/while bodies, sh -c code), and past leading
VAR=val assignments and keywords.
FOO=1 rm -fr ~,echo $(rm -fr ~),then rm -fr ~ran under run.default=allow.failure part-way can't leave half of it; in place only where no temp file can
be made. append reports a failed flush on close.
held); append to a pipe opens without blocking and fails if nothing reads it.
more than once is refused (with the count) unless replace_all. write keeps a
UTF-8 BOM the file had.
staged files in the approval.
every remote's URL is checked against the jail and named in the approval.
cutting the middle; its approval names the directory when not the default.
result says which dot-directories were skipped. find matches with slashes on
Windows.
Not taken: lingering-child exit masking (os/exec returns ErrWaitDelay only on a
successful exit; checked), disabling filter drivers on status/diff (ADR 0017,
and it breaks LFS), plan-mode branch listing and offline local fetch (low).
tools: review fixes for the tool-layer changes
ran past it); a command nested deeper than the parser follows is asked, never
auto-run.
with other hard links is written in place; owner and group are kept where we
may; a rename that fails (a file held open on Windows) falls back to writing
in place.
push names no destination; remote URLs are taken a line each (a path may hold
a space); commit's staged list skips the empty-output sentinel and keeps names
exactly as git gives them.
count.
tools: codex review fixes for the tool-layer changes
like assignments before naming the program.
hard links (now counted on Windows too), extended attributes / POSIX ACLs, or
an owner other than us.
CRLF form could match — and edit — a different place.
refspec); a remote with more URLs than fit the output cap is refused rather
than half-checked; commit doesn't refuse staging the removal of a tracked
secret (deletions are named, not content-checked).
Each change has a test that fails with it reverted. go test ./..., -race on internal/agent, internal/tool, internal/policy, internal/textutil, and windows/darwin builds pass. Reviewed by codex, muse and devin; findings verified, the ones not taken are listed in the commits.
🤖 Generated with Claude Code