Repository navigation
fix(gateway): first chats fail during cold storage startup - #199565
Conversation
Create the owned state root before publishing fixture selectors so recursive agent setup keeps it private under a permissive creation policy. Add a real-filesystem child regression using the existing managed runner. Runtime red/green is UNRUN; this local candidate is not publication-ready. Original continuation and supported shared-state logging issues remain open. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 2394395c-2cca-8e71-b107-d1782704b86e
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesWaits for existing first-use database preparation before capturing session registry facts and creates private Gateway test state. Example: A chat targets agent:main:sharing while sessions.sqlite is being created.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a current cold-start ordering bug with a focused change; no actionable correctness or security defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway session authorization acquires database identity, registry and sharing facts before allowing chat or session operations. flowchart TD
A[WebSocket chat request] --> B[Session authorization]
B --> C[Sharing fact acquisition]
C --> D[Existing database preparation]
D --> E[Registry and physical identity validation]
E --> F[Authorized chat execution]
Technical reviewBest possible solution: Join existing first-use creation and qualify source identities before registry validation through the existing fact-acquisition owner. Do we have a high-confidence way to reproduce the issue? Current main exposes both ordering failures, and the supplied causal regressions record registry-error RED/GREEN results; no target code was executed during this read-only review. Is this the best way to solve the issue? The repair preserves the invariant that registration is classified against the acquired physical generation, using existing owners without retries, new state or relaxed access checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 284f555a2588. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +24, Tests +155. Total +179 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
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 HistoryReview history (3 earlier review cycles)Reviewed November 15, 2026, 5:47 PM ET / 22:47 UTC (Revision 4). |
Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
Retain the existing published PR head without changing the reviewed source tree. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: fa092d79-9524-8fc8-ba79-f014cd2840d0
Drop the competing skill projection delta after PR #197510 repaired that owner on main. Keep the original independently proven private fixture change only; merge retains main's skill assertions. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: e8b6fdb3-8609-85b8-8d5e-d1db281a091f
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…199565) * test(gateway): create fixture state privately Create the owned state root before publishing fixture selectors so recursive agent setup keeps it private under a permissive creation policy. Add a real-filesystem child regression using the existing managed runner. Runtime red/green is UNRUN; this local candidate is not publication-ready. Original continuation and supported shared-state logging issues remain open. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * fix(gateway): keep fixture state private under permissive umasks Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 2394395c-2cca-8e71-b107-d1782704b86e * fix(gateway): preserve retained context in skill refresh proof Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * fix(gateway): keep fixture state private under permissive umasks Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: fa092d79-9524-8fc8-ba79-f014cd2840d0 * fix(gateway): retain landed skill refresh coverage Drop the competing skill projection delta after PR openclaw#197510 repaired that owner on main. Keep the original independently proven private fixture change only; merge retains main's skill assertions. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * fix(gateway): keep fixture state private under permissive umasks Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: e8b6fdb3-8609-85b8-8d5e-d1db281a091f * fix(gateway): first chats fail during cold storage startup Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 7ac9760f-b182-89d8-ba33-0e083183f2ff --------- Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies #197510 as the first failing first-chat authorization boundary; #199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to #200533, #198455, and #200817. Preserve peer cleanup scope in #201019.
…200966) * perf(agents): materialize selected rows for simple completions * style: satisfy selected completion lint checks * test: bind isolated registry measurement to concrete instances * test: align participant custody with requester ownership Follow #200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean. * fix: retain missing-session facts across database creation Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies #197510 as the first failing first-chat authorization boundary; #199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to #200533, #198455, and #200817. Preserve peer cleanup scope in #201019.
…penclaw#200966) * perf(agents): materialize selected rows for simple completions * style: satisfy selected completion lint checks * test: bind isolated registry measurement to concrete instances * test: align participant custody with requester ownership Follow openclaw#200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean. * fix: retain missing-session facts across database creation Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies openclaw#197510 as the first failing first-chat authorization boundary; openclaw#199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 4dca39a and attributed to openclaw#200533, openclaw#198455, and openclaw#200817. Preserve peer cleanup scope in openclaw#201019.
…200966) * perf(agents): materialize selected rows for simple completions * style: satisfy selected completion lint checks * test: bind isolated registry measurement to concrete instances * test: align participant custody with requester ownership Follow #200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean. * fix: retain missing-session facts across database creation Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies #197510 as the first failing first-chat authorization boundary; #199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to #200533, #198455, and #200817. Preserve peer cleanup scope in #201019. (cherry picked from commit 8610cd6) Co-authored-by: RomneyDa <[email protected]>
…penclaw#200966) * perf(agents): materialize selected rows for simple completions * style: satisfy selected completion lint checks * test: bind isolated registry measurement to concrete instances * test: align participant custody with requester ownership Follow openclaw#200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean. * fix: retain missing-session facts across database creation Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies openclaw#197510 as the first failing first-chat authorization boundary; openclaw#199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to openclaw#200533, openclaw#198455, and openclaw#200817. Preserve peer cleanup scope in openclaw#201019. (cherry picked from commit 8610cd6) Release adaptation: approved 2026.11.7 models replay; see models-hook-safe-v2/REPORT.md. Co-authored-by: RomneyDa <[email protected]>
Related: #197510
What Problem This Solves
First chat requests can fail with storage-unavailable errors while an agent database is starting. Permissive fixture umasks also prevent Gateway tests from reaching that behavior.
User Impact
Cold chat requests retain the existing database preparation instead of rejecting its first registration. Filesystem permission, routing, lifetime and source-identity guards remain enforced. No migration or configuration change is required.
Why This Change Was Made
Wait only for an already-running first-use creator before capturing the registry witness, and classify existing-file registrations against physically qualified identities. Readiness stays in the existing fact-acquisition owner; the caller retains its lifetime and routing checks. This adds no retry or timeout increase.
Create fixture-owned
.openclawwith mode0700before publishing its selectors. The native writable-ancestor guard is unchanged; no chmod, skip, quarantine or permission override is added.Evidence
d8b5dc1572f7f53a0169de4a2d30cd9aabc9c4ef.agent.waitreturnedok, history contained exactly one expected assistant answer, and the tracked local HTTP provider received one request. The native run ended with no suite or unhandled errors, and one-release AWS cleanup completed.The first-chat test issues one SDK chat intent, not one wire attempt: the unmodified SDK made five wire attempts (four normal startup refusals, one handler start). No test retry wrapper, database prewarm or request-timeout change was added. This qualifies the current user flow with an explicit observation overlay; it is not an original-versus-fixed Gateway RPC RED/GREEN comparison. The owner-level causal regressions below provide that separate evidence. The provider is local and deterministic, not a live external model.
Selected first-chat native receipts and source scope
Projected from the actual selected-case and native run-end receipts; the immutable pre-release snapshot is the pause witness:
The clean native observation commit is a child of this PR head, with four explicit observation/test-path changes. The production preparer is byte-identical to the PR; the fact-reader algorithm is unchanged apart from scalar publications. It is not claimed to be the unmodified published tree. Pinned Node 24.22.1 and pinned Bun
1.4.4-canary.1+191755ec1both passed the tiny native-channel/correlation control before product work. The selected first-chat case passed; the five existing recovery cases were intentionally not selected in this additional run and are covered by the 70-case qualification below.Only the immutable pre-release snapshot establishes the held creator. Later open counters include a normal second open; the auxiliary post-open pause flag is not a liveness observation and is excluded from qualification. Earlier probes that timed out before the required observation were rejected, not counted as causal RED.
Owner regressions, fixture isolation and scoped checks
qaRuntimebuild passed; all 49 owner, 16 creation/settlement and five original recovered-output cases passed (70 total, zero pending).0775versus0700, then helper 3 + recovered-output 5 + encrypted 1 cases passed. Both fixture files remain byte-identical to that qualified source.The normalized proof used failed CI merge
3449e444e4a8733541d828e894d86ce74f83705d, with all five changed-file bytes matching this revision. Its97dd78cc2cbd4f9dff1add734a2b316ac8d8bf31main integration was a different whole tree; the subsequent successful current-head PR CI above, not file-byte equality, supplies integration validation.Full-main qualification, release packaging and manual Windows/live-external-model proof are not claimed. Current-head ClawSweeper satisfaction and the native landing workflow remain required; nothing has been merged by this update.
Contributor credit
Co-authored-by: obviyus [email protected]
Co-authored-by: steipete [email protected]
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by