Repository navigation
Conversation
pthombre
force-pushed
the
pthombre/lineage-renamed-tool-call
branch
from
October 25, 2026 02:47
4303db9 to
e6bd457
Compare
OpenCode echoes a model call to a tool it lacks as a call to its own `invalid`
tool: it keeps the call ID and moves the original name into the arguments as
{"tool": <name>, "error": <message>}. #4014's tool-call-turn key ignores
rewritten arguments but keeps tool names, so the echo no longer matched the
served call, the next request had no parent, and every later call of the
rollout was poisoned (47 calls in one rollout of a 16-node full-SWE run, 8 in
one of the 32-node restore run).
The key now hashes the name the model emitted when the echo has exactly that
shape. Names still have to match, so two responses that share per-response
tool IDs but call different tools stay apart, and any other shape keeps its
name and stays unresolved as before. Recorded keys hash served responses,
which never carry the rewrite, so existing ledgers and checkpoints are
unaffected.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Pranav Thombre <[email protected]>
pthombre
force-pushed
the
pthombre/lineage-renamed-tool-call
branch
from
October 25, 2026 16:57
e6bd457 to
7b31f9a
Compare
This was referenced Oct 25, 2026
Draft
7 tasks done
This branch has not been deployed
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.
What does this PR do?
OpenCode echoes a model call to a tool it does not have as a call to its own
invalidtool. It keeps the call ID and moves the original name into the arguments as{"tool": <name>, "error": <message>}. #4014's tool-call-turn key tolerates rewritten arguments but keeps tool names, so the echo stopped matching the served call. The next request then had no parent (Unresolved parent … poisoning the call), and because a poisoned call can never be a parent, every later call of the rollout was poisoned too.Observed in two OpenCode SWE runs on this stack:
mkdir; 47 calls of that rollout were poisoned.globals; the last 8 calls of that rollout were poisoned. This was the run's only rewrite in about 15,750 tool calls, and the run's only unresolved-parent rollout.tool_call_turn_fingerprintnow hashes the name the model emitted when the echoed call has exactly that shape: the name isinvalidand the arguments are a JSON object with exactly the keystool(a non-empty string) anderror. Everything else is unchanged.Safety:
call_0) but call different tools stay apart. The only newly accepted match is one feat(token-id-capture): resolve parent and terminal call by tool-call ids #4014 already accepts: same ID and same name, different arguments.tool, non-JSON arguments, or a different name keep their name and stay unresolved, as before.terminal.pyuses the same key, so a final turn containing a rewritten call is now attributed as well.This does not address the post-resume duplicate requests (two calls continuing the same parent) seen after a park where harness launches could not be paused. That is a separate issue.
No issue filed: the root cause and fix are described here.
Validation
pytest tests/unit_tests/test_tool_call_turn_fallback.py tests/unit_tests/test_tool_call_turn_lineage_store.py tests/unit_tests/test_conversation_fingerprint.py tests/unit_tests/test_token_id_capture.py tests/unit_tests/test_terminal_attribution.py tests/unit_tests/test_token_capture_*.py: 819 passed.record,add_entryand terminal attribution, and through all four lineage stores (local and custody, file and in-memory);t1responses callingmkdirandbashstay distinguishable;7b31f9a93, replayed with the stack below it): 1379 passed and 0 failed at the top of the stack in therl-gym.nightlycontainer on Slurm (job 8281677).ruff checkandruff format --checkpass on the changed files.pre-commit runhas not been run yet (the authoring environment could not download the hook repos); it will be run before this leaves draft.Rollouts
The stack with this fix ran in six 16-node full-SWE GRPO jobs: OpenCode on 5 SWE routes, 2,048 rollouts in flight, about 10 h in total. Unresolved-parent warnings:
mkdir, besides about 1,500 after failed pauses.invalidrewrite. Whether the model called an unavailable tool in them is not known, though: neither OpenCode's rewrite nor this fix's match is logged, and the rewrite came about once per 15,000 tool calls before. These runs show no regression; they do not show the fix exercised.{"tool": "globals", "error": "Model tried to call unavailable tool 'globals'. Available tools: …"}). Before this leaves draft, an OpenCode rollout that triggers an unavailable tool still needs to be checked for atool_call_turnresolution and no unresolved-parent warnings.Compatibility and benchmark impact
Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code