Skip to content

Keep each tool call's id in stored transcripts - #120

Merged
sagnik11 merged 2 commits into
mainfrom
claude/transcript-tool-use-ids
Dec 4, 2026
Merged

sagnik11 merged 2 commits into
mainfrom
claude/transcript-tool-use-ids

Conversation

@sagnik11

@sagnik11 sagnik11 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Why

Autter's PR page shows, for each changed line, the tool call that wrote it. Today it can only match a line to a call by time, because stored transcripts drop the call's id. The checkpoints already record the hook's tool_use_id. With the id kept in the transcript too, the backend (already shipped in autter-monorepo) matches lines to calls exactly.

What changes

  • Message::ToolUse gains an optional id. It is serialized as id and left out when absent, so transcripts stored before this still deserialize.
  • cas_bridge fills the id from:
    • Claude-style tool_use blocks: Claude Code toolu_…, Droid call_…;
    • Codex function_call items, from call_id.
  • Codex custom_tool_call items (freeform apply_patch) were dropped before. They now become tool-use messages with their call_id.
  • id is on the redaction denylist. The CAS upload sends the payload as untyped JSON, so the id reaches Autter unchanged.

Ids per agent

  • Claude Code: the id matches the one the checkpoint records. The preset already finds the transcript block by it.
  • Codex and Droid: these match only if their hooks send the call id as tool_use_id. The repo has no real hook payload that proves this.
  • No id:
    • Cursor transcripts have no ids.
    • Amp, Continue, Copilot and Windsurf transcripts are not parsed.
    • Gemini and Pi tool calls are dropped.
    • Firebender, OpenCode, Kiro and Antigravity send no transcript.
    • Copilot VS Code's hook id carries a __vscode-<ts> suffix that the transcript id lacks.
  • Hooks that send no id: several presets record the literal "bash". No transcript id will ever equal it, so it never produces a false match.

Tests

  • 10 new or updated unit tests cover:
    • each parser keeping the id;
    • the serialization round trip;
    • an old transcript without id;
    • the redaction and upload path.
  • cargo test --lib: 2524 passed. One failure needs Windows symlink privilege: compute_watermarks_uses_symlink_metadata_not_target_mtime.
  • Integration tests: claude_code, codex, droid, cursor, gemini, show_prompt and sessions_backwards_compat, 179 passed.
  • cargo clippy --all-targets -D warnings is clean apart from lints that are new in Rust 1.99. They fire in 15 places that already existed, none in this change.

Not in this PR

  • A separate bug: Pi and Droid user messages are labelled assistant, because event_role reads type:"message" before message.role.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

sagnik11 and others added 2 commits December 4, 2026 02:24
Message::ToolUse gains an optional `id`, serialized as `id` and left out
when absent, so transcripts stored before this still deserialize. The
transcript parser in cas_bridge fills it with the agent's own call id:
the `id` of a Claude-style `tool_use` block (Claude Code `toolu_...`,
Droid `call_...`) and the `call_id` of a Codex `function_call`. Codex
`custom_tool_call` items (freeform `apply_patch`) were dropped before;
they now become tool-use messages with their `call_id` too.

These are the ids the agents' hooks send as `tool_use_id`, which
checkpoints record, so Autter can match a line to the exact tool call
that wrote it instead of matching by time. `id` is on the redaction
denylist and the CAS upload sends the payload as untyped JSON, so the
id reaches Autter unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stored transcripts now keep the id of every tool call, so the Autter PR
page can point a changed line at the exact tool call that wrote it
instead of matching by time.

- Each tool call carries the agent's own id: the id of a Claude Code
  (toolu_...) or Droid (call_...) tool_use block, or the call_id of a
  Codex call. These are the ids the agents' hooks report as tool_use_id.
- Codex freeform apply_patch calls (custom_tool_call), which were
  dropped before, are now kept as tool calls with their call_id.
- Transcripts stored before this have no ids and still parse as before.

Tests: cargo check --locked passes (3 existing lib warnings). Code
change and its tests are in 6449374.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@blacksmith-sh

This comment has been minimized.

@sagnik11
sagnik11 merged commit f9d0961 into main Dec 4, 2026
9 of 10 checks passed
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.

1 participant