Skip to content

fix(update): profile-linked chat /update fails post-install Doctor with authority-check-failed - #188472

Merged
steipete merged 1 commit into
mainfrom
codex/issue-178291
Oct 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/issue-178291

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #178291

What Problem This Solves

Fixes: a chat /update from an owner linked through a user profile fails in the post-install Doctor with authority-check-failed. The new version is installed and serving, but the run is recorded as failed and rollback is refused.

User Impact

User impact: owners linked through a user profile can update from chat across a state migration, and the run completes and verifies like a terminal or configured-owner update. Revoked or unauthorized requesters still fail the check.

Why This Change Was Made

The post-install Doctor re-checks the chat requester before every effect. For a profile-linked requester, that check reads profile rows from shared state. Doctor runs some of those checks while it holds sqlite-maintenance ownership but sits outside a maintenance scope, for example on child-process custody (reserve and spawn) and in post-repair work. The state guard then refuses the read with "this process holds maintenance ownership without an active schema lease or maintenance scope". Configured owners (commands.ownerAllowFrom) only read config, so they never hit this.

Doctor now wraps the delegated write authority once (createDoctorWriteAuthority). Its maintenance state lends the held owner to that authority. Every delegated check then runs under the owner and its open scope, the same way Doctor's own policy reads already do (owner.assertCurrent(policy)). A check that is already nested inside an owner check runs directly under that check's storage lease. Each check still reads current policy, so this changes only the storage custody the read runs under, not what the requester is allowed to do.

doctor-health.ts was already over its 700-line lint budget on main (701). To make room for the wiring, the deferred-maintenance ledger warning moves next to its sibling refusal recorder in doctor-update-refusal.ts; its behavior is unchanged.

Production LOC: +81 / −30 (includes the moved warning helper). Tests: +7.

Evidence

Before and after on Crabbox. Direct AWS lease cbx_c753f252602c, now stopped:

  • Published [email protected] was installed globally with a systemd user Gateway and a local registry.
  • An admin user profile was linked to slack/primary/owner, and gateway.roles was configured.
  • A chat-style update.run with requester: {channel: "slack", accountId: "primary", senderId: "owner"} was sent. The baseline admitted it as profile:<id>.
  • Both candidates were built from the same base, 2f4373bd1f8. The red candidate has the fix reverted.
Candidate Result
red (unfixed main) The post-install Doctor recorded authority-check-failed: Internal state ownership error … holds maintenance ownership without an active schema lease or maintenance scope 12 times. The run was recorded as failed. 2026.10.96 was left serving with "Rollback not attempted: Databases changed after snapshot capture". This is the reporter's symptom.
green (this PR) No authority failures. Phases ran requested → staging → validating → activating → restarting → verifying. Run status: succeeded. Verification recorded: Gateway booted, service running 2026.10.97, version verified, channels, HTTP and core ready.

Regression test. doctor-maintenance.requester-authority.test.ts now checks two things while Doctor holds maintenance ownership outside its scope:

  • the lent check passes for a profile-linked requester;
  • the same check still throws UpdateRequesterRevokedError after the identity is unlinked.

The profile case fails with the lending removed and passes with it. The configured-owner case passes both ways.

Local checks.

  • 54 of the 55 Doctor maintenance, Doctor health, refusal, process-custody and requester-authority test files passed (516 tests).
  • src/flows/doctor-health-startup.signal.test.ts fails 3/3 with ERR_MODULE_NOT_FOUND in its subprocess harness. It fails identically with the base sources restored, so the failure is pre-existing and unrelated.
  • tsgo:core passed; oxfmt and oxlint are clean on the touched files.
  • check:changed reports pre-existing dead exports on main (tts, session-html-preview and others) that this PR does not touch.

Review.

  • $autoreview (Codex): scoped-clean.
  • Independent codex exec read-only review of the exact head: no findings.

Gaps.

  • Not released yet.
  • An installed updater older than this fix still runs its own post-install Doctor, so the first hop from an affected version can still fail this way. Starting that one update from a terminal (openclaw update) avoids it, because a CLI update carries no chat requester.

…ance owner

A profile-linked chat /update failed post-install Doctor with
authority-check-failed: the delegated requester check reads profile rows
from shared state, and child-process custody and post-repair work ran it
while Doctor held sqlite-maintenance ownership outside a maintenance scope.

Doctor now wraps the delegated write authority once; its maintenance state
lends the held owner (and open scope) to every such check, as Doctor's own
policy reads already do. Each check still reads current policy, so revoked
or unauthorized requesters still fail.

Also moves the deferred-maintenance ledger warning next to its refusal
recorder to keep doctor-health under its line budget.

Fixes #178291
@clawsweeper

clawsweeper Bot commented Oct 30, 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 30, 2026 15:32
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Oct 30, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-30T15:34:27.292069Z cda0d6a 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.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

