Repository navigation
fix(claude): preserve subagent task context snapshots - #21644
juliusmarminge wants to merge 2 commits into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped Claude adapter bug fix that populates an existing subagent context-usage field while preserving snapshot and resume semantics. Targeted tests cover idle completion, stale snapshot clearing, decreasing values, zero values, and separation from workflow totals. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Validated current head 93c22b6 over #21643: current-head CI is green, with normal skipped jobs. The cancelled native fingerprint job was superseded by a successful run of the same workflow/head. Macroscope approved this head; CodeRabbit found no actionable comments, and there are no review threads. Both independent second-round full-stack reviews are clean. Provider/native/remote verification limits are explicit in the description. Ready for maintainer review; unmerged. |
Claude task frames report context usage, but the adapter drops it before clients can display it. This layer maps the latest plain-task snapshot from progress and completion frames, including completion while the parent is idle. Empty-description progress can update usage without erasing text. Both ordinary resume and buffered-wake reopening clear stale snapshots; absent completion usage preserves the last report.
Depends on the client/contract layer #21643. Rebuilt from Gigioxx’s #15446, preserving its snapshot mapping and both reset paths while adapting to current idle-completion handling. Workflow lifetime totals remain separate and never appear as context snapshots. No cumulative sum, cost or maximum-window denominator is introduced. Related #15429 remains open.
Verification: adapter definitions 176→177 (expanded cases 286→287). One rebuilt lifecycle case and an extended existing two-variant wake case fail on main, then pass here: snapshots decrease, zero is retained, missing usage preserves it, both reopen paths clear it, and idle completion is captured. An existing workflow case was extended to catch context/lifetime conflation in active and idle progress; it failed before the review fix. All nine focused adapter cases pass (278 skipped); scoped server typecheck, targeted lint/format and diff checks pass with existing diagnostics only. Two fresh whole-stack review rounds by Claude Opus 5.5 and GPT-6 Sol completed; both reviewers found no blockers in the second round. Round one caught workflow lifetime totals mislabeled as context and stale lineage context beside a newer finished child run; both were reproduced and fixed. Reviewers also ran 50 selected adapter cases successfully (237 skipped).
Headless Linux proof uses the actual adapter harness with current SDK frame types, not a live Claude invocation. Integrated web proof is in #21643. No fresh provider/account, live workflow, macOS, Windows, iOS, Android, Electron desktop or remote/relay/tunnel execution was verified; those remain human verification limits.
Implemented with GPT-6.1 Sol through the Codex harness; tests by GPT-6 Astra; adversarial reviews by Claude Opus 5.5 and GPT-6 Sol through T3 Code delegation.