Skip to content

fix(approvals): show the approver the whole tool call, or say clearly what is left out (#392) - #498

Open
mblaauw wants to merge 1 commit into
mainfrom
fix/392-approval-full-arguments
Open

mblaauw wants to merge 1 commit into
mainfrom
fix/392-approval-full-arguments

Conversation

@mblaauw

@mblaauw mblaauw commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Closes #392.

Summary

Approval requests carried at most the first 4000 bytes of a call's arguments,
cut into a string ending in "…". Since native bash/edit/write calls can need
approval, a long command could hide its risky tail from the person deciding.

  • Worker: approval requests now carry the arguments whole up to 64 KiB of
    serialised JSON, plus argumentsBytes and argumentsTruncated. Larger
    arguments become a string with the head, the tail and the number of bytes
    left out between them, so the end of a command is always visible.
  • Event and audit payloads keep short copies; a cut copy now ends with
    "[truncated: N bytes in total]".
  • Web: the approval view shows an "Arguments truncated" warning with the full
    size and opens the arguments; long summary rows say they are cut. Strings
    from older workers count as truncated.
  • Docs: approvals guide and runtime contract.

Testing

  • cargo fmt --check, clippy -D warnings: clean
  • cargo test --workspace with a database: 764 passed, 0 failed
  • Unit tests: a 5000-byte bash command is carried whole; arguments over 64 KiB carry argumentsTruncated and argumentsBytes; event copies end with the new marker
  • Web: typecheck passes, test 98 passed (4 new in lib/approval-arguments.test.ts); pnpm docs:check passed

Not checked in a browser. No migration. Above 64 KiB the middle of the call is still hidden; the warning tells the approver to reject if they need it.

🤖 Generated with Claude Code

… what is left out (#392)

Approval requests carried at most the first 4000 bytes of a call's arguments,
cut into a string ending in "…". Since native bash/edit/write calls can need
approval, a long command could hide its risky tail from the person deciding.

- Worker: approval requests now carry the arguments whole up to 64 KiB of
  serialised JSON, plus argumentsBytes and argumentsTruncated. Larger
  arguments become a string with the head, the tail and the number of bytes
  left out between them, so the end of a command is always visible.
- Event and audit payloads keep short copies; a cut copy now ends with
  "[truncated: N bytes in total]".
- Web: the approval view shows an "Arguments truncated" warning with the full
  size and opens the arguments; long summary rows say they are cut. Strings
  from older workers count as truncated.
- Docs: approvals guide and runtime contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Approval requests show only the first 4000 bytes of tool arguments, so a long command can hide its tail from the approver

1 participant