Repository navigation
fix(session): drop nameless tool calls before storing or replaying - #293
Open
raymondginger2018-sudo wants to merge 1 commit into
Open
raymondginger2018-sudo wants to merge 1 commit into
raymondginger2018-sudo wants to merge 1 commit into
Conversation
A tool call whose function has no name can reach the transcript when a model or provider leaves the name blank. It used to be persisted as-is and replayed on resume, so every later request for that session was rejected with "missing field name" and the session never recovered. kernel_message_to_record now keeps only the calls that name their function, session_message_to_kernel drops the nameless ones again when a stored turn is replayed so an already poisoned session heals itself, and record_fingerprint hashes the same filtered set so a cleaned replay is not mistaken for an unchanged record. An assistant turn holding nothing but nameless calls is not written at all; the runner's existing orphan tool-result handling covers the results that lose their call.
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.
Summary
A tool call whose
function.nameis missing or blank can reach the transcript (a model/provider leaving the name empty, or a parser glitch that keeps the raw payload but drops the name). It used to be persisted as-is and replayed verbatim on resume, so every later request for that session was rejected withmissing field name(400/422) and the session never recovered — an unrecoverable poison from a single bad call.Changes
core/sessions/transcript.py_named_tool_calls()guard: keeps only calls whosefunction.nameis a non-blank string.kernel_message_to_recordfilters through the guard on save, so a poisoned call never enters the store.session_message_to_kernelfilters again on rebuild, so a session poisoned before this fix heals itself on resume.record_fingerprinthashes the same filtered set, so a cleaned replay is not mistaken for an unchanged record (no duplicate re-save on every resume).Tests
tests/test_session_transcript.py+5 cases / 101 lines:bashcall survive)Local CI replay (pr-ready, Windows,
COMPARE_FROM=aa6ed161):KNOWN-RED | jobs=10 | rc0=29 | new=0 | known=1— the single known red (windows-lifecycle:group2) is pre-existing and unrelated to this diff.Dependency note
No new imports; both files already exist on
main.core/sessions/transcript.pyis the only production file touched.Scope
Single-intention fix: 1 commit, 2 files, +134/-11.