Skip to content

fix: startup waits for transient shared-state schema admission - #195398

Merged
RomneyDa merged 6 commits into
release/2026.11.5from
openclaw/beta2-read-admission-repair
Nov 8, 2026
Merged

RomneyDa merged 6 commits into
release/2026.11.5from
openclaw/beta2-read-admission-repair

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Repairs Gateway startup failure after an upgrade when a foreign shared-state schema lease is encountered immediately before the webhook completion read.

Related: #194770

Release scope

Deferred to the next beta per the maintainer's November 8, 2026 direction. This PR and its diagnostic runs are not prerequisites for 2026.11.5-beta.2. That release retains its previously frozen candidate and is recovering its original green qualification evidence. Do not adopt this patch into beta.2.

User Impact

Startup can wait for transient schema admission instead of failing immediately. Genuine offline maintenance, cancellation, and stale database identity still refuse the read. No schema migration or configuration change.

Why This Change Was Made

The existing read owner uses bounded acquisition at native borrowing and final queued dispatch, sharing the existing five-second budget. It never retries an entered query, snapshot, consumer callback, or cleanup. Regression coverage includes the real startup completion path and queued admission. Offline-custody inspection and synthetic benchmark/fixture callers implement immediate acquisition, without ordinary-read retries.

This is based on frozen beta source, not a rebase onto main. It does not adopt a new candidate or qualify publication. A main forward-port remains required.

Evidence and remaining gates

  • Original macOS Node26 upgrade from 2026.11.2: run42512174792/job128829070373. Installation succeeded; webhook completion read failed after46.3ms, at3.3s total startup, with a foreign sqlite-maintenance schema owner PID22176. This was not a five-second timeout. Its command, parent and lease duration remain unknown. Concurrent gateway-status PID22154 does not establish attribution.
  • Independent read-only investigation found no demonstrated leaked lease or misordered updater teardown. Frozen-source startup-metadata-live-read.worker.ts deliberately holds schema custody around an immutable read through native close. Local gateway status advisory plugin metadata can reach that path even after failed RPC. This is a legitimate candidate producer, not proven attribution to PID22176. Removing custody violates immutable-source safety; broad startup reordering is not justified by the retained evidence. The five-second bound is policy, not an observed holder duration. This patch is admission repair, not an established ownership-lifecycle fix or a guarantee that every asynchronous read waits.
  • Original independent patch review found an incorrect cancellation expectation, corrected to assert original error identity. It missed interface callers subsequently caught by hosted CI; it is not final-head proof.
  • CI42519576496 exposed missing acquisition adapters in Gateway custody inspection and benchmark, plus formatting. Corrected at d60ba85/fe1f0520/a13471fd, including the embedded fixture discovered by caller tracing.
  • PR CI42520253958/job128852443207 exposed an invalid persisted-owner fixture: missing required configPath and invalid process owner-kind. At140206867e9493dccae364fa44a120a9a31aac51 the fixture uses LockPayload, omits owner-kind for process ownership, and supplies configPath. No production policy or timeout changed. Earlier passing malformed schema fixtures are not accepted as live-schema contention proof.
  • Simplification retains one acquisition owner and existing retry helper; no new framework or startup-specific retry. Net test/support allocation146 lines. Pinned oxfmt0.74.0 and git diff --check passed; no local tests/builds/installs/preflight.
  • Baseline diagnostic: https://github.com/openclaw/openclaw/actions/runs/42519561511 at test-only c2ef3ac. Behavioral startup-red result remains to be collected separately from formatting failures.
  • Current-head Node/Bun dual-all diagnostic: https://github.com/openclaw/openclaw/actions/runs/42522043011, same-revision repair branch workflow and target140206867e9493dccae364fa44a120a9a31aac51. Superseded42521511502 failed preflight because its main workflow and target revisions differed; no tests executed. Ordinary PR CI42521448587 is also pending.
  • Current-head macOS packaged-upgrade diagnostic: https://github.com/openclaw/openclaw/actions/runs/42521477971, baseline2026.11.2, workflow main at observed SHA795a03fe2429e5696a8b624dd0c0ec13e50a6f42. Explicitly cross-revision diagnostic evidence, not candidate qualification. Node26 execution and outcome remain unverified.
  • Superseded macOS42519653564 failed compilation;42520837288 failed before execution because the repair was not an ancestor of the release branch;42519584586 used an unsupported workflow ref. No guard changed or setup failure counted as product proof.
  • Remaining gates for this deferred patch: baseline-red/current-green, real worker settlement, actual Node26 packaged upgrade, outstanding incident-provenance uncertainty, and final-head hosted review. These do not block beta.2's original-candidate publication recovery.
  • Helper-based local review unavailable; independent subagent review is not helper validation. One hosted ClawSweeper review remains required after final proof/body are ready.

