Skip to content

fix(update): preserve typed channel owners during plugin migration - #205666

Merged
RomneyDa merged 5 commits into
mainfrom
openclaw/chat-update-auth
Nov 26, 2026
Merged

RomneyDa merged 5 commits into
mainfrom
openclaw/chat-update-auth

Conversation

@tideclaw-bot

@tideclaw-bot tideclaw-bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Refs #205162. During a delegated chat update, Doctor holds back a channel plugin whose state migration is pending, so that channel's formatter is unavailable when the updater rechecks a configured <channel>:user:<id> owner. The typed target is then dropped and the update falsely reports requester revocation. Discord is the reported case; Mattermost, Slack and Teams use the same user-prefixed target style.

Fix and impact

The delegated requester check records which channels the registry deferred for a pending state migration. For those channels only, and only when the channel formatter is absent, the owner matcher accepts the exact user ID from a typed <channel>:user:<id> entry. The ID must still equal the sender exactly; an owner removed from the current configuration is still denied (proven end to end below). Loaded formatters and all other channels are unchanged. Without the plugin, the target style is unknown, so the typed form is accepted for any deferred channel; this edge is noted in the code. No schema or migration changes.

Upgrading from 2026.11.10

The fix runs in the newly installed version. The installed 2026.11.10 updater checks the owner first and may refuse a chat /update before it installs anything (owner_required while the migration record is pending). When that happens the Gateway keeps serving the current version. Workaround: run openclaw doctor --fix, then retry the update.

Verification

All proof below is end to end on exact head 5358cc1ab827, the second main merge. In that merge, #205772 moved resolveOwnerAllowFromList and isConfiguredCommandOwner to src/auto-reply/command-owner-facts.ts, and this PR's change was ported there. Setup: private rootless Podman, systemd user unit, --http-proxy=false, --network none, offline npm. The installed candidate's build-info.json records commit 5358cc1ab827a13ec4a22b2611eaa7c4197acf5b, build 2026.11.10-5358cc1ab827-2026-11-26T07-35-54.980Z, relabeled 2026.11.11. The build source tree is git archive of that commit. Each cell sends a chat-requester update.run. Combined with #205669 on release/2026.11.11, both regressions insert at the same place in the shared test file; keep both when resolving.

Cell Base Fixture Result
1a published 2026.11.10 + published Discord plugin Owner discord:user:…001; Discord command-deploy-cache.json pending migration Pass. succeeded in 7 min 56 s. The candidate served on a new boot and passed /healthz, /readyz and authenticated health. Doctor removed the cache artifact. The installed owner check accepted the sender and denied another ID
1b published 2026.11.8 + published Discord plugin Same as 1a Pass. succeeded in 9 min 38 s, with the same checks passing
3a published 2026.11.10, Discord When the candidate spawned update-migrated-finalize.worker.js --doctor, a watcher changed the owner to discord:user:…002. The cache artifact was still present, so Discord was withheld with no formatter: the deferred path Refused. The candidate Doctor refused config promotion (configWriteRefusal.reason: requester-revoked), and the run's first failure was requester-revoked, about 12 s after revocation. Afterward, the revoked sender was not an owner and the new owner was
3b published 2026.11.8, Telegram At the same point, the owner changed from telegram:1001 to telegram:1002, with the retired workshop key still pending Refused at activating with requester-revoked, about 7 s after revocation

Pre-existing behavior, not changed by this PR: after the 3a and 3b refusals, the published driver left recovery pending. For Discord it reports "automatic restart and repair were not attempted"; for Telegram, package publication recovery is pending. In both cases the Gateway unit stayed inactive until openclaw update repair runs. This PR does not touch restart or recovery code. This will be reported separately. Cell 2 is not rerun here; it is a known #205669 regression handled there.

Covered only by unit tests: the Mattermost/Slack/Teams variants of the deferred typed-owner match.

Error surfaces

I audited the full diff against the merged main parent f031630c3e41. It touches src/auto-reply/command-owner-facts.ts, src/infra/update-requester-authority.ts and its test. The PR adds no throw, refusal, exit, rollback trigger, or tightened validation. Only captureManagedUpdateRequester's configured-owner isCurrent passes migrationDeferredChannels. With the list omitted or empty, every other caller behaves as on main. These are captureCommandOwnerIdentity and prepareCommandOwnerAuthority (isCurrent), operator-admission's isChannelOwner, approval-channel-custody, update-run-notice-target and the Doctor cron check. resolveConfiguredCommandOwners is unchanged. Its callers therefore see the same owner list, including command-auth's explicitOwners → readCommandSenderAdmission from #205772 and attempt-tool-context. The context OwnerAllowFrom path in command-auth passes no list.

