feat(context-engine): report compaction successors as typed session targets#101182
Conversation
8546206 to
f57a3a4
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat(context-engine): report compaction successors as typed session targets This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 9:37 PM ET / 01:37 UTC. Summary PR surface: Source +67, Tests +70, Docs +3, Generated 0, Other 0. Total +140 across 9 files. Reproducibility: not applicable. this is an additive SDK/API feature rather than a bug report. Source inspection confirms current main and Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the additive SDK contract only after maintainer acceptance, redacted live/log proof, and branch refresh or exact-head validation, while preserving deprecated Do we have a high-confidence way to reproduce the issue? Not applicable: this is an additive SDK/API feature rather than a bug report. Source inspection confirms current main and Is this the best way to solve the issue? Yes, conditionally: centralizing target-first resolution while preserving raw AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 349d3547ccd1. Label changesLabel justifications:
Evidence reviewedPR surface: Source +67, Tests +70, Docs +3, Generated 0, Other 0. Total +140 across 9 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
f57a3a4 to
71d3c75
Compare
71d3c75 to
f457561
Compare
f457561 to
e8897aa
Compare
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits, old head 7766516) onto main @ 21f2512, per the prep-series plan: Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the seam on main first, so this rebase reduces to the SQLite storage implementation behind the session accessor. Beyond the flip branch content, this merge: - implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the file-era store for doctor paths) - adds cross-agent fork support (targetStorePath) so worktree/cross-agent sessions.create forks land child transcript rows in the target agent DB - keeps main's newer behavior across the conflict surface (work admission, archive-gated deletes, preflight overflow budgeting, model fallback, replyOptions dispatch shape, lifecycle-header ordering) - adopts the storage-neutral ContextEngineSessionTarget while preserving the deprecated CompactResult.sessionFile for shipped plugin readers Known remainder (tracked for follow-up commits on this PR): ~415 test-case failures across 43 files, dominated by stale vi.mock factories missing main-side exports; prod typecheck, full build, and boundary ratchet are green. Co-Authored-By: Claude Fable 5 <[email protected]>
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits, old head 7766516) onto main @ 21f2512, per the prep-series plan: Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the seam on main first, so this rebase reduces to the SQLite storage implementation behind the session accessor. Beyond the flip branch content, this merge: - implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the file-era store for doctor paths) - adds cross-agent fork support (targetStorePath) so worktree/cross-agent sessions.create forks land child transcript rows in the target agent DB - keeps main's newer behavior across the conflict surface (work admission, archive-gated deletes, preflight overflow budgeting, model fallback, replyOptions dispatch shape, lifecycle-header ordering) - adopts the storage-neutral ContextEngineSessionTarget while preserving the deprecated CompactResult.sessionFile for shipped plugin readers Known remainder (tracked for follow-up commits on this PR): ~415 test-case failures across 43 files, dominated by stale vi.mock factories missing main-side exports; prod typecheck, full build, and boundary ratchet are green. Co-Authored-By: Claude Fable 5 <[email protected]>
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits, old head 7766516) onto main @ 21f2512, per the prep-series plan: Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the seam on main first, so this rebase reduces to the SQLite storage implementation behind the session accessor. Beyond the flip branch content, this merge: - implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the file-era store for doctor paths) - adds cross-agent fork support (targetStorePath) so worktree/cross-agent sessions.create forks land child transcript rows in the target agent DB - keeps main's newer behavior across the conflict surface (work admission, archive-gated deletes, preflight overflow budgeting, model fallback, replyOptions dispatch shape, lifecycle-header ordering) - adopts the storage-neutral ContextEngineSessionTarget while preserving the deprecated CompactResult.sessionFile for shipped plugin readers Known remainder (tracked for follow-up commits on this PR): ~415 test-case failures across 43 files, dominated by stale vi.mock factories missing main-side exports; prod typecheck, full build, and boundary ratchet are green. Co-Authored-By: Claude Fable 5 <[email protected]>
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits, old head 7766516) onto main @ 21f2512, per the prep-series plan: Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the seam on main first, so this rebase reduces to the SQLite storage implementation behind the session accessor. Beyond the flip branch content, this merge: - implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the file-era store for doctor paths) - adds cross-agent fork support (targetStorePath) so worktree/cross-agent sessions.create forks land child transcript rows in the target agent DB - keeps main's newer behavior across the conflict surface (work admission, archive-gated deletes, preflight overflow budgeting, model fallback, replyOptions dispatch shape, lifecycle-header ordering) - adopts the storage-neutral ContextEngineSessionTarget while preserving the deprecated CompactResult.sessionFile for shipped plugin readers Known remainder (tracked for follow-up commits on this PR): ~415 test-case failures across 43 files, dominated by stale vi.mock factories missing main-side exports; prod typecheck, full build, and boundary ratchet are green. Co-Authored-By: Claude Fable 5 <[email protected]>
What Problem This Solves
Context engines that own compaction report their post-compaction successor session to the host through
CompactResult.result.sessionFile— a raw file-path string. A bare path cannot say which agent/session it belongs to or what storage mode backs it, so every consumer re-infers identity from a path, and the contract cannot describe non-file-backed sessions.Why This Change Was Made
Adds a typed successor contract:
CompactResult.result.sessionTarget({ kind: "file", agentId?, sessionId, sessionKey?, sessionFile }) makes storage mode explicit and carries precise identity. The delegate populates it; host consumers (adoptCompactionTranscript,runOwnsCompactionAfterHook, queued-compaction rotation detection) read target-first with the raw-field fallback centralized in one helper (resolveCompactionSuccessorTranscript). This matches the direction main already took for runtime params inrun-session-target.ts.CompactResultis a shipped plugin-SDK surface (exported viaplugin-sdk/index.ts, present in release tag v2026.6.11, documented indocs/concepts/context-engine.mdfor third-party engine authors), sosessionFilestays populated and is marked@deprecatednaming that shipped contract, with removal planned once typed targets are the only successor contract.User Impact
None for existing plugins —
sessionFilekeeps working unchanged. Engine authors get a typed, documented successor contract; docs updated accordingly.Evidence
CompactResult.sessionFilereaders migrated (run.tsadoption paths,compact.queued.tsrotation detection, delegate producer); the four look-alike readers of the runtimeEmbeddedAgentCompactResulttype confirmed out of scope at each site.context-engine.test.tsupdated bridge test + 2 new tests; 206/206 tests pass across the five suites exercising compaction adoption paths.plugin-sdk:api:genfor the intentional surface addition;pnpm buildgreen (SDK export checks pass).