Repository navigation
fix(chat): restore first turns in a new session store - #170464
Conversation
The retained mutation authorization introduced by #169622 (cbc53ac) did not follow reply admission's own first-store registration. Its sharing witness expired before provider execution, so the first parent turn failed before it could spawn a child. Forward the existing committed registration callback through reply admission, after the admission selector follows it and before public observers run. Keep asynchronous preparation, current-authority checks and the reduced SQL work. Group session initialization callbacks without changing their lazy read time or lifecycle ownership. Extend the existing cold-admission regression without weakening its SQLite and retirement assertions. Preserve schema, stored data and update behavior.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
CI found a type-only dependency cycle from chat admission through session binding and the user-turn recorder. Replace the recorder import with the same six-field initialization contract already declared by its getter. Runtime behavior is unchanged. The full Madge check, core types, targeted lint and P2 review pass after this correction.
|
Codex review: needs real behavior proof before merge. What this changesThis PR forwards first-store registration receipts to the chat request’s retained authorization witness. Example: Send “Spawn one worker now.” to agent:main:store-proof with a configured session store that does not yet exist.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: it repairs a concrete first-turn regression still present on current main, and review found no actionable introduced code defect. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherGateway chat.send retains caller and session authorization, passes initialization callbacks through reply admission, and uses worker-owned database preparation before agent execution and provider requests. flowchart TD
A[Gateway chat request] --> B[Retained session authorization]
A --> C[Reply dispatch]
C --> D[Reply admission]
D --> E[Database worker preparation]
E --> F[Registration receipt]
F --> B
D --> G[Agent and provider execution]
Technical reviewBest possible solution: Retain this focused receipt-forwarding repair and verify that cold-store execution preserves authorization at the provider boundary. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing registration forwarding, and the PR reports failure of both existing Gateway product cases before the fix; this read-only review ran no target code. Is this the best way to solve the issue? The patch repairs the missing publication path at the existing admission owner without adding SQL, retries, fallback reads, or a competing lifetime owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 64d15a871282. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete authorization bypass was found, but final-effect revocation evidence remains incomplete. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +46, Tests +12. Total +58 across 13 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 12, 2026, 9:12 PM ET / October 13, 2026, 01:12 UTC. |
Fix the first message to a cold configured session store failing before any provider request. Reply admission created and registered the SQLite store, but the retained request authorization introduced by openclaw#169622 (27c3ba3) did not follow its own registration and invalidated itself. Forward the existing committed registration callback to that witness after updating the admission selector and before public observers. Preserve asynchronous preparation, current-authority checks, and the reduced database work. Keep session-initialization types independent of the recorder to avoid a type-only import cycle. The cold-admission regression fails before the fix. Original product cases pass under the same four-worker CPU pressure; focused sharing, binding, dispatch, admission and retention tests pass. Core and targeted test types, lint, boundary lint, architecture/source contracts, deadcode and P2 review pass. Corrected-head CI 38330353532 passes all 76 jobs.
What Problem This Solves
Fixes the first message to a cold configured session store failing before any provider request. This also breaks the parent turn in the heartbeat store-lifecycle product test before it can spawn a child.
User Impact
The first turn can create its configured store and continue with the request's original authorization. Source replacement, credential revocation, and membership changes retain their existing refusal behavior.
Why This Change Was Made
Regression from #169622 (
cbc53ac75eca): native reply admission followed its own first-store registration, but the Gateway request's separate retained sharing witness did not. The witness invalidated itself on that registration.Forward the existing committed registration callback through reply admission to that witness, after updating the admission selector and before public observers run. Keep asynchronous preparation and the reduced database work; add no SQL, retries, fallback reads, or new lifetime owner. Group the existing session-initialization callbacks in their small owner module while preserving their dispatch-time read. Schema, stored data, and update behavior stay unchanged.
Evidence
pnpm test src/gateway/server.heartbeat-store-lifecycle.product-proof.test.ts --maxWorkers=1: 179.73s Vitest, 194.65s wrapper including worker preparation; timing is not a performance comparison.The first PR CI run caught a type-only import cycle in the callback extraction. The follow-up removes the recorder import while preserving the exact six-field initialization type. Corrected Madge, core types, lint, and P2 review pass; runtime behavior is unchanged, so the completed behavior tests are reused. Corrected-head CI 38330353532 passes all 76 jobs at
b024cd13b300.