Skip to content

fix(updates): keep state inspection on the selected profile - #184384

Merged
steipete merged 1 commit into
mainfrom
codex/update-inspection-profile-root
Oct 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/update-inspection-profile-root

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes updates failing on a selected profile because inspection accidentally reads a different profile's newer database schema.

User Impact

Update inspection and snapshots use the selected installation's state directory even when an older updater omits that field from its restricted environment payload. No configuration or database schema changes are required. An old updater that runs its own inspection worker still needs an updated runtime; the candidate-side repair applies when it delegates to the new worker.

Why This Change Was Made

The worker already receives an authoritative stateDir, but plugin metadata discovery also resolves machine state through the supplied environment. Bind that existing environment field once at worker ingress, preserving the restricted payload and leaving physical-path-only requests unchanged. This covers both inspection and snapshot senders without adding separate sender workarounds.

The regression also exposed an incomplete existing WAL test fixture: its machine-state table omitted updated_at_ms. Complete that fixture rather than weakening its assertions. Production delta: +5 lines, including the ownership comment.

Evidence

A real subprocess regression with a healthy selected database and an incompatible default-profile database failed before the fix with the wrong-profile schema error and passes afterward. The snapshot row also supplies a contradictory environment root and verifies that explicit stateDir wins; unrelated database bytes remain unchanged.

  • Schema inspection suite: 11 passed.
  • Legacy/local schema and snapshot plugin siblings: 6 passed.
  • Core and infrastructure test typechecks, targeted lint, formatting, and diff checks passed.
  • Independent canonical autoreview: no actionable findings through P2.

Proof uses synthetic databases through the actual inspection/snapshot subprocesses; it does not claim a full published-package upgrade run.

@clawsweeper

clawsweeper Bot commented Oct 26, 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.

@steipete
steipete marked this pull request as ready for review October 26, 2026 08:11
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS labels Oct 26, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T09:14:03.067547Z cababab Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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. P2 Normal backlog priority with limited blast radius. 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Bind update workers’ metadata discovery to the explicitly selected state directory.

Example: The selected profile has schema 7 while the default profile has incompatible schema 999.

  • Before: Metadata discovery can read the default profile and fail the selected profile’s update.
  • After: Inspection and snapshots use the selected profile and report schema 7.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source review found no defect, but required upgrade behavior remains unproven.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Updating one installation can fail because metadata discovery reads another profile’s incompatible database.
Reason: The maintainer-authored direction restores consistent profile selection using the existing worker contract.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a source-verifiable profile-selection bug with a focused change, and current main still lacks the repair. No introduced correctness defect was found.

Priority: P2
Reviewed head: cababab3c8a82eeba2f32444200408fae17de5fb

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The required latest-stable updater-to-candidate run with a selected profile, incompatible default profile, and preserved settings/data is not supplied.
Agent review details

How this fits together

The updater sends state-directory, configuration, and restricted environment inputs to an isolated worker, which discovers databases and plugins and returns inspection or snapshot results.

flowchart TD
  A[Installed updater] --> B[Selected state directory]
  B --> C[State worker ingress]
  C --> D[Profile-bound environment]
  D --> E[Plugin metadata discovery]
  E --> F[Database inspection or snapshot]
  F --> G[Updater result]
Loading

Technical review

Best possible solution:

Keep the single worker-ingress binding so every affected worker operation uses the selected installation’s existing state owner.

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

Source shows the restricted sender dropping the profile environment field before metadata discovery resolves machine state; the PR reports red/green subprocess regressions, which this read-only review did not execute.

Is this the best way to solve the issue?

Yes: normalizing the existing environment at the shared worker boundary fixes both senders without duplicate workarounds, new configuration, or another state owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2499f2be3e88.

Provenance checked

  • Worker isolation and runtime-retention separation keeps the original intent (ea19d90: Runtime retention uses a bounded subprocess without loading the database inspection graph.)
  • WAL schema-inspection fixture keeps the original intent (c6180db: Inspect WAL-visible agent schema versions without copying large agent payloads while retaining shared content-version discovery.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ea19d90 adds src/infra/update-candidate-state.worker.ts:46 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ea19d90e4f76; files: src/infra/update-candidate-state.worker.ts)
  • Josh Lehman: Raw commit c6180db adds src/infra/update-candidate-state.schema.test.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c6180dbb7309; files: src/infra/update-candidate-state.schema.test.ts)

PR surface

Source +5, Tests +34, Docs +6. Total +45 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 5 0 +5
Tests 1 37 3 +34
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 48 3 +45

Labels

Label changes:

  • add P2: A different profile’s database can block an otherwise valid update; the affected multi-profile workflow has a focused repair.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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:

  • P2: A different profile’s database can block an otherwise valid update; the affected multi-profile workflow has a focused repair.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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.

  • Provide the published-updater-to-candidate evidence described in the proof assessment.

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 26, 2026, 4:28 AM ET / 08:28 UTC.

@steipete
steipete merged commit dc07bb8 into main Oct 26, 2026
200 of 201 checks passed
@steipete
steipete deleted the codex/update-inspection-profile-root branch October 26, 2026 08:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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