RomneyDa and others added 2 commits November 8, 2026 20:19
Exercise the real webhook completion read after native bootstrap on the frozen beta source. Hosted baseline proof is pending; no local test execution.

Co-authored-by: RomneyDa <[email protected]>
Reuse the existing bounded acquisition owner for native borrowing and final queued dispatch. Preserve true maintenance refusal, cancellation, identity checks, FIFO ownership, and one execution of the read and cleanup. Independent review found no production defect; corrected its queued cancellation expectation. Hosted proof pending; no local tests run.

Co-authored-by: RomneyDa <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M labels Nov 8, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review November 8, 2026 20:23
RomneyDa and others added 2 commits November 8, 2026 20:26
Complete the read authority contract for the offline Gateway owner inspection. Recheck its existing custody without adding ordinary-read retries.

Co-authored-by: RomneyDa <[email protected]>
Update the synthetic worker benchmark for mandatory acquisition and format the startup regression.

Co-authored-by: RomneyDa <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 8, 2026
RomneyDa and others added 2 commits November 8, 2026 20:27
Keep generated non-isolated lifecycle fixtures compatible with required acquisition. Net test/support growth is 142 lines.

Co-authored-by: RomneyDa <[email protected]>
@RomneyDa

RomneyDa commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds bounded waiting for transient shared-state schema admission before native borrowing and queued read dispatch.

Example: A foreign schema lease remains held for 750 milliseconds before the startup webhook-completion read.

  • Before: Startup can fail immediately with an admission-pending error.
  • After: The read can wait for release within its shared five-second admission budget.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-consistent, but the supplied evidence does not yet establish after-fix runtime recovery.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Gateway startup can stop when a short-lived foreign schema lease overlaps its final startup read.
Reason: The maintainer-authored direction repairs a concrete startup failure without adding configuration, changing persisted formats, or weakening genuine maintenance refusal.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a concrete startup failure, and source review found no definite introduced production defect.

Priority: P1
Reviewed head: 140206867e9493dccae364fa44a120a9a31aac51

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Still needed: valid-fixture baseline-red/head-green results, real worker settlement under contention and cancellation, and a Node 26 packaged upgrade from v2026.11.2 preserving settings and data.
Agent review details

How this fits together

Gateway startup and other shared-state consumers submit reads through an asynchronous owner that retains database custody, dispatches worker requests, and joins cleanup before returning results.

flowchart TD
  A[Gateway startup or state consumer] --> B[Shared read operation]
  B --> C[Bounded admission acquisition]
  C --> D[Native source borrowing]
  C --> E[Queued worker dispatch]
  D --> E
  E --> F[Read result and cleanup]
Loading

Technical review

Best possible solution:

Retain bounded acquisition in the existing shared-read owner and forward-port the verified repair while preserving main's newer read paths.

Do we have a high-confidence way to reproduce the issue?

Source shows immediate admission refusal on the reported startup path, and the added integration scenario holds a real foreign schema lease before webhook completion; no reproduction was executed during this read-only review.

Is this the best way to solve the issue?

The patch uses the existing retry helper and read owner, updates all discovered authority callers, and avoids replaying queries or cleanup; simplification review found no unnecessary production machinery or duplicate regression group.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 795a03fe2429.

