refactor: route transcript writers through session seam#89123
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 16, 2026, 4:38 PM ET / 20:38 UTC. Summary PR surface: Source +473, Tests +490, Other +46. Total +1009 across 27 files. Reproducibility: not applicable. this is a refactor PR rather than a bug report. The PR body does include live Gateway/agent behavior proof for the changed transcript write path. Review metrics: 1 noteworthy metric.
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: Land only after maintainer signoff on the session-state invariants, then continue the remaining SQLite storage migration under the broader tracker. Do we have a high-confidence way to reproduce the issue? Not applicable; this is a refactor PR rather than a bug report. The PR body does include live Gateway/agent behavior proof for the changed transcript write path. Is this the best way to solve the issue? Yes, this is the right staged shape for the requested migration slice: it moves writer callers behind the accessor seam without flipping storage or adding runtime fallback. The safer alternative, flipping storage here, is intentionally left to the broader staged migration tracker. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 68363368be1e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +473, Tests +490, Other +46. Total +1009 across 27 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
3634f87 to
d7ae319
Compare
d7ae319 to
8ee86ca
Compare
1c31222 to
4b0e698
Compare
a13e0eb to
890d5e3
Compare
890d5e3 to
b496b4b
Compare
8ee86ca to
0db3096
Compare
9d501b4 to
de72b58
Compare
c049ecb to
24a0038
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* clawdbot-d08: route transcript writers through accessor seam * fix: refresh transcript writer seam proofs * refactor: add transcript turn writer operation * fix: preserve transcript writer store targeting * fix: preserve transcript append lock ordering * refactor: guard transcript turn session rebound * clawdbot-d02.1.9.1.35: route transcript rewrites through runtime scope * fix: preserve transcript event append return type * fix: publish transcript turn owned entries
What
Path 3 / PR 3.1b transcript writers route core transcript turn append/touch/update behavior and runtime transcript rewrite callers through the session accessor/runtime transcript seam while preserving current file-backed transcript behavior. Refs #88838.
Final head:
24a00380ff1f62f989f8c694475dc93f804e7da1.Why
This keeps writer-domain granularity separated from the later SQLite storage flip: file-backed runtime behavior remains canonical now, while runtime writers expose operation-sized transaction boundaries SQLite can implement next.
Changes
SQLite Adapter Instructions
sessionFile/activity metadata when requested, then publish after commit.allowedRewriteSuffixEntryIds, replace/replay the active suffix, persist appended/replayed rows, then publish after commit.sessionId, normalizedsessionKey,agentId, and the explicit current file-backed target fallback while the file backend remains active.rewriteTranscriptEntriesInSessionFile(...)as a named artifact/migration boundary only, not a runtime caller API.Testing
node scripts/run-vitest.mjs src/config/sessions/session-accessor.test.ts src/config/sessions/transcript.test.ts src/agents/command/attempt-execution.cli.test.ts src/gateway/server.chat.gateway-server-chat.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts src/gateway/server-methods/server-methods.test.ts src/agents/embedded-agent-runner/context-engine-maintenance.test.ts src/agents/embedded-agent-runner/transcript-rewrite.test.ts test/scripts/check-session-accessor-boundary.test.tspassed 4 shards / 441 tests.node scripts/check-session-accessor-boundary.mjspassed.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test-pr89123-after-review-final.tsbuildinfopassed.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test-pr89123-after-review.tsbuildinfopassed.git diff --checkpassed.oxlinton changed TS/JS files passed.oxfmt --check --threads=1on changed TS/JS files passed.autoreview clean: no accepted/actionable findings reported.Real behavior proof
chat.injectappends/touches/publishes the assistant-only transcript row without breaking parent ordering./Users/phaedrus/Projects/clawdbot, Node 24.15.0, OpenClaw Gateway LaunchAgent restarted from branchcodex/pr89123-refreshat final SHA24a00380ff1f62f989f8c694475dc93f804e7da1, Gatewayws://127.0.0.1:18789.pnpm openclaw gateway restart && pnpm openclaw statuspnpm openclaw agent --session-key agent:main:pr89123-real-proof-24a00380-20260616-1324 --message "Real behavior proof for PR 89123 final SHA 24a00380. Reply with exactly: PR89123 final transcript writer domain operation live proof OK" --timeout 300 --jsonpnpm openclaw gateway call chat.inject --json --timeout 30000 --params '{"sessionKey":"agent:main:pr89123-real-proof-24a00380-20260616-1324","agentId":"main","message":"PR89123 final transcript writer domain operation gateway inject live proof OK","label":"PR89123 24a00380 writer-domain proof"}'~/.openclaw/agents/main/sessions/sessions.jsonand/Users/phaedrus/.openclaw/agents/main/sessions/12216caf-251d-423b-8bfb-143ab60324a2.jsonl.Git codex/pr89123-refresh · @ 24a00380andGateway service LaunchAgent installed · loaded · running (pid 3058). The agent command returnedstatus: "ok",runId: "51a96dbd-0abb-401a-a4aa-8d3aac02a00a",sessionId: "12216caf-251d-423b-8bfb-143ab60324a2", session file/Users/phaedrus/.openclaw/agents/main/sessions/12216caf-251d-423b-8bfb-143ab60324a2.jsonl, and visible textPR89123 final transcript writer domain operation live proof OK. The inject command returnedok: true,messageId: "0f688968-75ba-4d48-821b-58d06b207d6b". Direct transcript inspection showedrowCount: 7,messageCount: 3, user rowaa49ffaf -> 84bccbb4, assistant row022de27c -> aa49ffaf, and injected assistant row0f688968-75ba-4d48-821b-58d06b207d6b -> 022de27c; session metadata showedstatus: "done",updatedAt: 1781640747689, andlastInteractionAt: 1781640738724.