Skip to content

fix(state): retire startup metadata readers before gateway admission - #189722

Merged
RomneyDa merged 2 commits into
mainfrom
fix/startup-metadata-reader-retirement
Oct 31, 2026
Merged

RomneyDa merged 2 commits into
mainfrom
fix/startup-metadata-reader-retirement

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

  • declare startup metadata reads as an explicit retire-after-result process-lifecycle policy
  • retire the pooled SQLite reader before returning because its broker admission can retain host-side schema maintenance until native exit
  • prove the real broker-process boundary releases ownership before immediate Gateway admission

Release evidence

Fresh macOS packaged and installer checks for 2026.11.1-beta.1 both completed config health reads, retained the pooled reader process, then refused Gateway startup because that process still held the host-side sqlite-maintenance admission.

This does not alter SQL, schema, write behavior, or owner reclamation. It restores the existing ownership invariant at the transport boundary: a result is not returned while its process-scoped host admission remains live.

Validation

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run src/infra/sqlite-readonly-worker.operations.test.ts --maxWorkers=1 (10/10)
  • pre-fix falsification: the same real-broker regression fails because the returned reader PID remains alive; with this fix it is dead before Gateway acquisition
  • node scripts/run-format.mts --write src/infra/sqlite-readonly-worker.operations.test.ts
  • git diff --check

@clawsweeper

clawsweeper Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@RomneyDa RomneyDa added the release-fast-lane Release tooling PR: narrow ci-gate, ClawSweeper advisory (RELEASING.md) label Oct 31, 2026
@RomneyDa
RomneyDa force-pushed the fix/startup-metadata-reader-retirement branch from 793d087 to ba633a5 Compare October 31, 2026 19:58
@RomneyDa
RomneyDa force-pushed the fix/startup-metadata-reader-retirement branch from ba633a5 to 91f24fa Compare October 31, 2026 19:58
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 31, 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. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Retire startup metadata reader processes before returning their results so they cannot block Gateway admission.

Example: A packaged macOS 2026.11.1-beta.1 installation reads config health before starting its Gateway.

  • Before: The successful reader remains pooled and retains maintenance ownership, causing Gateway startup to be refused.
  • After: The reader exits before its result returns, allowing immediate Gateway ownership acquisition.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with a meaningful production-boundary regression; supplied validation stops short of post-fix packaged startup evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its strongest supplied validation exercises the real broker, native reader exit, and immediate Gateway lock acquisition, while packaged checks describe the original failure.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Gateway startup is refused after a successful startup metadata read because the reader process still retains maintenance custody.
Reason: The maintainer-authored direction repairs a concrete first-run failure without adding configuration, persisted state, or another lifecycle owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a concrete startup ownership failure with a focused lifecycle repair; no introduced defect was found.

Priority: P0
Reviewed head: 3dd99a580980c8ca2cb84e4b21420f155eecb087

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No post-fix packaged macOS or installer startup output is supplied beyond the reported real-broker regression.
Agent review details

How this fits together

Config-health and plugin-metadata reads enter the shared SQLite reader pool; isolated children return metadata, and Gateway startup subsequently acquires state ownership.

flowchart LR
  A[Startup metadata request] --> B[SQLite reader pool]
  B --> C[Broker reader process]
  C --> D[Read under maintenance custody]
  D --> E[Await native process exit]
  E --> F[Return metadata]
  F --> G[Gateway admission]
Loading

Technical review

Best possible solution:

Make startup recover automatically by awaiting native reader retirement in the existing pool before Gateway admission.

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

The sealed startup reader borrows maintenance custody while the existing pool retains its process after success; the PR reports a red-before/green-after real-broker regression, which was inspected but not executed during this read-only review.

Is this the best way to solve the issue?

The patch restores the ownership invariant at the existing pool boundary, reuses native-close settlement, and preserves SQL, admission checks, and unrelated worker reuse.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4ade7ee96f86.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 075dc2f adds src/infra/sqlite-readonly-worker-pool.ts:257 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 075dc2f67777; files: src/infra/sqlite-readonly-worker-pool.ts)

PR surface

Source +13, Tests +58. Total +71 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 14 1 +13
Tests 1 59 1 +58
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 73 2 +71

Labels

Label changes:

  • add P0: Reported fresh packaged macOS and installer runs cannot start the Gateway after config-health inspection, blocking first useful use without an in-product recovery path.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P0: Reported fresh packaged macOS and installer runs cannot start the Gateway after config-health inspection, blocking first useful use without an in-product recovery path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • 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.

  • For stronger release confidence, attach post-fix packaged macOS startup output showing config-health completion followed by successful Gateway admission.

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 October 31, 2026, 4:14 PM ET / 20:14 UTC.

@RomneyDa
RomneyDa merged commit a805746 into main Oct 31, 2026
137 checks passed
@RomneyDa

Copy link
Copy Markdown
Member Author

Merged via squash.

@RomneyDa
RomneyDa deleted the fix/startup-metadata-reader-retirement branch October 31, 2026 20:20
RomneyDa added a commit that referenced this pull request Oct 31, 2026
…189722)

* fix(state): retire startup metadata readers before gateway admission

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

* test(state): prove startup reader native retirement

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

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit a805746)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
…penclaw#189722)

* fix(state): retire startup metadata readers before gateway admission

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

* test(state): prove startup reader native retirement

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

---------

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. release-fast-lane Release tooling PR: narrow ci-gate, ClawSweeper advisory (RELEASING.md) size: S 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.

2 participants