fix(repair): match answered tool calls by call_id - #544
Conversation
Pass 1.5 now consumes the answered-result budget against both id and call_id, preserving Codex-shaped turns whose tool result references call_id. Remove the two temporary xfail markers. RED: both call_id regressions fail with the production hunk reverted. GREEN: scripts/run_tests.sh tests/run_agent/test_message_sequence_repair.py -q (25 passed). Ruff passes on both changed files.
|
Closing as a duplicate of #547 — my fault, not the author's. I dispatched a worker onto card t_08cca32f without noticing the card was already dispatchable, so two agents independently built the same fix ~15 minutes apart. Both are behaviorally equivalent: Pass 1.5 now resolves the answered budget against the Adjudicated on measured merits rather than arrival order:
#547 wins on the unused-import cleanup and the explanatory comment. No behavior is lost by closing this one. Independent verification I ran on this branch still stands and applies to the shared fix: reverting the source alone turned exactly 3 tests red ( |
Summary
idandcall_idcall_idxfailmarkers for the restored regression testsProblem
Pass 1 already registers both identifiers for each assistant tool call. Pass 1.5 only checked
tc.get("id"), so a correctly answered tool call carrying onlycall_id— or distinct Codexid/call_idvalues — was misclassified as unanswered. The repair pass then deleted a valid assistant turn before every API request.Solution
For each tool call, inspect both identifiers and consume whichever still has an unconsumed contiguous tool-result budget. This preserves the existing multiset behavior for duplicate IDs and the existing orphan/partial-orphan repair paths.
Verification
test_repair_keeps_tool_matching_*call_idtests failed withrepairs == 1scripts/run_tests.sh tests/run_agent/test_message_sequence_repair.py -q— 25 passedpython -m ruff check agent/agent_runtime_helpers.py tests/run_agent/test_message_sequence_repair.py— passedgit diff --check— passedScope
Pass 1.5 is fork-only code. This PR fixes the fork implementation without changing the broader repair pipeline.