refactor: add transcript runtime identity contract#89201
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 1:15 PM ET / 17:15 UTC. Summary PR surface: Source +371, Tests +266, Other +6. Total +643 across 14 files. Reproducibility: not applicable. this is a staged refactor contract rather than a bug report with a failing reproduction. The useful checks are source review, focused file-backed tests, and maintainer review of the contract semantics. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Have maintainers approve the runtime identity contract and land this file-backed seam before dependent SQLite, SDK, and reader slices build on it. Do we have a high-confidence way to reproduce the issue? Not applicable; this is a staged refactor contract rather than a bug report with a failing reproduction. The useful checks are source review, focused file-backed tests, and maintainer review of the contract semantics. Is this the best way to solve the issue? Yes, if maintainers accept the linked Path 3 plan: a file-backed identity seam is narrower than combining caller migration with the SQLite storage flip. It still needs human contract approval because downstream slices rely on this shape. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8ded75628437. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +371, Tests +266, Other +6. Total +643 across 14 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
|
f18f99c to
b39023f
Compare
a5012a3 to
a0e06d4
Compare
a13e0eb to
890d5e3
Compare
890d5e3 to
b496b4b
Compare
a0e06d4 to
8432a1b
Compare
1e31abd to
094f9b5
Compare
c320249 to
9a55d1b
Compare
9a55d1b to
58aa59e
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
8432a1b to
efbe88d
Compare
7ffe706 to
cb112eb
Compare
cb112eb to
57aa52c
Compare
What
Adds the canonical file-backed transcript runtime identity/state contract for Path 3.1b, building on the session accessor seam without adding SQLite storage, production storage flips, runtime dual-read/fallback, or doctor migration code.
Why
Path 3 needs a storage-neutral transcript identity/state contract before the SQLite implementation can replace file-backed runtime transcript state. This keeps normal runtime operations scoped by agent/session identity instead of raw
sessionFilepaths, while preserving explicit file-artifact boundaries until their owners migrate.Changes
SessionTranscriptRuntimeScope/ target resolutionIncluded scope:
Excluded scope:
Follow-ups:
clawdbot-d02.1.9.1.21: SQLite side of the transcript identity/state adapter.clawdbot-d02.1.9.1.20: public SDK transcript identity/API compatibility.clawdbot-d02.1.9.1.23: plugin/memory transcript artifact APIs.clawdbot-d02.1.9.1.15.3: remainingsessionFileartifact-boundary classification.Refs #88838.
Testing
node scripts/run-vitest.mjs src/config/sessions/session-accessor.test.ts src/agents/embedded-agent-runner/transcript-runtime-state.test.ts src/agents/embedded-agent-runner/transcript-rewrite.test.ts src/agents/embedded-agent-runner/tool-result-truncation.test.ts src/agents/embedded-agent-runner/compaction-successor-transcript.test.ts src/gateway/session-compaction-checkpoints.test.tsoxfmt --checkon touched files.git diff --check..agents/skills/autoreview/scripts/autoreview --mode local.Known proof gap:
node scripts/run-tsgo.mjs -p tsconfig.json --noEmit --pretty falsewas attempted and failed on unrelated existingextensions/copilottimestamp/baseDirectory anduimissingthreeerrors, not on this slice.Real Behavior Proof
Behavior addressed: transcript runtime identity contract plus gateway compaction checkpoint persistence after a real session exceeds practical context limits.
Real environment tested: live local OpenClaw gateway from the PR build on macOS 15.6.1 / Node 24.15.0, using session
agent:main:pr89201-compaction-proof-20260615-172548.Exact steps or command run after this patch: rebuilt the PR checkout with
pnpm build, restarted the live gateway, sent a broad read-only PR-review prompt into the proof session to inflate context, then ranpnpm openclaw gateway call sessions.compact --params '{"key":"agent:main:pr89201-compaction-proof-20260615-172548"}' --json --timeout 600000.Evidence after fix: gateway status reported
Git @ 7ffe7061for the tested PR build;sessions.compactreturnedok: true,compacted: true,tokensBefore: 110131,tokensAfter: 104375,details.rounds: 1, anddetails.targetTokens: 193500; the session store then reportedcompactionCount: 2and one persisted manual checkpoint0cfef200-3600-49af-a6ab-3e79d8e81363with matching pre/post session identity and post session file.Observed result after fix: explicit gateway compaction completed and persisted a checkpoint for the active transcript identity without losing the session mapping.
What was not tested: rotated-successor transcript proof with
agents.defaults.compaction.truncateAfterCompaction=true; a retry with that option returnedalready under targetand did not create a successor transcript. The branch was then rebased cleanly ontoupstream/main@55d1324c7d0d2146b16aaef9572b7177a710f881as57aa52c1e33c4c970e9273486f5069ca44572633; focused Vitest and autoreview were rerun on the prior clean rebase SHA, then the final moving-main rebase passed session-accessor boundary guard, oxfmt, and git diff check.