Changed path Can fire for a healthy user? Rollback/outage risk Decision
resolveOwnerAllowFromList: typed <channel>:user:<id> yields <id> when the plugin is absent and the channel is migration-deferred No. It only widens matching, and the ID must equal the sender Reduces it: removes a false requester-revoked Kept (the fix)
Restructured skip guard (!providerId or channel !== providerId → channel !== providerId) No. Equivalent, because channel is always a non-empty string at that point, and with no list the typed branch still skips None Kept
isConfiguredCommandOwner builds its owner list directly instead of calling resolveConfiguredCommandOwners No. It uses the same inputs, drops only the Set dedup (the list is used only for includes), and reads the loaded plugin once instead of twice None Kept
Collect migrationDeferredChannels in the existing pending-migration catch No. It reads only required typed fields (registry.plugins, status, channelIds) on a branch that already tolerated the error None Kept
Optional options argument on isConfiguredCommandOwner No. It defaults to {}, so other callers are unchanged None Kept

Worked on by

tideclaw-bot and others added 2 commits November 26, 2026 01:10
Worked on by:
- @RomneyDa

Co-authored-by: RomneyDa <[email protected]>
OpenClaw-Publication: a3a077a6-6af8-4854-a490-4ae036753b01
@clawsweeper

clawsweeper Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@tideclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. 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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 26, 2026
@tideclaw-bot
tideclaw-bot marked this pull request as ready for review November 26, 2026 01:24
@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves configured typed channel owners while Doctor temporarily defers their channel plugins for migration.

Example: Discord sender 100000000000000001 updates with ownerAllowFrom containing discord:user:100000000000000001 while Discord migration is pending.

  • Before: The unavailable plugin formatter causes the owner entry to be dropped and the update reports requester-revoked.
  • After: The exact sender ID matches during migration; changing the configured owner to 100000000000000002 still denies the original sender.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A worthwhile, narrowly scoped repair supported by installed upgrade evidence and focused owner-matching regressions.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The current body records exact-head, isolated npm/systemd upgrades through update.run and the candidate’s delegated Doctor path from published 2026.11.10 and 2026.11.8, successful Discord migration and authenticated successor health, plus refusal after owner replacement; native Discord ingress was not exercised.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An unchanged configured chat owner can have an update rejected as revoked while Doctor temporarily withholds the channel plugin.
Reason: The maintainer-authored PR restores a demonstrated shipped owner contract without adding configuration, storage, or a competing authority owner.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still has the typed-owner rejection, and this PR provides a focused repair with no blocking correctness finding.

Reviewed head: 5358cc1ab827a13ec4a22b2611eaa7c4197acf5b

Before merge

None.

Findings

None.

Agent review details

How this fits together

The delegated updater reads current owner configuration and plugin availability, then supplies an authority result to the installed candidate’s Doctor and finalizer.

flowchart TD
  A[Chat update requester] --> B[Installed candidate finalizer]
  B --> C[Requester authority]
  D[Current owner configuration] --> C
  E[Plugin migration registry] --> C
  C --> F[Shared owner matcher]
  F --> G[Doctor admission result]
Loading

Technical review

Best possible solution:

Retain the existing owner matcher and narrowly supply migration-deferred channel context without rewriting configured owner targets.

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

Current-main source deterministically drops discord:user:100000000000000001 without its plugin formatter, and the finalizer converts the failed owner check into requester-revoked; no target code was executed during this review.

Is this the best way to solve the issue?

