Repository navigation
Conversation
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.
Fixes #159
/branchin Qwen Code writes a new session file that starts with a copy of the conversation so far, each copied record tagged withforkedFrom. The parser read those copies as if they were new work, so the branch replayed the parent's prompts, edits and passing checks and was extracted as a second session. Backfilling a session that fixed an off-by-one inpaginatenext to a branch of it that only asked a follow-up question gave "1 new procedure, 1 confirmed": the same fix was counted twice, once under each session id. If the copies keep the parent'ssessionId, the branch also took the parent's id, because the builder keeps the first id it sees, and the two transcripts fought over one session's progress.Records with
forkedFromnow only contribute the session id and the working directory, never prompts, tool calls or timestamps, so a branch is learned from its own records only. A copied record's session id is ignored when it equals theforkedFromsession, which covers both cases: current Qwen Code rewrites the copies to the branch's id, so even a branch with nothing new yet gets its own (empty) trace instead of a parse error, and copies that kept the parent's id can no longer claim the branch.The copies still take part in rebuilding the live chain, since the branch's first own record points at the last copied one, so nothing changes there.
I reproduced it end to end with a scratch
TRODDEN_HOMEand Qwen Code directory holding a parent transcript and a branch of it laid out the wayforkSessionwrites one. Before the fix,trodden backfill --agent qwenextracted the fix task under both sessions and confirmed the procedure with the branch, and with the parent's id kept on the copies both transcripts were stored as the parent's session. After it, the fix is extracted once under the parent, the branch only has its own follow-up, each transcript keeps its own session, and a branch with no records of its own backfills cleanly. A new parser test covers the copied records being skipped, the empty branch, a branch with its own prompt, and copies that kept the parent's id; it fails without the change.