Repository navigation
fix(agent-runtime): keep file ops from the folded compaction tail - #1984
Conversation
vastsa
left a comment
There was a problem hiding this comment.
Independently confirmed #1983 by restoring main's runtime.ts while keeping the regression: folded Read src/a.ts is present in summarized messages but fileOps.read is empty. Restored candidate passes 370/370 runtime tests; full runtime suite passes 115 files / 1584 tests, shared/runtime builds and diff check pass. Reviewed collection against the actual folded range: copies existing sets, adds only retained-tail operations, preserves previous-checkpoint operations and de-duplicates paths; retention and persistence contracts remain unchanged. All six remote checks pass including Windows/Host and Electron E2E. Latest main 3684cc4 is ancestor, and PR integration tree equals tested head d30b4778408bf48c6c28576b91a448c0f336d937. Local verification covers production runtime preparation and generated summary with controlled model boundary; standalone local Electron/paid-provider E2E not run. Minimal root-cause fix ready to merge.
fix: pick upstream compaction fixes vastsa#1984, vastsa#1988, vastsa#1994
Fixes #1983
What
codexShapedPreparationnow copies pi'sfileOpsand records Read/Write/Edit calls from theretainedTailit folds into the summarized range (via the existingcollectMessageFileOperations, now exported frompi-runtime-compaction-plan.ts). The sets pi returned are left untouched. The comment onprepareCompactionInputand the spec paragraph on checkpoint file lists are updated to match.Why
The fold summarizes and drops the tail, but file ops were collected only for the pre-fold range, so files read or edited inside the
keepRecentTokenswindow disappeared from the checkpoint'sreadFiles/modifiedFilesand from<read-files>/<modified-files>in the summary.How tested
runtime.test.ts:records file operations from tool calls folded out of the retained tail(largekeepRecentTokens; assertsfileOpsand<modified-files>/details.modifiedFilesin the generated summary) fails on unmodifiedmain(expected [] to deeply equal [ 'src/a.ts' ]) and passes with this change.does not duplicate file operations already collected before the foldcovers the small-keepRecentTokenspath.packages/agent-runtime: full vitest 113 files / 1564 tests pass;tsc --noEmitclean;pnpm lint:biomeandscripts/check-architecture.mjspass.Scope
runtime.ts(codexShapedPreparation), one export inpi-runtime-compaction-plan.ts, test, and one spec paragraph. No change to the cut point, retention, or summary prompt.