The patch repairs normalization at the existing shared owner boundary, preserves loaded-plugin behavior and exact identity matching, and avoids the heartbeat regression associated with rewriting typed owner configuration.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Typed owner normalization changes intended behavior with a stated reason (fix(doctor): keep the owner target kind when migrating legacy channel owners #167059: Preserve direct-target kinds needed for delivery while letting loaded channel plugins normalize owner identities.)
  • Requester checks during deferred plugin migration keeps the original intent (a5bcd9c: Allow configured owners through the circular dependency between Doctor authorization and pending plugin migrations, retaining exact native-ID checks.)
  • Shared command owner facts keeps the original intent (7ce6c02: Move owner facts out of command authorization while admission owns authority decisions.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit a5bcd9c adds src/infra/update-requester-authority.ts:152 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a5bcd9c8c8c3; files: src/infra/update-requester-authority.ts)
  • Ayaan Zaidi: Raw commit 7ce6c02 adds src/auto-reply/command-owner-facts.ts:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7ce6c0299e98; files: src/auto-reply/command-owner-facts.ts)
  • Tideclaw Bot: Raw commit 09431bb adds src/infra/update-requester-authority.ts:174 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 09431bb0f7dc; files: src/infra/update-requester-authority.ts)

PR surface

Source +24, Tests +30. Total +54 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 36 12 +24
Tests 1 30 0 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 66 12 +54

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #205162
Summary: This PR addresses the reported typed-owner rejection; legacy-config projection and interrupted recovery are separate work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • 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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-11-26T01:23:16.556Z sha 9e54c9a :: needs changes before merge. :: [P2] [P2] Repair deferred typed-owner matching across the shared channel owner
  • reviewed 2026-11-26T01:28:40.465Z sha 9e54c9a :: needs changes before merge. :: [P2] [P2] Repair deferred typed-owner matching across the shared channel owner
  • reviewed 2026-11-26T03:20:56.630Z sha 3ca092f :: needs maintainer review before merge. :: none
  • reviewed 2026-11-26T06:06:39.775Z sha 3ca092f :: needs maintainer review before merge. :: none
  • reviewed 2026-11-26T06:35:50.092Z sha e4cfe34 :: needs maintainer review before merge. :: none

Reviewed November 26, 2026, 2:59 AM ET / 07:59 UTC (Revision 6).

@tideclaw-bot

tideclaw-bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Exact-head evidence for 9e54c9a33651c1d5eb08e5ac90046620366f9200. The requester-authority suite passed 16/16 in a disposable rootless container, including typed Discord owner authorization while plugin migration is pending and refusal after owner removal. The published-driver-update job was skipped for this head.

Installed proof: private rootless Podman, systemd user unit, --network none, offline npm, local verified archives. Baseline 810d0cb8a42135dbf710cb6d09afb4b727645ed4; baseline and candidate both report version 2026.11.10, so comparison uses authenticated serving commit/build/boot IDs. Drove production update.run with a synthetic Discord requester and checked /healthz, /readyz, and authenticated health.

  • Authorized with pending Discord state fixture: run 8b52fbe0-17c6-4b93-945d-8ccece3eb27a finished succeeded, and exact candidate 9e54c9a served healthy on a new boot. The predecessor rejected the typed-only owner while the plugin migration was pending, so the installed hop used the predecessor-compatible discord:<id> owner entry. The legacy cache fixture was still present after boot; this proves candidate activation with the fixture present, not that it was migrated or that the typed-only fallback ran.

  • Revoked before request: owner_required, runId: null; the prior build and boot stayed healthy.

  • Revoked after install, before trial activation: run 314be252-025f-4657-86a5-8bdf60c6ca26 had a published candidate and a pending trial when the owner entry was revoked at 02:10:22.965Z. The already-admitted run finished succeeded; the exact candidate served healthy on a new boot. A fresh request from the revoked owner returned owner_required. No rollback occurred and no stopped-Gateway outage was reproduced.

The installed route is the prepared-release update.run path, not the delegated CLI finalizer. No product patch or branch push was made. There was no native Discord ingress in this offline run; the Discord QA mock provider substitutes model calls, not Discord’s transport.

Published-driver follow-up

The reported false revocation is in the new installation's post-core worker, which reconstructs configured-owner authority after the package swap. The installed 2026.11.10 managed handoff has a separate pre-install owner gate; candidate code cannot repair a refusal at that earlier gate.

  • Real pending-receipt control: used the production migration writer in the disposable container, then read the SQLite-backed pending record back before invoking the packaged delegated authority. With only discord:user:<id> configured and the real loader withholding Discord, predecessor 810d0cb8a421 returned owner:false; the exact PR build returned owner:true. Its normal doctor --fix cleared both the pending receipt and the cache file. The same typed owner still passed afterward.
  • Published 2026.11.10 early-refusal control (17cf73a8-c443-4f0d-9dea-1c27f70a0332): with a real pending migration record already present, the old helper refused the unchanged typed owner with owner_required before launching the update child. The exact same published build, boot and PID still served /healthz, /readyz, and authenticated health. A patch shipped in the destination cannot affect this gate.
  • Prepared-release forward hop (63e298a7-8b07-483a-8fee-7bbb752db5aa): exact PR build → 2026.11.11 relabel admitted the typed owner, settled successfully, and served build 2026.11.11-offline-repack-9e54c9a33651 healthy on a new boot. The cache fixture remained and this path did not run the delegated worker; it is not the end-to-end migration proof.
  • Published 2026.11.10 → sealed PR candidate: the real managed handoff reached activation and Doctor. The first run reached update-activation-timeout; the longer updater-budget retry (0e357ce7-6944-429e-8779-369d765edc8b) outlasted the harness polling window while Doctor was still running. Neither proves a completed legacy hop.

The delegated requester check now accepts the exact typed user target for
whichever channel plugin Doctor is holding back for its state migration,
not only Discord. Mattermost, Slack and Teams share the user-prefixed
direct target style.

Co-authored-by: RomneyDa <[email protected]>
@tideclaw-bot tideclaw-bot changed the title fix(update): preserve typed Discord owners during plugin migration fix(update): preserve typed channel owners during plugin migration Nov 26, 2026
@tideclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 26, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Nov 26, 2026
@tideclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@tideclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Ports the typed-owner match to src/auto-reply/command-owner-facts.ts, where #205772 moved it.

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

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa merged commit 777b439 into main Nov 26, 2026
130 checks passed
@RomneyDa
RomneyDa deleted the openclaw/chat-update-auth branch November 26, 2026 08:21
tideclaw-bot added a commit that referenced this pull request Nov 26, 2026
…205666)

* fix(update): preserve typed Discord owners during plugin migration

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

* fix(update): preserve typed Discord owners during plugin migration

Worked on by:
- @RomneyDa

Co-authored-by: RomneyDa <[email protected]>
OpenClaw-Publication: a3a077a6-6af8-4854-a490-4ae036753b01

* fix(update): match typed owners for any migration-deferred channel

The delegated requester check now accepts the exact typed user target for
whichever channel plugin Doctor is holding back for its state migration,
not only Discord. Mattermost, Slack and Teams share the user-prefixed
direct target style.

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

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 777b439)
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
tideclaw-bot added a commit that referenced this pull request Nov 26, 2026
…205666)

* fix(update): preserve typed Discord owners during plugin migration

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

* fix(update): preserve typed Discord owners during plugin migration

Worked on by:
- @RomneyDa

Co-authored-by: RomneyDa <[email protected]>
OpenClaw-Publication: a3a077a6-6af8-4854-a490-4ae036753b01

* fix(update): match typed owners for any migration-deferred channel

The delegated requester check now accepts the exact typed user target for
whichever channel plugin Doctor is holding back for its state migration,
not only Discord. Mattermost, Slack and Teams share the user-prefixed
direct target style.

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

---------

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

Release adaptation: Keep the matcher in this release’s command-auth owner rather than importing the later #205772 owner extraction. Keep #205669 and #205850 separate.

(cherry picked from commit 777b439)

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot added a commit that referenced this pull request Nov 26, 2026
…205669)

* fix(update): check delegated owners against Doctor-migrated config

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

* fix(update): check delegated owners against Doctor-migrated config

Worked on by:
- @RomneyDa

Co-authored-by: RomneyDa <[email protected]>
OpenClaw-Publication: b6bc84cd-308e-8d6c-b593-250f38546170

---------

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

Release adaptation: Apply after #205666, retaining the release-only package-settlement test and independent typed-owner regression; the ordinary managed admission still rejects invalid config.

(cherry picked from commit 09431bb)

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…penclaw#205666)

* fix(update): preserve typed Discord owners during plugin migration

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

* fix(update): preserve typed Discord owners during plugin migration

Worked on by:
- @RomneyDa

Co-authored-by: RomneyDa <[email protected]>
OpenClaw-Publication: a3a077a6-6af8-4854-a490-4ae036753b01

* fix(update): match typed owners for any migration-deferred channel

The delegated requester check now accepts the exact typed user target for
whichever channel plugin Doctor is holding back for its state migration,
not only Discord. Mattermost, Slack and Teams share the user-prefixed
direct target style.

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

impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. P2 Normal backlog priority with limited blast radius. 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.

2 participants