Skip to content

fix(gateway): park the service on older agent database schemas - #194599

Merged
roboclaw-bot merged 2 commits into
mainfrom
roboclaw/ob-194580-schema-park
Nov 7, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
roboclaw/ob-194580-schema-park

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #194580

What Problem This Solves

A managed Gateway can repeatedly restart when an older agent database requires offline migration, including after a direct global npm replacement.

User Impact

The existing maintenance handler parks the macOS LaunchAgent and exits 78 with stop → openclaw doctor --fix → start guidance. Existing systemd and Windows supervisor handling treats that exit as terminal. Operators still need to perform the offline repair.

Direct all-agent session imports continue importing unrelated legacy history when another owned database needs schema repair. Newer-schema databases still stop the import without changing the other sources.

Why This Change Was Made

The older-agent-version refusal now raises the existing StartupMaintenanceRequiredError with kind state-migrations. Existing worker serialization and nested-error handling preserve this kind. Doctor's raw-entry inspection explicitly defers that same kind when schema-repair deferral is enabled. Current-schema admission and the existing startup warning remain unchanged; no transport or schema change is needed.

Evidence

  • Gateway routing: the frozen schema-25 fixture produces a real read-only admission refusal, round-trips through wrapped worker error serialization, and reaches parking once at both CLI startup boundaries without changing database bytes. Both cases failed on f4668bd0e161; 187 focused tests and broad CI passed at bc61f8197c45 before this Doctor follow-up.
  • Doctor import: the new all-agents regression fails at bc61f8197c45 because schema 25 aborts preparation. With the fix, the old database stays byte-identical while another agent's history is imported. The newer-schema control already passed on that base and still refuses import with legacy sources unchanged.
  • doctor-session-sqlite.targets.test.ts and doctor-session-entry-state.test.ts: 31 tests passed, 77.95 seconds including cold worker preparation. Summed case time: targets 14.97 seconds, entry-state 21.05 seconds; the two new cases total 4.65 seconds.
  • Touched-file lint, formatting, and git diff --check pass. Local touched-file typechecking stopped before compilation because the declaration owner rejects borrowed dependencies. Current-head CI passed on e756675ef42f: 47 successful jobs, 27 scope skips, 1,639 seconds wall time. Production/test types, baseline/test-line ratchets, lint, Node tests, artifact build/checks, and all PostgreSQL conformance shards passed. The CI, dependency, and security review contexts are green; no CI repair or rerun was needed.
  • Independent Codex autoreview of the complete Doctor follow-up against bc61f8197c45, P0–P2: scoped clean, no actionable findings. Local ClawSweeper is unavailable; the prior hosted review covers the earlier head only.
  • MISSING: native macOS KeepAlive/LaunchAgent and latest-stable transition proof; no macOS Crabbox box was granted. Mocked parking assertions establish routing, not native supervisor behavior.
  • Simplification: the follow-up adds three production lines and 51 test lines. Full PR growth is +5 production and +122 test lines. The PR's existing allocation is now 122, exactly its own regression growth; the shared scalar is unchanged.

Classify older agent persistence schemas as required state migrations so existing worker transport and startup handling park supervised services with offline Doctor guidance.
@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Nov 7, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 7, 2026
@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head bc61f8197c45c063f7e2c7283b6f3d58f62109a0, but the PR head is now e756675ef42faa3c57fdaedf3edbfb36e0e19a4d. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (1 earlier review cycle)
  • reviewed 2026-11-07T12:01:49.834Z sha bc61f81 :: needs maintainer review before merge. :: none

Recognize state-migrations refusals in raw session inspection so all-agent imports can continue with unrelated legacy targets. Keep newer-schema refusals terminal and cover both paths with frozen schema fixtures.
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Nov 7, 2026
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 7, 2026
@roboclaw-bot
roboclaw-bot merged commit 8bea0c1 into main Nov 7, 2026
155 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/ob-194580-schema-park branch November 7, 2026 13:37
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
…law#194599)

An agent database on an older schema is now reported as a required state migration, so the managed service is parked with the existing "run openclaw doctor --fix" guidance instead of restart-looping the Gateway. The session-SQLite import still defers such a target and processes the others (fixes openclaw#194580).

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…law#194599)

An agent database on an older schema is now reported as a required state migration, so the managed service is parked with the existing "run openclaw doctor --fix" guidance instead of restart-looping the Gateway. The session-SQLite import still defers such a target and processes the others (fixes openclaw#194580).

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>

(cherry picked from commit 8bea0c1)

Release adaptation: Classify only older canonical agent schemas as existing state-migrations maintenance; Doctor continues deferring matching targets. Keep newer schema refusal/media migration identity. No schema/version/data migration changes; retain focused Gateway parking, committed reader and Doctor regressions. Later cancellation-owner and unrelated Doctor repairs are not prerequisites.

Follow-up dispositions: 410c0dd refactor(infra): read SQLite cancellation from its scope owner (openclaw#200179); 8cd7d87 chore(ci): drop retired test-lines allocation records (1/3) (openclaw#197655); 0e966cc fix: avoid agent database stalls after worker retirement (openclaw#194484); ef47e2e fix(doctor): defer update session-entry inspection when snapshot space runs out (openclaw#196370); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685)

Validation: Source baseline old-schema error was generic SqliteSchemaMismatchError and did not trigger service maintenance parking. Matching existing maintenance codec and Doctor catch reviewed; exact regression group queued. diff check passed.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit f61a73edfda73dc6452f3e0e534cb9e891c05ae6)
(cherry picked from commit 4e8445923f2522eb6b42ab705e15624a1a674a39)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations P1 High-priority user-facing bug, regression, or broken workflow. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 2026.11.1 gateway restart loop with agent DB schema 25; offline repair required (macOS)

1 participant