Skip to content

fix: preserve tool results when call IDs are reused - #647

Draft
March-7 wants to merge 1 commit into
Tarquinen:masterfrom
March-7:codex/tool-call-identity
Draft

March-7 wants to merge 1 commit into
Tarquinen:masterfrom
March-7:codex/tool-call-identity

Conversation

@March-7

@March-7 March-7 commented Oct 2, 2026

Copy link
Copy Markdown

Tool call IDs can repeat across messages. DCP previously reused the first call's metadata and applied one pruning flag to multiple results, which could remove the newest output. V2 projection could also associate a call with a later turn's result.

Retain calls with ambiguous IDs during automatic pruning and sweep, discard unsafe existing flags, scope subagent caches by message/part, and pair V2 results with their preceding calls. Unique IDs keep their existing behavior; provider IDs and the persisted state format are unchanged. Ambiguous calls intentionally retain more context.

Fixes #615.

Validation:

  • npm test: 133 DCP tests and 8 request-logger tests passed. The 14 new regressions have 12 failures on the unchanged baseline and all pass with this change.
  • npm run typecheck, npm run check:package, and npm run format:check passed.
  • Actual OpenCode 1.18.29 and 2.0.4 runs against a local scripted Responses endpoint: two reads reuse an ID, followed by compression. The baseline loses required results; the patched outbound requests retain both file receipts with the original call/result IDs.

Known baseline checks: npm audit --audit-level=high fails on the unchanged lockfile as well, including high advisories for transitive brace-expansion@2.1.4. No dependencies were changed. An initial parallel run timed out in an unchanged logger watcher test; standalone and sequential reruns passed. Docker lab and live providers were not run.

AI assistance was used to prepare the implementation and tests.

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.

[Bug]: Tool call IDs are not globally unique across messages

1 participant