Repository navigation
fix(state): retain schema and disposal refusals during cold admission - #175295
Conversation
Reopen cold state handles after an observed schema-owner handoff so a newer schema is refused before the first write callback. Keep warm schema admission cached as intended by #175077. Retain exact execute-refusal provenance through worker retirement and deliver the original host lifecycle error. Preserve shared preparation from #175008, native-exit joining and unknown execute settlement. Exercise registry error handling with a custom store that requires the registry after #175129. Keep every existing assertion. Before: three deterministic main failures,35passes,128.76s wall. After: all38tests pass,211.93s wall including worker rebuild; files took 92.46s/54.14s/49.98s through native --maxWorkers=1 wrapper. Targeted types/lint/format pass; P2 review scoped-clean.
|
🦞👀 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. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR refreshes cold schema admission after an ownership handoff and preserves original worker disposal refusals. Example: Another schema owner changes a database to user_version 999999 between cold opening and the first write.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR narrowly repairs evidenced admission failures still present on main, with no actionable code findings. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherShared-state transactions and session preparation use database admission and SQLite workers; callers receive committed results or lifecycle errors after native settlement. flowchart TD
A[State or session operation] --> B[Database admission]
B --> C[Schema owner handoff]
C --> D[Reopen and validate]
B --> E[SQLite worker]
E --> F[Broker retirement and settlement]
D --> G[Result or original refusal]
F --> G
Technical reviewBest possible solution: Preserve first-admission schema validation and original lifecycle refusals through the existing database and worker owners. Do we have a high-confidence way to reproduce the issue? Existing regressions exercise a future-schema handoff and disposal during deferred session preparation, and scheduled main independently fails those cases; no tests were run during this read-only review. Is this the best way to solve the issue? The patch repairs the existing admission boundaries without restoring intentional warm revalidation, duplicating lifecycle ownership, or weakening native settlement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6249e5b5051b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +9, Tests 0. Total +9 across 4 files. Added test files: 0. View PR surface stats
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 Reviewed October 17, 2026, 3:46 AM ET / 07:46 UTC. |
Require one current follower for shared integrity/schema effects. Settle request-owned native opening before a healthy successor reuses or replaces the generation; keep the full shared preparation joinable. Both hourly 39010956087 regressions came from #175008. Preserve the existing reclamation assertions while checking the missing index before incidental worker termination. Initial native admission and first-use creation retain original caller authority. Focused six-file proof plus final three-case integration cover 74 distinct passing cases; the existing Linux-only killed-owner case remains for CI. Targeted types, type-aware lint, docs, formatting and P2 review pass. Integrates with prerequisite #175295, which owns refusal propagation; no duplicate broker or worker changes.
Require one current follower for shared integrity/schema effects. Settle request-owned native opening before a healthy successor reuses or replaces the generation; keep the full shared preparation joinable. Both hourly 39010956087 regressions came from #175008. Preserve the existing reclamation assertions while checking the missing index before incidental worker termination. Initial native admission and first-use creation retain original caller authority. Focused six-file proof plus final three-case integration cover 74 distinct passing cases; the existing Linux-only killed-owner case remains for CI. Targeted types, type-aware lint, docs, formatting and P2 review pass. Integrates with prerequisite #175295, which owns refusal propagation; no duplicate broker or worker changes.
The fault worker delegated iteration with yield*, which does not close the native iterator when next() throws. Its completed wrapper then hid the native return() from Kysely cleanup. On Node 24.19 the cached statement reported the old injected error on its next use after faults were disabled. Explicitly close the native iterator before restoring the TEMP triggers. Production queue and database behavior is unchanged. Preserve every committed-prefix, pending-input and exactly-once assertion. The scalar INSERT ... RETURNING path added by #175193 exposed this latent fixture defect. #174897 did not remove a required predecessor, and #175295 is not the cause. Reproduced the same failure on hourly ab37bc6 and current main 9c12710 using CI's Node 24.19.0; Node 24.22 used all() and passed without the change. Focused full-file proof: 5/5 pass in normal order with --maxWorkers=1, 28.45 s Vitest / 49.62 s command wall. Independent P2 review is clean. All 22 affected consumer files pass: 337 tests using Node 24.19 and --maxWorkers=1. The other 21 files take 509.14 s wall across five native configs. Owning test-helper types, boundary lint, syntax, formatting and whitespace checks pass. Root-test type-aware lint reports the same pre-existing no-map-spread violation at this file's unchanged line 22 on both base and candidate; no new diagnostic or suppression is introduced. No CI dispatch or rerun.
…e preparation (#175307) * fix(state): retain caller authority during shared database preparation Require one current follower for shared integrity/schema effects. Settle request-owned native opening before a healthy successor reuses or replaces the generation; keep the full shared preparation joinable. Both hourly 39010956087 regressions came from #175008. Preserve the existing reclamation assertions while checking the missing index before incidental worker termination. Initial native admission and first-use creation retain original caller authority. Focused six-file proof plus final three-case integration cover 74 distinct passing cases; the existing Linux-only killed-owner case remains for CI. Targeted types, type-aware lint, docs, formatting and P2 review pass. Integrates with prerequisite #175295, which owns refusal propagation; no duplicate broker or worker changes. * fix(state): preserve borrowers after known promotion refusals Capture shared promotion admission as well as initial native admission, preserving logical borrowers only for known, uncommitted refusals. Protocol faults, unknown outcomes and cleanup failures retain their terminal handling. The new retained-borrower regression failed before this correction and passes with it. Also seed transcript data in the reclamation concurrency fixture: #175091 intentionally avoids reclamation workers for eventless deletes. Keep all original assertions and deadlines. Rebased focused proof covers 75 cases including both hourly 39013936147 reds; all 8 final error-path cases pass. Targeted types, lint, format, docs and independent P2 review pass. * test(state): complete idle generation fixture contract Return no pending native open from the timer-only generation stub, matching the required contract introduced by #175307. The production factory already supplies this method; wrappers retain the real generation. Keep every idle expiry, reborrow, creation, alias, cleanup and restart assertion unchanged. Before: four idle lifecycle cases fail with getPendingNativeOpen missing, and the state-logging test graph reports TS2345. After: all eight openclaw-agent-execution test files pass (91 tests, one existing Linux-only skip; 125.20 seconds including worker preparation). State-logging test types, targeted lint, formatting and P2 review pass. * test(state): follow physical admission in refusal fixture Main b499c60 moved existing-file opening off caller admission. Observe the real physical open so the refusal fixture still starts concurrent survivor reads, and remove its obsolete caller callback. Keep all refusal, liveness, exact-result and cleanup assertions. Clarify the shared native opening wording after integrating the peer cancellation fix. The requested ten-file proof passed 99 cases and exposed this stale trigger. The corrected close-wedge file passes all 7 cases (17.37 seconds), bringing combined coverage to 100 distinct passes and one existing Linux-only skip. Gateway reclamation is 2/2; reply admission, state-logging types, targeted lint and formatting pass. No CI reruns. Independent P2 review is scoped-clean for the rebased candidate and this fixture follow-up.
Existing-only opens validate the immutable anchor without BEGIN IMMEDIATE. Creation retains its transaction and all identity, schema, and admission refusals remain. A real two-handle cold-admission regression fails before the fix even with #175295 reversed. Native PostgreSQL schema and Gateway tests pass 18/18 on the refreshed base (187.50s command wall; regression 344ms), plus retained opener proof 4/4. Targeted types, core/boundary lint, format, and P2 review pass.
…nclaw#175295) Reopen cold state handles after an observed schema-owner handoff so a newer schema is refused before the first write callback. Keep warm schema admission cached as intended by openclaw#175077. Retain exact execute-refusal provenance through worker retirement and deliver the original host lifecycle error. Preserve shared preparation from openclaw#175008, native-exit joining and unknown execute settlement. Exercise registry error handling with a custom store that requires the registry after openclaw#175129. Keep every existing assertion. Before: three deterministic main failures,35passes,128.76s wall. After: all38tests pass,211.93s wall including worker rebuild; files took 92.46s/54.14s/49.98s through native --maxWorkers=1 wrapper. Targeted types/lint/format pass; P2 review scoped-clean.
The fault worker delegated iteration with yield*, which does not close the native iterator when next() throws. Its completed wrapper then hid the native return() from Kysely cleanup. On Node 24.19 the cached statement reported the old injected error on its next use after faults were disabled. Explicitly close the native iterator before restoring the TEMP triggers. Production queue and database behavior is unchanged. Preserve every committed-prefix, pending-input and exactly-once assertion. The scalar INSERT ... RETURNING path added by openclaw#175193 exposed this latent fixture defect. openclaw#174897 did not remove a required predecessor, and openclaw#175295 is not the cause. Reproduced the same failure on hourly ea5c031 and current main 6b9b192 using CI's Node 24.19.0; Node 24.22 used all() and passed without the change. Focused full-file proof: 5/5 pass in normal order with --maxWorkers=1, 28.45 s Vitest / 49.62 s command wall. Independent P2 review is clean. All 22 affected consumer files pass: 337 tests using Node 24.19 and --maxWorkers=1. The other 21 files take 509.14 s wall across five native configs. Owning test-helper types, boundary lint, syntax, formatting and whitespace checks pass. Root-test type-aware lint reports the same pre-existing no-map-spread violation at this file's unchanged line 22 on both base and candidate; no new diagnostic or suppression is introduced. No CI dispatch or rerun.
…e preparation (openclaw#175307) * fix(state): retain caller authority during shared database preparation Require one current follower for shared integrity/schema effects. Settle request-owned native opening before a healthy successor reuses or replaces the generation; keep the full shared preparation joinable. Both hourly 39010956087 regressions came from openclaw#175008. Preserve the existing reclamation assertions while checking the missing index before incidental worker termination. Initial native admission and first-use creation retain original caller authority. Focused six-file proof plus final three-case integration cover 74 distinct passing cases; the existing Linux-only killed-owner case remains for CI. Targeted types, type-aware lint, docs, formatting and P2 review pass. Integrates with prerequisite openclaw#175295, which owns refusal propagation; no duplicate broker or worker changes. * fix(state): preserve borrowers after known promotion refusals Capture shared promotion admission as well as initial native admission, preserving logical borrowers only for known, uncommitted refusals. Protocol faults, unknown outcomes and cleanup failures retain their terminal handling. The new retained-borrower regression failed before this correction and passes with it. Also seed transcript data in the reclamation concurrency fixture: openclaw#175091 intentionally avoids reclamation workers for eventless deletes. Keep all original assertions and deadlines. Rebased focused proof covers 75 cases including both hourly 39013936147 reds; all 8 final error-path cases pass. Targeted types, lint, format, docs and independent P2 review pass. * test(state): complete idle generation fixture contract Return no pending native open from the timer-only generation stub, matching the required contract introduced by openclaw#175307. The production factory already supplies this method; wrappers retain the real generation. Keep every idle expiry, reborrow, creation, alias, cleanup and restart assertion unchanged. Before: four idle lifecycle cases fail with getPendingNativeOpen missing, and the state-logging test graph reports TS2345. After: all eight openclaw-agent-execution test files pass (91 tests, one existing Linux-only skip; 125.20 seconds including worker preparation). State-logging test types, targeted lint, formatting and P2 review pass. * test(state): follow physical admission in refusal fixture Main 0f21575 moved existing-file opening off caller admission. Observe the real physical open so the refusal fixture still starts concurrent survivor reads, and remove its obsolete caller callback. Keep all refusal, liveness, exact-result and cleanup assertions. Clarify the shared native opening wording after integrating the peer cancellation fix. The requested ten-file proof passed 99 cases and exposed this stale trigger. The corrected close-wedge file passes all 7 cases (17.37 seconds), bringing combined coverage to 100 distinct passes and one existing Linux-only skip. Gateway reclamation is 2/2; reply admission, state-logging types, targeted lint and formatting pass. No CI reruns. Independent P2 review is scoped-clean for the rebased candidate and this fixture follow-up.
…175389) Existing-only opens validate the immutable anchor without BEGIN IMMEDIATE. Creation retains its transaction and all identity, schema, and admission refusals remain. A real two-handle cold-admission regression fails before the fix even with openclaw#175295 reversed. Native PostgreSQL schema and Gateway tests pass 18/18 on the refreshed base (187.50s command wall; regression 344ms), plus retained opener proof 4/4. Targeted types, core/boundary lint, format, and P2 review pass.
What Problem This Solves
Fixes incorrect database admission after a schema-owner handoff and loss of the original disposal refusal during deferred session preparation. Both appeared in main hourly 39010956087.
User Impact
A cold write refuses a database upgraded by a newer owner before its callback can mutate it. Disposal during session preparation reports the original lifecycle refusal, while rejected work remains uncommitted and a later operation can recover. No migration or operator action is required.
Why This Change Was Made
Evidence
Before on
363f07d8be98: all three reported failures reproduced, 35 passed / 3 failed, 128.76 s native command wall. Existing regressions remain intact apart from the registry-required fixture input.After: 38/38 passed, 211.93 s command wall including worker rebuild. File timings: state transactions 10/10 in 92.46 s, placement evidence 12/12 in 54.14 s, entry admission 16/16 in 49.98 s.
Thirteen sibling files: 93 passed; the pre-existing Linux-only killed-owner case is gated on macOS and remains for PR CI. Coverage includes cache retention and close custody, worker reply cleanup/native settlement, shared integrity preparation and schema admission, and registry-target inventory/deduplication.
State/SQLite, agent/session and Gateway-server test typegraphs pass. Type-aware and boundary lint, formatting and whitespace pass. Independent P2 review is scoped-clean. All test commands use the repository's native wrapper with
--maxWorkers=1; PR CI provides broad and Linux proof. No skips, assertion weakening, retries or timeout changes were added.CI follow-up: the five changed-compact failures are inherited
CI run 39013823977 tested merge
1457cda7of this head into4c15811faab4. Its “unknown” classifications reflect unmatched changed-job names, so each failing file was run through the native wrapper on current main8c4ea360522cand PR head6fa2a3a05cbc. All five test-file blobs are identical between those trees.reply-turn-admission.worker.test.tsSynthetic cancelled replyserver.sessions.reclamation-admission.test.ts[]versus[1]doctor-session-sqlite.targets.test.ts(pinned Bun)update-command-doctor-child.test.tsserver.agent-database-recreation-product-proof.test.tsmemory-core/worker-api.js, then worker exit 1The Memory failure occurs at public-surface resolution before SQL: the Gateway fixture disables bundled plugins but directly imports the real Memory runtime; the new worker inherits the disabled environment without the fixture's imported runtime. Those owners are unchanged between the CI merge parent and tested current main. This PR does not modify Memory worker entry, environment, artifact resolution or that fixture.
Paired proof: current main has 6 failures / 16 passes; PR head has 5 failures / 17 passes. Four Node files took 255.66 s on main and 143.17 s on the head; the pinned-Bun file took 144.13 s and 50.37 s, including native worker preparation.
Fresh P2 review of the unchanged commit is scoped-clean. Original focused types/lint/test proof remains valid. No source changes, additional push or CI rerun were made for these five inherited failures. CI remains red; other failed jobs are outside this five-job attribution.