Provenance checked

  • Shared asynchronous read ownership keeps the original intent (997e2bf: Consolidate query and cleanup settlement under one asynchronous owner while preserving live admission and cancellation.)
  • Queued physical-source validation keeps the original intent (9cea70f: Reject a replaced store at actual dispatch after queue admission.)
  • Offline Gateway lease inspection keeps the original intent (7c2aa57: Use existing physical custody for direct worker inspection without copying the database or admitting live and unverifiable owners.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

PR surface

Source +48, Tests +146, Other +10. Total +204 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 69 21 +48
Tests 5 184 38 +146
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 11 1 +10
Total 11 264 60 +204

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P1: Transient schema contention can abort Gateway startup after an upgrade.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: Transient schema contention can abort Gateway startup after an upgrade.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the recorded contention, settlement, and packaged-upgrade scenarios with inspectable, redacted results.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 8, 2026, 3:51 PM ET / 20:51 UTC.

@RomneyDa
RomneyDa merged commit 1d58dfd into release/2026.11.5 Nov 8, 2026
324 of 331 checks passed
@RomneyDa
RomneyDa deleted the openclaw/beta2-read-admission-repair branch November 8, 2026 21:26
RomneyDa added a commit that referenced this pull request Nov 12, 2026
Adapt upstream source 625945b to the beta3 runtime owners. Keep synchronous SDK compatibility while deferring tool, model, plugin, process and state-handler initialization.

Integrate on 67cc5d9, preserving #195398, #196301, #196386, #196387, #189991 and #196448. Three automatically merged overlaps retain canonical assertion/mock baseline removals and worker-turn input gating; no new behavioral adaptation.

Original source reviews and focused build/test evidence are retained. Fresh integration-only independent review found no actionable issues.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
* test: reproduce foreign schema lease before startup completion

Exercise the real webhook completion read after native bootstrap on the frozen beta source. Hosted baseline proof is pending; no local test execution.

Co-authored-by: RomneyDa <[email protected]>

* fix: wait for transient state admission before async reads

Reuse the existing bounded acquisition owner for native borrowing and final queued dispatch. Preserve true maintenance refusal, cancellation, identity checks, FIFO ownership, and one execution of the read and cleanup. Independent review found no production defect; corrected its queued cancellation expectation. Hosted proof pending; no local tests run.

Co-authored-by: RomneyDa <[email protected]>

* fix: preserve offline custody read admission

Complete the read authority contract for the offline Gateway owner inspection. Recheck its existing custody without adding ordinary-read retries.

Co-authored-by: RomneyDa <[email protected]>

* fix(state): complete read authority callers

Update the synthetic worker benchmark for mandatory acquisition and format the startup regression.

Co-authored-by: RomneyDa <[email protected]>

* test(state): update embedded read authority fixture

Keep generated non-isolated lifecycle fixtures compatible with required acquisition. Net test/support growth is 142 lines.

Co-authored-by: RomneyDa <[email protected]>

* test(state): use valid persisted admission owner payloads

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 1d58dfd)

Release adaptation: Retain the baseline prepared state-access owner and asynchronous file identity checks from #197510. The bounded acquisition owner also awaits asynchronous preparation and identity checking; it retries only unentered admission, never the query. FIFO turn discovery checks cancellation and captured path identity; final dispatch retains schema admission and file identity checks inside the same bounded acquisition, with turn release on failure. Retain the baseline benchmark readonly path. Focused proof pending.

(cherry picked from commit 9bbd55f7d1ed998e5590128d9d6c71b71489b6bc)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Bracket the untraced startup read with the existing measurement owner to localize packaged startup schema contention. Keep all admission, timeout, retry, and error behavior unchanged; runtime proof remains pending.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 1fbf64f)

Release adaptation: Required measurement prerequisite for the #195398 and webhook-evidence regression matrix. Original lane run reached neither injected webhook boundary, so retain the source measurement wrapper rather than weaken assertions. Create the routed synthetic state root with private mode 0700 so a group-writable host umask cannot invalidate the fixture. No host permissions or production temp safeguards changed.

(cherry picked from commit 60e50428a3e7c6a52a2c0e27be6132d3c243618a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant