Skip to content

fix(state): register placement move target_machine_class as additive column - #125583

Merged
obviyus merged 1 commit into
mainfrom
fix/placement-moves-target-machine-class-additive
Aug 18, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/placement-moves-target-machine-class-additive

Conversation

@obviyus

@obviyus obviyus commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • worker_session_placement_moves.target_machine_class was added to the canonical state schema (and to the feature's lazy ensureColumn path) but not to CLAW_LAZY_ADDITIVE_STATE_COLUMN_DEFINITIONS. A global state database that already contains the lazily-created worker_session_placement_moves table (created before the column shipped) therefore fails the strict startup schema check with SQLite schema is incomplete or noncanonical … column definitions differ for worker_session_placement_moves → Failed migrating shared state database schema → the gateway refuses ready and crash-loops. Databases without the table are unaffected.
  • Registers the column as lazy-additive so startup repair adds it in place, matching the sibling worker_session_placements / worker_environments entries. Behavior otherwise unchanged; the optional table may still be absent.

Field report

Observed 2026-08-18 on a source-built gateway at c75d4dc9 after updating from 863f19b7: state DB had the pre-column table (worker environments had been used); six consecutive startup refusals until the column was added manually with the gateway stopped. Three sibling deployments whose state DBs lacked the table booted cleanly on the same commit.

Proof

git diff --check, format:check, oxlint, tsgo, check:test-types; focused vitest src/state/openclaw-state-db.test.ts + src/state/openclaw-database-maintenance.test.ts (170 tests) pass. The new regression test (repairs target machine class in a pre-column placement move table) fails without the registry entry and passes with it.

Review

ClawSweeper local review (gpt-5.6-terra, high) on 915b2acf: overallCorrectness: "patch is correct", reviewFindings: [], security no concerns, no maintainer decision. Its only next step ("refresh the branch and wait for exact-head CI") is a freshness move; per our drift policy the branch is only rebased when CONFLICTING, and merge waits on exact-head openclaw/ci-gate. Two runs of the review harness ended with an "invalid structured output" classification while the underlying decision JSON was complete — tooling, not a code issue.

…column

Databases that created worker_session_placement_moves before target_machine_class reached startup with the table but without the column. Strict shared-state repair rejected that shape, so the gateway crash-looped before feature-owned first use could add it.

Register the bare nullable column in the lazy-additive registry. The table remains optional, but the column derives into startup repair so an existing table gains it before canonical validation.
@clawsweeper

clawsweeper Bot commented Aug 18, 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 size: XS maintainer Maintainer-authored PR labels Aug 18, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 12:28 AM ET / 04:28 UTC.

ClawSweeper review

What this changes

The PR registers worker_session_placement_moves.target_machine_class as a startup-repaired additive column and adds upgrade regression coverage for an existing older table.

Regression provenance

Possible regression — probable (failure trace; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: the patch correctly moves the missing nullable column into the shared startup-repair registry, so an existing placement-move table can be repaired before strict schema validation blocks Gateway readiness. No blocking correctness finding.

Priority: P1
Reviewed head: 915b2acfc60eac94b64ec57e24bc6f52b2cea42d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary fix with credible regression coverage; only normal exact-head CI and mergeability completion remain.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository context identifies this as a maintainer-authored PR, so the external-contributor real-behavior-proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository context identifies this as a maintainer-authored PR, so the external-contributor real-behavior-proof gate does not apply.
Evidence reviewed 6 items Current-main defect: Current main declares the nullable column in canonical SQL and feature-local first-use repair, but its central lazy-additive registry does not list it; therefore maintenance validation cannot recognize an already-created older table as repairable.
Startup owner boundary: Startup preflight invokes repair on noncanonical current-version databases, and repair calls ensureAdditiveStateColumns before canonical validation; that shared registry is the correct producer for this repair.
Patch matches registry contract: The new entry is a bare nullable TEXT column, which is the registry contract used by startup repair and maintenance compatibility.
Findings None None.
Security None None.

How this fits together

The shared state SQLite database is repaired and validated before the Gateway becomes ready. The additive-column registry both permits recognized older shapes and drives in-place startup repair of existing tables.

flowchart LR
  A[Existing state database] --> B[Startup repair preflight]
  B --> C[Additive column registry]
  C --> D[In-place column repair]
  D --> E[Canonical schema validation]
  E --> F[Gateway readiness]
Loading

Before merge

  • Resolve merge risk (P1) - This changes startup behavior for existing same-version state databases that already contain the optional placement-move table; the nullable repair is source-backed, but exact-head CI and GitHub’s final mergeability refresh are still pending.
  • Complete next step (P2) - No repair-lane action is needed: the submitted patch is the focused fix, pending normal exact-head validation.
Agent review details

Security

None.

PR surface

Source +5, Tests +33. Total +38 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 0 +5
Tests 2 33 0 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 38 0 +38

Review metrics

Metric Value Why it matters
Production versus test delta production +5, tests +33 The production change is one registry entry controlling startup repair and compatibility acceptance; the added tests cover the older-table upgrade boundary.
Persisted-state upgrade surface 1 nullable TEXT column registered for startup repair The change deliberately mutates an existing same-version database during startup when that optional table already exists.

Stored data model

Persistent data-model change detected: database schema: src/state/openclaw-state-db.test.ts, serialized state: src/state/openclaw-state-db.test.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Complete exact-head upgrade validation (recommended)
    Retain the registry repair and merge after the exact PR head has green required checks and a clean mergeability refresh.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Require green exact-head CI and a clean GitHub mergeability recheck.

Technical review

Best possible solution:

Keep the shared lazy-additive registry as the single startup repair owner for this bare nullable column, preserving the optional-table behavior while repairing older existing tables before validation.

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

Yes — the added regression scenario constructs a current-version database with the pre-column placement-move table, then exercises startup repair; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes — the registry is the common source for both maintenance compatibility and startup column repair, while the feature-local ensure is reached too late after strict startup validation fails.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9de3ca5fc93d.

Labels

Label changes:

  • add P1: Affected source-built Gateways can refuse readiness repeatedly when an older placement-move table is present.
  • add merge-risk: 🚨 compatibility: The PR changes how existing persisted state is accepted and upgraded during Gateway startup.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository context identifies this as a maintainer-authored PR, so the external-contributor real-behavior-proof gate does not apply.

Label justifications:

  • P1: Affected source-built Gateways can refuse readiness repeatedly when an older placement-move table is present.
  • merge-risk: 🚨 compatibility: The PR changes how existing persisted state is accepted and upgraded during Gateway startup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository context identifies this as a maintainer-authored PR, so the external-contributor real-behavior-proof gate does not apply.

Evidence

What I checked:

  • Current-main defect: Current main declares the nullable column in canonical SQL and feature-local first-use repair, but its central lazy-additive registry does not list it; therefore maintenance validation cannot recognize an already-created older table as repairable. (src/state/openclaw-state-schema.sql:2273, 9de3ca5fc93d)
  • Startup owner boundary: Startup preflight invokes repair on noncanonical current-version databases, and repair calls ensureAdditiveStateColumns before canonical validation; that shared registry is the correct producer for this repair. (src/state/openclaw-state-db.ts:327, 9de3ca5fc93d)
  • Patch matches registry contract: The new entry is a bare nullable TEXT column, which is the registry contract used by startup repair and maintenance compatibility. (src/state/openclaw-state-db-additive-columns.ts:26, 915b2acfc60e)
  • Regression coverage reaches the affected boundary: The new test recreates the optional placement-move table without the column, runs startup repair, then verifies the repaired table contains it; the existing feature test only reaches repair after the feature-local path is invoked. (src/state/openclaw-state-db.test.ts:4447, 915b2acfc60e)
  • Feature provenance: Blame attributes the canonical column and the feature-local ensureColumn call on current main to the same feature commit, establishing why an omission from the shared registry can strand pre-column tables at startup. (src/gateway/worker-environments/placement-move-intent.ts:75, 49cdd5425929)
  • Release boundary: The latest stable tag is v2026.7.1-2 at 0790d9f; the placement-move feature commit is later on current main, so this is a current-main/source-build upgrade path rather than a defect proven in that stable release. (src/state/openclaw-state-schema.sql:2273, 49cdd5425929)

Likely related people:

  • Peter Steinberger: Current-main blame attributes both the canonical placement-move column and its feature-local in-place repair to the same feature commit. (role: feature introducer and recent area contributor; confidence: high; commits: 49cdd5425929; files: src/state/openclaw-state-schema.sql, src/gateway/worker-environments/placement-move-intent.ts, src/state/openclaw-state-db-additive-columns.ts)

Rank-up moves

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

  • Let required checks complete on the exact head, then refresh mergeability before merging.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@obviyus
obviyus merged commit c198f8a into main Aug 18, 2026
227 checks passed
@obviyus
obviyus deleted the fix/placement-moves-target-machine-class-additive branch August 18, 2026 04:30
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
…column (openclaw#125583)

worker_session_placement_moves.target_machine_class was in the canonical state schema and the feature lazy ensureColumn path but not in CLAW_LAZY_ADDITIVE_STATE_COLUMN_DEFINITIONS, so a global state DB that already had the lazily-created table failed the strict startup schema check (column definitions differ) and the gateway crash-looped. Register it as lazy-additive so startup repair adds the column in place, like the sibling worker_session_placements entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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