Repository navigation
fix(gateway): restore reserved agents after deferred startup - #176508
Conversation
Share configured and reserved agent ownership between Gateway listing and database target resolution. Preserve unowned non-reserved store isolation and all startup authority guards. Fixes #176355. Related: #164799. Regression tests cover both reserved IDs and preserve the corrupt unowned-store skip. Local lint and formatting only; PR CI owns tests and typechecks per maintainer policy.
|
🦞👀 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d61f8ae51a
ℹ️ 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".
Include the shared Gateway roster in preflight admission IDs while preserving configured ACP owners. Remove the fixture override that hid the production eligibility mismatch. Addresses the P2 review on #176508.
|
Codex review: needs changes before merge. What this changesThis PR shares configured-plus-reserved agent membership across Gateway listing, database target resolution, and deferred startup scheduling. Example: An existing crestodian database needs deferred startup preparation without an agents.entries.crestodian entry.
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 addresses a verified reserved-agent eligibility mismatch, resolves both prior findings, and introduces no new discrete defect found in this review. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway startup turns configured ownership and discovered database paths into inspected, prepared agent stores and readiness results. flowchart TD
A[Configured and reserved agents] --> B[Database target resolution]
C[Registry and disk inventory] --> D[Startup inspection]
B --> D
D --> E[Deferred admission scheduler]
E --> F[Guarded database preparation]
F --> G[Agent readiness]
Technical reviewBest possible solution: Keep shared reserved-agent eligibility in the existing roster owner and physical presence discovery in the existing inventory owner. Do we have a high-confidence way to reproduce the issue? Current-main source establishes reserved-target exclusion before deferred preparation; the reporter demonstrates the older release's refusal and workaround, but no current-main live reproduction was run. Is this the best way to solve the issue? The patch repairs eligibility through existing owners, preserves configured ACP claims and non-reserved isolation, and removes the earlier request-path probe without adding another inventory mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b658f4a71a67. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +11, Tests +46, Docs +6. Total +63 across 12 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 HistoryReview history (3 earlier review cycles)
Reviewed October 18, 2026, 7:03 PM ET / 23:03 UTC (Revision 4). |
|
@clawsweeper re-review The P2 scheduler finding on d61f8ae is addressed in aed9114, now published at a01e9f4. Preflight uses configured ACP/session-store IDs plus the shared Gateway-owned roster, and the HTTP regression no longer replaces canDefer. Exact-path, deletion, and preparation fences remain intact. The body records the repair, changed-file lint/format, and fresh scoped-clean P0–P2 branch autoreview with scheduler/migration source context. PR CI is the proof per maintainer policy: https://github.com/openclaw/openclaw/actions/runs/39169602172. Live Gateway, stable-upgrade, local test/typecheck, and negative-control proof are intentionally skipped under that policy. #164799 remains related because version-change admission timing is outside this fix. |
|
🦞👀 Re-review progress:
|
Keep reserved startup targets aligned with disk-backed Gateway membership without adding absent databases to Doctor or port discovery. Share native-path presence policy between candidate and exact targets; preserve configured roots and leave diagnostic snapshots unchanged.
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 351c60477d
ℹ️ 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".
|
@clawsweeper re-review Fixed the P1 in 9089e6b: shared target resolution no longer probes reserved files. Port inventory restricts only expected native additions and consumes its existing asynchronous directory discovery/registry for reserved stores. Configured session/ACP physical claims are preserved. Added the no-probe regression and extended the inventory fixture; independent Codex branch review through P2 is scoped-clean. PR CI is the proof gate per maintainer policy; local tests/typechecks, live Gateway/lease proofs, and negative controls are intentionally skipped. The prior-head session-row-deltas timeout is also present in scheduled main run 39172446197, job 117808338766. The body keeps #164799 related because version-change admission timing remains outside this fix. |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Match the configured-plus-reserved database roster introduced by #176508 (96e6d2d). Its documented shared ownership includes openclaw and crestodian even without authored agent entries. Keep exact scoped-environment and schema expectations, along with refusal before service stop or package installation and the failed update-run outcome. The environment mismatch in the hourly diff was matcher expansion; neither scoped environment value changed. The requested refusal and managed-schema sibling pass on pinned Bun. The full file retains the same nine unrelated candidate-callback failures seen on main before this edit (10 failures before, 9 after). Targeted types, lint, formatting, and independent P2 review pass.
…w#176508) * fix(gateway): prepare reserved system agents after deferred startup Share configured and reserved agent ownership between Gateway listing and database target resolution. Preserve unowned non-reserved store isolation and all startup authority guards. Fixes openclaw#176355. Related: openclaw#164799. Regression tests cover both reserved IDs and preserve the corrupt unowned-store skip. Local lint and formatting only; PR CI owns tests and typechecks per maintainer policy. * fix(gateway): defer reserved stores through the real admission scheduler Include the shared Gateway roster in preflight admission IDs while preserving configured ACP owners. Remove the fixture override that hid the production eligibility mismatch. Addresses the P2 review on openclaw#176508. * fix(gateway): discover only existing unconfigured system stores Keep reserved startup targets aligned with disk-backed Gateway membership without adding absent databases to Doctor or port discovery. Share native-path presence policy between candidate and exact targets; preserve configured roots and leave diagnostic snapshots unchanged. * fix(gateway): retain unreadable reserved stores for admission diagnostics Only confirmed absence removes an unconfigured reserved store from discovery. Preserve inaccessible paths for the existing inspection owner and cover EACCES through candidate and exact target resolution. * fix: keep reserved startup target resolution free of disk probes
Match the configured-plus-reserved database roster introduced by openclaw#176508 (2d20877). Its documented shared ownership includes openclaw and crestodian even without authored agent entries. Keep exact scoped-environment and schema expectations, along with refusal before service stop or package installation and the failed update-run outcome. The environment mismatch in the hourly diff was matcher expansion; neither scoped environment value changed. The requested refusal and managed-schema sibling pass on pinned Bun. The full file retains the same nine unrelated candidate-callback failures seen on main before this edit (10 failures before, 9 after). Targeted types, lint, formatting, and independent P2 review pass.
Fixes #176355
Related: #164799
What Problem This Solves
Existing reserved system-agent databases can be skipped or refused during deferred Gateway startup because they have no authored agent entry.
User Impact
Existing
openclawandcrestodiandatabases receive startup inspection and preparation without artificialagents.entriesmembers. Non-reserved unowned registered stores remain skipped, preserving #164929. No configuration or schema migration is required; integrity, ownership, and deletion checks remain enforced.Why This Change Was Made
Gateway listing, native database targets, and scheduler eligibility share one configured-plus-reserved roster. Configured ACP/session-store claims remain eligible. Expected native targets require no filesystem probes. Doctor/port inventory restricts expected native additions to configured agents and uses its existing asynchronous directory discovery and registry for unconfigured reserved stores, avoiding phantom missing roots. The duplicate listing map and membership accumulation are removed.
Current-main source confirms that reserved targets are excluded before deferred preparation; this is not a current-main live reproduction of the older release's sticky refusal. This addresses the reserved-agent part of #164799, not version-change admission timing. #176355 was closed as a duplicate, not as fixed. Thanks to @yozakura-ava for the discriminator and workaround evidence.
Evidence
9089e6bd9fdf45db71dea136bde4ade775be1aeeonly for the carried-forward session-row timeout and aggregate gate below. The backup job passed its one authorized retry. Production/test types, lint, guards, docs, UI E2E, and all three PostgreSQL conformance lanes passed. PR CI remains the test and typecheck gate per maintainer policy.prepares the deferred reserved %s store without a configured roster entrycovers both reserved IDs; the existing HTTP fleet fixture exercises real scheduler eligibility, recovery, readiness, bounded opening, and preservation of corrupt unowned-store bytes. Target-selection layouts cover reserved ownership;resolves reserved startup targets without probing their filesprotects request-thread target resolution. The port fixture includes discoveredcrestodianwhile excluding absentopenclaw; existing Doctor snapshots remain unchanged.git diff --checkpassed. Final independent Codex branch autoreview through P2: scoped-clean, no actionable P0–P2 findings.server.session-row-deltas.integration.test.tstimeout. This is inherited: the identical test times out in scheduled main run 39172446197, job 117808338766. Attempt 2 carries that result forward as job 117831434765, with the original execution timestamps; it was not retried.gh run rerun --job 117814483869 --repo openclaw/openclaw, was issued once; replacement job 117831434028 passed on the unchanged head in 196 seconds. Its Buncore-runtime-infra-diagnostics-stateshard passed all 84 tests across five files; the formerly failing external-config case passed in 636 ms.src/infra/backup-config-capture.test.tslocally: it passed three times per runtime on both the PR head and merge base (12 file runs, 192 test executions, zero failures). No broader local suite was run.Deferred work retains the original agent ID, paths, environment/state root, and startup lifetime. Current-config path checks, signal/runtime/admission guards, database identity checks, and deletion fences remain at their effect boundaries. No new session binding, authority snapshot, or scheduling limit is introduced.
Backup failure diagnosis and scoped local comparison
The failing allocation creates a random
openclaw-backup-owned-*directory, then awaits boundary/stat work before acquiring its token (backup-scratch.ts:34–48). Concurrent backup maintenance can discover that directory, create its missing token withallowMissing: true, and retire it withPRAGMA user_version=1. The creator then sees an existing retired token and throws. The original CI log showsbackup-create.test.tsarchive cases overlapping the failure at 23:00:17.509 UTC. Commit 5588de47 / #175983 removed allocation retries and explicitly described the reclaimer-before-BEGIN IMMEDIATEwindow.backup-create.ts,backup-scratch.ts, andsqlite-staging-token.tsare identical between head and merge base. The test imports the changed port inventory throughbackup-sqlite-snapshot, but the failure occurs at scratch allocation (backup-create.ts:477), before snapshot collection (:490) reaches that inventory. Backup planning still uses unchangedlistAgentIds; the added roster import contains constants and aSet, with no token disposal or module-level retirement. Preflight is dynamically imported by the later admission diagnostic. None of the changed code receives the newly generated scratch path before token acquisition. No code was changed for this failure; the passing retry does not repair the underlying race.Only this file was run, using the documented runtime selector:
All commands used the task's isolated temporary directory. Node was 26.12.0; Bun was the repository-pinned 1.4.4 fork. Each completed run passed all 16 tests. Wall times include runner preparation and verification.
9089e6bd9fdf9089e6bd9fdfe2a97a7e0dbae2a97a7e0dbaOne earlier cold Node attempt was interrupted during runner preparation/verification after 776.31 seconds, without a test verdict; it is excluded from pass/fail totals. All test wrappers have exited, and the clean task branch is restored.