The update-reliability loop had a parallel investigation of #178291 in progress. This PR owns the same root cause, so I have stopped our duplicate implementation and switched that worker to independent review/verification of this PR. No second fix PR will be opened. I’ll share any distinct regression or actionable finding here rather than edit your active branch.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Independent read-only verification of cda0d6a9df84: a fresh isolated Codex autoreview of the full commit and frozen owner/caller context is scoped-clean at P0–P2. Acquisition/transfer/release lending, exact-database nested leases, and the existing reserve/spawn live requester rechecks remain intact.

The raw parent is 2f4373bd1f84, matching the base named in the published-10.9 RED/GREEN evidence. Those upgrade results are author evidence; this review executed no contributor code or new upgrade. Exact-head CI is still in progress. No actionable findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets delegated requester checks borrow Doctor's existing maintenance custody while continuing to check current authorization.

Example: A profile-linked slack/primary/owner requester updates an installation running 2026.10.9 across a state migration.

  • Before: Post-install Doctor reports authority-check-failed and records a failed update despite the new Gateway serving.
  • After: The reported green upgrade completes Doctor and verification with status succeeded.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-verified repair with reported managed-upgrade proof and useful revocation coverage; no actionable finding was identified.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The body supplies author-reported live upgrade results through update.run on a published-2026.10.9 systemd installation: the matched red candidate fails Doctor, while green completes verification and records succeeded; the existing production-owner regression additionally checks unlink revocation and refused config publication.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An owner starts an update from chat, the new Gateway serves, but Doctor fails and leaves the update needing terminal recovery.
Reason: The maintainer-authored direction addresses corroborated released failures without new settings, persisted formats, or permission changes.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a current Doctor ownership failure without an identified correctness defect; the reviewed head's CI remains pending.

Priority: P0
Reviewed head: cda0d6a9df846a60eed7ce190815ff1eb229c3ab

Before merge

None.

Findings

None.

Agent review details

How this fits together

Chat updates delegate requester authority to Doctor; Doctor acquires database maintenance custody and uses that authority before repair effects, config publication, and child-process operations.

flowchart TD
  A[Chat update requester] --> B[Delegated live authority]
  B --> C[Doctor custody adapter]
  D[Held maintenance owner] --> C
  C --> E[Current requester policy]
  E --> F[Config and process effects]
Loading

Technical review

Best possible solution:

Use Doctor's held owner for delegated policy reads while preserving fresh requester checks, maintenance exclusion, and existing rollback safeguards.

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

Current source exposes the unscoped profile-policy read, and the author reports a matched published-release red/green upgrade; this review executed no target code.

Is this the best way to solve the issue?

The focused adapter repairs the storage-custody boundary using existing owners, retains live policy evaluation, and extends the existing regression without duplicate machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1d6f75fd7450.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned change and current-main behavior: The introduced diff adds custody lending at owner acquisition and clears it at release; fetched main retains the original unwrapped delegated checks. (src/commands/doctor-maintenance-state.ts:51, cda0d6a9df84)
  • Live owner and nested lease checks: The existing owner checks physical custody before and after policy execution; nested lending checks an active lease for the selected database rather than suppressing requester policy. (src/infra/gateway-lock.ts:576, cda0d6a9df84)
  • Revocation regression: The extended existing regression checks successful out-of-scope lending, rejection after profile unlinking, and preservation of config bytes when revoked authority attempts publication. (src/commands/doctor-maintenance.requester-authority.test.ts:194, cda0d6a9df84)
  • Reported published-release upgrade proof: The PR body records matched red/green candidates from the pinned parent on a 2026.10.9 systemd installation: the red update reproduces the refusal, while green reaches succeeded with version and readiness verification; it explicitly documents the older-installed-updater first-hop limitation. (cda0d6a9df84)
  • Corroborating reports and ownership: [Bug]: 2026.10.4→10.5 chat update fails post-activation Doctor on offline-maintenance authority #178291 contains reports from DanKIT-DK, Farzy, and reldubnix; Farzy's released-source trace and steipete's profile-linked diagnosis support this repair, while roboclaw-bot explicitly stopped its duplicate implementation.
  • Exact-head checks: GitHub reports mergeable true and a pending openclaw/ci-gate; PostgreSQL conformance checks were still running, with no diff-caused check failure established. (cda0d6a9df84)

PR surface

Source +51, Tests +7. Total +58 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 81 30 +51
Tests 1 7 0 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 88 30 +58

Review metrics

Metric Value Why it matters
Production versus test LOC Production +81/-30; tests +7 Growth supplies the shared custody adapter and lifecycle wiring; part is an unchanged warning helper moved to satisfy the existing flow-file budget.

Labels

Label changes:

  • add P0: The specified update UX override applies: affected community chat updates require terminal repair to finish Doctor and plugin convergence.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P0: The specified update UX override applies: affected community chat updates require terminal repair to finish Doctor and plugin convergence.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 30, 2026, 11:50 AM ET / 15:50 UTC.

