Repository navigation
fix(agents): seed fresh session identity before transcript append - #119473
Patrick-Erichsen merged 4 commits into
Conversation
c7db975 to
0f4d222
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7db9757ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 12:05 PM ET / 16:05 UTC. ClawSweeper reviewWhat this changesThe PR atomically creates a missing SQLite session identity immediately before a fresh session’s first transcript header is written, with unit and gateway-restart regression coverage. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo blocking findings. This PR fixes a current fresh-session persistence failure at the SQLite identity owner, addresses the prior atomicity concern, and has focused plus gateway-boundary proof. Priority: P1 Review scores
Verification
How this fits togetherThe agent session manager turns chat activity into a persisted transcript. SQLite session identity establishes ownership for that transcript before its header and first message can be recorded. flowchart LR
A[Gateway chat request] --> B[Session manager]
B --> C[Pending transcript header]
C --> D[SQLite identity owner]
D --> E[Transcript writer]
E --> F[Persisted session history]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +42, Tests +272. Total +314 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep conditional identity creation in the SQLite session-entry owner, retain the transcript writer’s independent identity check, and merge once the exact head is confirmed mergeable. Do we have a high-confidence way to reproduce the issue? Yes at source level: opening a fresh persisted session produces a pending header, then the current identity-gated writer rejects that header because no row exists. The PR body also supplies an exact-head gateway restart trace showing the repaired first turn survives restart. Is this the best way to solve the issue? Yes: conditional creation belongs in the SQLite identity owner immediately before the first real write; seeding during open would mutate no-op readers, while putting it in the generic transcript writer would blur ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9b2328dc3750. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
31ff09a to
d7f4978
Compare
|
Merged via squash.
|
…cope * origin/main: perf(agents): isolate concurrency benchmark workers (openclaw#119749) fix(diagnostics): preserve OTEL startup failure (openclaw#119747) fix(agents): seed fresh session identity before transcript append (openclaw#119473) fix: steering reaches active runs across agent harnesses (openclaw#119594) fix(cli): report accurate filtered node totals (openclaw#119744) fix(skills): keep installed verdicts scoped to publisher (openclaw#119672) fix(diagnostics): honor signal-specific OTLP protocols (openclaw#119708)
…enclaw#119473) * fix(agents): seed fresh session identity before transcript append * test(agents): prove fresh session persistence through gateway * fix(agents): seed session identity on first transcript write * fix(agents): atomically seed fresh session identity
What Problem This Solves
Fixes an issue where opening a genuinely fresh persisted session could leave its SQLite session identity row absent. The first transcript header and message append then failed with
Session transcript header was not persistedbefore the model was called.Why This Change Was Made
The session manager now creates a missing SQLite session identity row at the first real transcript write, immediately before the pending session header is appended. Opening a session for reading no longer creates or rewrites a session row, so existing metadata and session identity remain untouched on no-op probes and rollback paths.
User Impact
Fresh SQLite-backed sessions now persist their header and first user message reliably. Existing sessions, read-only session opens, and in-memory session behavior are unchanged. No configuration changes or data migration are required.
Evidence
Exact PR head:
d7f4978be251da00f77c3a786d8d626a7a54591c(rebased ontoorigin/mainat0b68f8e1ed5).Focused validation on that exact checkout:
node scripts/run-vitest.mjs run src/agents/sessions/session-manager.test.ts— 1 file, 25 tests passed.node scripts/run-vitest.mjs run src/gateway/worker-environments/transcript-commit.test.ts— 1 file, 10 tests passed.node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/pr119473-real-runtime-proof.e2e.test.ts— 1 real gateway test passed in 8.90s.git diff --check— passed.pnpm tsgo:test— passed across all 175 workspace projects.Observed gateway proof trace
The test starts the actual gateway twice in isolated temporary state and asserts this live sequence:
The model response comes from a real loopback OpenAI-compatible HTTP/SSE server, not a mocked gateway client. The passing runner output from the latest exact-head execution was:
AI-assisted: Yes. The implementation, regression tests, and gateway lifecycle proof were reviewed against the session persistence and transcript-write paths. The ChatGPT Codex connector review findings on the prior head were addressed by moving identity seeding to the first write and preserving existing rows.