Repository navigation
Conversation
|
🦞👀 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 Summary: ✅ CompletedThis 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: 842fe0bb6f
ℹ️ 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".
| if (identity?.key.startsWith("path:")) { | ||
| // Settle first birth inside the build before publishing request-visible facts. | ||
| await prepareOpenClawAgentDatabaseExecution( |
There was a problem hiding this comment.
Honor read-only startup admission before creating agent storage
During Gateway's deferred read-first startup, an agent can have an existing custom session.store database but no <agentDir>/openclaw-agent.sqlite, for example when credentials come from config or environment variables. src/state/agent-database-startup.ts:523-526 publishes model inputs inside preparePendingAgentDatabaseRead, but those configured inputs still have readOnly unset. This new opener therefore requests writable admission, which src/state/agent-database-admission.ts:583-585 explicitly refuses in that scope. Publication fails and startup marks the otherwise valid agent degraded before reaching openAgent. Defer this creation to a write-admitted phase instead of treating !input.readOnly as sufficient permission to initialize storage.
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. What this changesThis PR prepares missing agent storage before publishing model facts and lets queued discovery outlive its caller’s temporary SQLite inspection scope. Example: A chat to agent:fallback:xai-fallback overlaps discovery of xai/grok-4.6.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses two current startup failures, and no actionable introduced defect was found; exact-head CI remains pending. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherConfigured model-runtime publication combines agent configuration, credentials and storage facts into request-visible snapshots; background catalog discovery later publishes and persists provider inventory. flowchart TD
A[Gateway startup or reload] --> B[Configured runtime owner]
B --> C[Existing database admission and preparation]
C --> D[Auth facts and runtime publication]
D --> E[Chat and session requests]
D --> F[Background catalog queue]
F --> G[Provider discovery and catalog persistence]
Technical reviewBest possible solution: Retain the final four-file repair through the existing publication and database owners, subject to the normal exact-head CI gate. Do we have a high-confidence way to reproduce the issue? Source exposes both failing interleavings, and the author records base failures under Node/Bun with deterministic Gateway regressions; this read-only review executed no target code. Is this the best way to solve the issue? The final patch repairs fact-publication ordering and background scope ownership without weakening session authorization, adding another state owner or retaining the unnecessary startup-path expansion. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d0daf88ab13f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +37, Tests +701, Other +4. Total +742 across 20 files. Added test files: 1. 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: No label 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 (5 earlier review cycles)
Reviewed November 17, 2026, 12:48 AM ET / 05:48 UTC (Revision 6). |
Keep cold catalog preparation inside writable admission. During deferred read-first startup, prepare missing configured canonical auth storage in the existing writable open phase, including custom session-store owners. Prove real custom-store startup with preserved session history and settings, model-backed chat, and independent session authority. Prepare consumer auth reads before the unchanged first-owner replay deadline, use isolated storage and complete loggers, and preserve real exports in fixture mocks.
|
Update for the remaining catalog-projection fixture correction at The final review of
Earlier resolved items remain addressed:
Fresh final-candidate review is scoped-clean, and the actual final local outcomes are recorded above. Exact new-head hosted CI and zero-open Claw review remain required. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Baseline-Refresh: 49641012cbb7dca3923b551703bc831975c557a0
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
Baseline-Refresh: ad2f544d94eea5d10f89f56a1edbfb84f51f8572
|
Update for The final review of hosted The selected baseline includes the landed repairs for the observed Goal and WebKit CI failures (#200391 and #200399). We first tested main itself: unchanged xAI passes Node/fails pinned Bun with Previously resolved findings remain addressed by the smaller source:
Final 20-file source/context review: fresh independent LOCAL Codex review of all 20 changed files and 63 context files, three complete passes with zero actionable P0–P2 findings; reviewed staged tree equals the signed checkpoint tree. Affected proof and required checks: the smaller source passes the real catalog case under pinned Bun, eight selected ownership/auth/scope cases under each runtime, and all 15 Node prompt-prefix cases. The Node catalog subtraction control already uses the exact final inputs. Prior xAI Node/Bun results are reused through the documented default-layout call-path equivalence, not presented as reruns. The external prefix receipt initially expected 14 cases and was corrected after all 15 actual cases passed; no test was repeated. Cumulative Exact new-head CI and zero unchecked Claw items remain required before landing. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Related: #197784
What Problem This Solves
A first chat can be refused when background model discovery creates its database after the request has captured session facts. Queued discovery can also fail because it inherits a temporary SQLite inspection scope that closes before the queued work starts.
User Impact
First chats can proceed while remote discovery finishes asynchronously. Read-first startup keeps its existing write restriction, and queued catalog work can read auth after the caller's inspection ends. The real Gateway regression preserves custom-store sessions, history and settings and completes a synthetic model-backed chat.
Cold native initialization moves earlier. Historical owner measurements observed about 771 ms more work before publication, warm repeat process CPU of 7.50→9.69 ms (+2.20 ms observed, not established causal overhead), and +4.8792 µs at warm background-callback entry. These are correctness tradeoffs, not throughput improvements. Already-admitted existing databases skip native preparation. There is no new schema, configuration option, cache, retry policy or operator action.
Why This Change Was Made
Independent catalog persistence from #197784 (
76385fd77e3f77604489178112344be0b3ffed43) could create a database after chat captured its absence. Registration checks then correctly rejected the stale facts. Configured model publication now awaits existing native preparation within its current build budget before capturing auth facts, only when writable admission permits it. Read-only startup publication does not borrow write authority.The existing background catalog launch now exits only the caller's SQLite inspection scope. Spawn-broker and database-engine context remain intact, and the current plugin-generation and authority owners still govern the work when it starts.
The final change adds 37 production lines across four files. A controlled subtraction removed the entire proposed startup-path expansion: the real custom-store Gateway case still preserved session authority, catalog persistence, stored data and chat. This PR therefore does not add canonical-path preparation to the writable startup owner. The remaining growth carries the awaited callback through its existing budget and provides the narrow background lifetime transfer. Affected fixtures use the maintained writer to establish the native storage prerequisite before simulating Gateway publication; their original assertions and deadlines remain.
Evidence
Reviewed candidate:
44ae9fd79e9bae3f819dfea40cbf3d01454da8e5, composed on exact main282d5efe4b21f96339d915359dfef7978afd969e. This baseline contains the landed Goal completion fix #200391 (bbefb541) and WebKit animation-check fix #200399 (282d5efe), both repairing actual failures in this PR's previous CI. The previous hosted candidate was60ae9e5. The final 20-file working tree is bound asf6e05e0a450851648266dd8a9285be160e07f48c; fresh local review and affected checks are complete as reported below; new-head hosted CI and Claw review remain pending.SESSION_MUTATION_AUTHORIZATION_CHANGED. With only the deterministic test packet added, the same request/catalog interleaving fails under both runtimes. The real queued custom-store catalog case fails under Node withSQLITE_READONLY_WORKER_SCOPE_CLOSED; its Bun arm passes. These observations do not establish a runtime-only defect.a1c31b49, the controlled xAI case and real custom-store catalog case pass under both Node and pinned Bun. The tests use actual catalog persistence, retain independent authority witnesses and preserve the original request assertions.pnpm check:changed --base 282d5efe4b21f96339d915359dfef7978afd969e --staged --timedpassed 35/36 gates and exited 1 in 694.735 s; only the dead-export scan failed with 7 production/3 full-tree symbols. The exact 282 baseline scan reproduced the complete same sets in 100.792 s with identical 254 install inputs; all type/lint/format and remaining guards passed. This qualifies the local baseline failure only, not hosted CI or an inherited landing exception. Actual cumulative growth remains 701 test lines, with 301 explicitly allocated beyond the unchanged 400-line allowance. Final-source context binding and ratchet receipts: all 20 source/63 review-context hashes and the whole final tree match the signed checkpoint; the current changed check passed its line-growth and mock ratchets. The allocation remains 701 / (400 + 301).44001040624on hosted60ae9e5failed Goal, UI and heartbeat jobs. Goal and UI have separately landed source repairs now incorporated through the selected baseline. The heartbeat timeout did not reproduce in the recorded Mac and Linux parent/merge replays, and has no identified introducing cause. It remains unexplained; those passes are not a fix or an inherited-failure waiver. A new exact-head CI verdict is still required.Historical causal proof, previous failed gates, and compatibility limits
The original xAI investigation forced the real catalog-save interleaving: Bun failed on the original owner, an explicit pre-#197784 save control passed, and the fix passed under Node and pinned Bun with actual persistence. Independent session-entry and database-absence witnesses still reject actual changes. Historical
842fe0bstartup proof exposed an unconditional eager-write refusal on both runtimes; its exact invoking publication phase was not uniquely recorded. That evidence supports preserving read-only admission, not claiming the now-deleted startup expansion was independently necessary.Both original background-owner variants failed with
SQLITE_READONLY_WORKER_SCOPE_CLOSED; the scope repair passed the owner cases under Node and Bun with broker/engine restrictions intact. The final Gateway fixture uses real catalog-limiter occupancy. Canonical SQL assertions retain the supported identity and birthtime contract added by #200192; the earlier cross-base claim that the birthtime field was inert was withdrawn. Its failed typecheck and intermediate checks remain historical, not final-source qualification.The overlapping agent add/delete fixtures reproduced on Linux under Node and Bun. The correlated failure retained the original dispatch while the configured owner was replaced. Removing only this PR's first-birth addition made the original nine-case prefix pass. With production unchanged, persisting the union of required stores before initial roster publication made the prefix pass under both runtimes. Later reload ordering, snapshot publications, generation checks and deadlines stayed intact. This qualifies fixture initialization, not a Bun-only defect or an inherited CI exception.
Earlier CI exposed additional fixture consumers. The complete retained census is 17 failed cases in eight files; a catalog-projection case was missed in the initial census and corrected later. The actual-merge originals failed under Node/Bun, exact-parent controls passed, and the maintained-writer corrections passed without changing their assertions. The 100 ms no-replay test retains its timer, exact work counts and zero-owner precondition; real persisted-reader setup occurs before the timed contract. Partial logger/legacy mocks retain real module exports, with only the two obsolete baseline rows removed.
Prior full/correction checks remain recorded with their actual nonzero exits. The integrated 13-file check passed 35/36 and exited 1 solely on 14 production/108 full-tree export findings. Later eight- and two-file correction checks passed 25/26 and exited 1 on exactly those same sets; type/lint/format passed. Those findings matched the exact 2435 main-parent run and all 113 symbols had source causes: #200114, #198133, #198835, #198933, #198936, #198943 and
94e34f956969a2070aa7ad614894b443a6b63049(PR unidentified). This was local baseline qualification only. It does not qualify a different parent or waive new hosted CI. An earlier aggregate exited2 on the material birthtime API mismatch. Previous independent Codex reviews were scoped-clean on their respective supplied sources, did not execute project code, and reported unavailable surrounding/sensitive context. The current source has the separate fresh LOCAL review and exact tree binding reported above.The original first-birth measurement used a real synthetic 35 GiB agent database and 5,000 sessions, with comparison samples and A/A controls. Warm native preparation remained 0→0. Cold publication plus later save measured 974.01→896.45 ms wall, 1332.13→1343.65 ms process CPU, and 38.62→39.04 MB sampled host-JS allocation. Warm repeat wall was 7.41→8.30 ms; CPU A/A range was 29.20%. This covers the original 842 insertion, not subsequent source revisions. Its workspace was empty; it does not demonstrate a 62,000-file traversal.
The background-launch measurement used the retained synthetic 35 GiB database, 5,000 sessions and actual 62,000-file workspace path through an APFS COW clone. The scheduler/auth read does not traverse that workspace. Three counterbalanced A/B pairs and two independent A/A pairs performed equal work: 220 actual canonical reads with matching results and context checks. Warm callback entry was 4.7166→9.5958 µs (+4.8792 µs), above the observed A/A difference. End-to-end wall changes were inconsistent, including one increase beyond A/A bounds; no speedup, neutrality or noise-only conclusion follows. Sampled host-JS allocation was inconclusive. Both measurements are single-agent APFS owner controls with uncontrolled GC/page cache, not btrfs, fleet, total native-allocation or Gateway-throughput proof. Changed main auth/catalog contexts prevent treating these as fresh final-base measurements.
Installed compatibility proof remains bound to historical
553b9430143c4013cd818635e122016ccaabeccd, before the background-scope repair: stable 2026.11.4 (d843d6af) → that exact package through verified backup, external package installation and Doctor. The installed Gateway retained the same custom-store session ID, thinking/verbosity settings, transcript prefix and remaining configuration except the explicitly asserted supported Workshop migration/marker from #192766. One real inference request to a synthetic Responses server produced a retained assistant reply. This is not a packaged upgrade of the final head, self-update, live xAI, or attribution of which operation created the database during the combined transition. Failed setup attempts and the corrected same-specimen assertion remain recorded; proof resources were cleaned up.All fixtures are synthetic. Final-head CI and zero-open Claw review remain separate landing requirements. Previous successful reviews and passing replays do not waive them.