Repository navigation
refactor(sessions): consolidate transcript and state helpers - #119435
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 11:22 PM ET / August 5, 2026, 03:22 UTC. ClawSweeper reviewWhat this changesThis PR replaces duplicated session, transcript, migration, and export normalization helpers with canonical shared helpers while preserving existing behavior. Merge readinessKeep open: current main does not contain this behavior-preserving consolidation, and the exact-head proof addresses the prior real-behavior request. No blocking correctness or security finding was identified; the protected maintainer label leaves landing to explicit human review. Priority: P3 Review scores
Verification
How this fits togetherSession and transcript code turns incoming turns and persisted session records into transcript events, SQLite projections, and export artifacts. This refactor centralizes their input normalization before those downstream persistence and delivery paths run. flowchart TD
A[Session and transcript inputs] --> B[Shared normalization helpers]
B --> C[Transcript event delivery]
B --> D[SQLite session migrations]
B --> E[User-turn media records]
C --> F[Public and internal listeners]
D --> G[Session state]
E --> H[Transcript exports]
Decision needed
Why: The protected maintainer label requires explicit human handling even though the code review and supplied proof show no blocking defect. Before merge
Agent review detailsSecurityNone. PR surfaceSource -106. Total -106 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the focused canonical-helper consolidation and land it after the maintainer approves the exact-head merge and CI state. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor, and the supplied exact-head runtime output exercises the sensitive transcript-event path rather than a reported failure. Is this the best way to solve the issue? Yes: replacing equivalent local coercion and record checks with the existing canonical helpers is the narrowest maintainable solution, and source comparison found no changed predicate or owner boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a8caab5c3d3c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Session, transcript, and agent-state owners repeated equivalent record/string coercion, provider wrappers, transcript event projections, and export allowlists. This is part of a maintainer-requested project-wide production LOC reduction campaign.
Why This Change Was Made
Reuse canonical normalization and transcript owners while preserving SQLite migrations, public/private transcript boundaries, metadata-first export ordering, and session recovery.
User Impact
Session persistence, transcript exports, lifecycle events, and database schema remain unchanged; removes 106 production lines.
Evidence
gpt-5.6-solwithxhighreasoning; no accepted or actionable findings.git diff --check, scoped formatting, and direct before/after behavioral equivalence checks passed.Exact-head transcript event and privacy proof
The actual committed transcript-event owner, both canonical production normalization modules, and the real production global singleton owner were source-compiled and executed in an isolated Node VM. Only synthetic identities and paths were used; no gateway, database, live user state, or mocked emitter logic was involved.
{ "commit":"dbcd06badb8ebbbf95056298a30eca721b1d4d38", "source":"src/sessions/transcript-events.ts", "verifiedGitBlob":"cf18c68669c06cbe13507d85611e21719d980576", "publicEvent":{"target":{"agentId":"fixture-agent","sessionId":"fixture-session","sessionKey":"agent:fixture-agent:main"},"sessionKey":"agent:fixture-agent:main","agentId":"fixture-agent","sessionId":"fixture-session","message":{"role":"assistant","content":"[synthetic redacted fixture]"},"messageId":"fixture-message","messageSeq":7}, "internalEvent":{"sessionFile":"/redacted/state/fixture-session.jsonl","target":{"agentId":"fixture-agent","sessionId":"fixture-session","sessionKey":"agent:fixture-agent:main","storePath":"/redacted/state/openclaw.sqlite"},"sessionKey":"agent:fixture-agent:main","agentId":"fixture-agent","sessionId":"fixture-session","lifecycleRevision":"fixture-revision","message":{"role":"assistant","content":"[synthetic redacted fixture]"},"messageId":"fixture-message","messageSeq":7}, "archiveOnlyEvent":{"publicDeliveries":0,"internalEvent":{"sessionFile":"/redacted/state/archive-only.jsonl"},"invalidSequenceDropped":true}, "listenerFailureIsolation":{"publicListenersThrown":1,"publicEventsDelivered":1,"internalListenersThrown":2,"internalEventsDelivered":2}, "assertions":"PASS: exact commit/blob; canonical normalization; public redaction; owner-only archive delivery; listener failure isolation" }Public listeners received no sessionFile, target.storePath, or lifecycleRevision; internal owner listeners retained all three. Throwing listeners did not prevent subsequent listeners from receiving events. The requested transcript-event proof is therefore supplied. A fresh bot re-review is intentionally skipped because the reviewed Git head did not change; root policy explicitly requires no re-review round trip when rank-up moves are addressed without modifying the reviewed head.