@steipete
steipete merged commit ec05ff5 into main Oct 30, 2026
215 of 218 checks passed
@steipete
steipete deleted the codex/issue-178291 branch October 30, 2026 16:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Farzy added a commit to Farzy/self-config that referenced this pull request Oct 30, 2026
…195)

## Summary

This updates `docs/openclaw.md` §4.4 with the maintainers' answers on
[openclaw/openclaw#178291](openclaw/openclaw#178291),
which is now closed. It also **corrects** a claim that #192 and #193
made: an `openclaw_setup_version` bump does not hit the refusal.

## What upstream established (2026-10-30)

- **Mechanism:** for a chat `/update`, the post-install Doctor re-checks
that the **requester** may still update. That re-check reads profile
rows from the state DB outside Doctor's own maintenance scope, for
example around child processes Doctor starts, and gets refused. This
confirms the "Doctor refuses its own custody" trace I'd posted, and
names the caller.
- **Fix:**
[openclaw/openclaw#188472](openclaw/openclaw#188472)
(merge `ec05ff5d53a`) is on `main` but **not released**; it isn't in
2026.10.9 or 2026.10.10-beta.5.
- **After release:** the post-install Doctor runs from the newly
installed version, so a chat `/update` *to* a release that contains the
fix works, even from 10.9.
- **Until then:** an update started from a terminal has no chat
requester to re-check, so it avoids the failure.

## Changes in `docs/openclaw.md` §4.4

- **2026-10-28 entry:** the failure is now scoped to chat-requested
updates. The role path (`openclaw_setup_version` bump) runs the same
updater but from a terminal with no chat requester, so it avoids the
refusal according to the maintainer. It's noted as not yet exercised
here across a migration, and the assert/recovery note is kept for the
case where it fails anyway. This reverses "so it hits the same refusal".
- **2026-10-30 root cause:** adds the upstream-confirmed mechanism, the
requester re-check outside Doctor's maintenance scope.
- **New "Upstream status" paragraph:** the fix PR and merge, the release
status as of 2026-10-30, and that a chat `/update` to a fixed release
works. Until then: upgrade with a pin bump or `sudo openclaw-admin
update --tag <version> --yes`, and use the recovery sequence after a
failed chat update.
- **Open question:** the maintainer attributes the bug to profile-linked
requesters, but `claw`'s owners are `commands.ownerAllowFrom`-only (a
single `gateway-owner` profile with `roleSource: default` and nothing
linked) and still failed three times, like another reporter. I raised
this on #178291. The doc says to confirm with a chat `/update` to the
first stable release that contains #188472.

Docs only; nothing to apply. pre-commit passes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…ance owner (openclaw#188472)

A profile-linked chat /update failed post-install Doctor with
authority-check-failed: the delegated requester check reads profile rows
from shared state, and child-process custody and post-repair work ran it
while Doctor held sqlite-maintenance ownership outside a maintenance scope.

Doctor now wraps the delegated write authority once; its maintenance state
lends the held owner (and open scope) to every such check, as Doctor's own
policy reads already do. Each check still reads current policy, so revoked
or unauthorized requesters still fail.

Also moves the deferred-maintenance ledger warning next to its refusal
recorder to keep doctor-health under its line budget.

Fixes openclaw#178291

Co-authored-by: Peter Steinberger <[email protected]>
Farzy added a commit to Farzy/self-config that referenced this pull request Nov 1, 2026
## Summary

On openclaw/openclaw#178291 the maintainer reported a second route to
the post-install Doctor's `authority-check-failed`, separate from the
profile-linked one that openclaw/openclaw#188472 fixed. The requester
check loads the configured channel plugins and fails on any load error.
A plugin whose settings/state migration is still pending is held back
until Doctor runs that migration, so Doctor's own check failed before it
could run that migration.

This route matches claw:
- the owners are only in `commands.ownerAllowFrom`;
- the Signal plugin was left with its settings upgrade pending every
time;
- a terminal `update repair`, which has no chat requester, finished the
job.

It is fixed on main by openclaw/openclaw#190433 (merge `a5bcd9c8c8c`),
which isn't released yet.

## Changes (`docs/openclaw.md` §4.4)

- **Upstream status**, now dated 2026-11-01, lists both routes and both
fixes. A chat `/update` is only safe to a release that contains **both**
fixes. No config change is needed, since the maintainer confirms
`ownerAllowFrom` is the right setup.
- The root-cause bullet now says it describes the profile-linked route,
and that claw's own route is the second one.
- The open `ownerAllowFrom` question is answered. What's left to verify
is a chat `/update` to the first stable release with both fixes, with
the result reported on #178291.

- Earlier references in the section are aligned: the 2026-10-19 entry
now attributes that failure to the pending Signal plugin (per the
maintainer), and the "expect this every time" note waits for **both**
fixes.

Docs only, so nothing needs applying to claw.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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

Labels

commands Command implementations P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

[Bug]: 2026.10.4→10.5 chat update fails post-activation Doctor on offline-maintenance authority

2 participants