Repository navigation
fix(doctor): keep the owner target kind when migrating legacy channel owners - #167059
Conversation
Keep plugin-declared direct-user kinds during owner normalization and native sender authorization. Recover stripped kinds only from matching config history; otherwise report the exact correction. Share Discord target-kind metadata with its setup surface so cold Doctor can inspect installed plugins. Fixes #166724. Reported by @jaiden0.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 8, 2026, 4:37 AM ET / 08:37 UTC. ClawSweeper reviewWhat this changesDoctor preserves plugin-required direct-user target kinds and restores previously stripped kinds from matching config backups. Example: Run Doctor with owner discord:user:100000000000000001.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 6 items remain This PR addresses a current shipped regression, but its owner-format cutover is incomplete: preserved or recovered Discord owners still lose voice access and owner-derived exec approvals. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherDoctor repairs persisted OpenClaw configuration during maintenance and updates. Configured channel owners feed both heartbeat destinations and privileged command authorization. flowchart TD
A[Current owner configuration] --> C[Doctor owner migration]
B[Existing config backups] --> D[Recorded-kind recovery]
E[Channel target contract] --> C
E --> D
C --> F[Persisted owner configuration]
D --> F
F --> G[Heartbeat direct-message routing]
F --> H[Command and approval authorization]
Technical reviewBest possible solution: Complete the typed-owner cutover in Discord's shared selector while retaining native sender matching, direct-only heartbeat admission, and conservative backup recovery. Do we have a high-confidence way to reproduce the issue? Yes, from source: main strips the Discord user kind before direct-only heartbeat admission, and the proposed preserved form is rejected by existing Discord owner-consumer tests. No runtime execution was performed during this read-only review. Is this the best way to solve the issue? No, the current patch leaves competing interpretations of the owner format; updating the existing shared Discord selector completes the otherwise appropriate plugin-owned repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4dc47557f10d. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. Added test files: 2. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +177, Tests +225, Docs +21. Total +423 across 10 files. View PR surface stats
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment |
… owners (openclaw#167059) Closes openclaw#166724 Reported by @jaiden0.
…and exec approvals (#172385) * fix(discord): honor discord:user:<id> command owners in voice access and exec approvals Doctor now preserves commands.ownerAllowFrom entries such as discord:user:<id> as the canonical direct-user owner form (#167059), but the Discord owner selector still dropped every discord:user: entry as a retired envelope. For an owner list holding only that form the selector returned an empty list, so /vc rejected the owner with "You are not authorized to use this command.", voice speakers lost owner status, and owner-derived exec approvers resolved to none, leaving execApprovals enabled "auto" disabled. Keep discord:user: entries in the selector. The existing allowlist and approver normalizers already resolve user:<id> to the native sender id. * test(discord): prove typed owner approval authority at the capability boundary * test(discord): prove typed owner vc leave authority follows live owner policy --------- Co-authored-by: Dallin Romney <[email protected]>
…and exec approvals (#172385) * fix(discord): honor discord:user:<id> command owners in voice access and exec approvals Doctor now preserves commands.ownerAllowFrom entries such as discord:user:<id> as the canonical direct-user owner form (#167059), but the Discord owner selector still dropped every discord:user: entry as a retired envelope. For an owner list holding only that form the selector returned an empty list, so /vc rejected the owner with "You are not authorized to use this command.", voice speakers lost owner status, and owner-derived exec approvers resolved to none, leaving execApprovals enabled "auto" disabled. Keep discord:user: entries in the selector. The existing allowlist and approver normalizers already resolve user:<id> to the native sender id. * test(discord): prove typed owner approval authority at the capability boundary * test(discord): prove typed owner vc leave authority follows live owner policy --------- Co-authored-by: Dallin Romney <[email protected]> (cherry picked from commit 2a41d1f)
…and exec approvals (openclaw#172385) * fix(discord): honor discord:user:<id> command owners in voice access and exec approvals Doctor now preserves commands.ownerAllowFrom entries such as discord:user:<id> as the canonical direct-user owner form (openclaw#167059), but the Discord owner selector still dropped every discord:user: entry as a retired envelope. For an owner list holding only that form the selector returned an empty list, so /vc rejected the owner with "You are not authorized to use this command.", voice speakers lost owner status, and owner-derived exec approvers resolved to none, leaving execApprovals enabled "auto" disabled. Keep discord:user: entries in the selector. The existing allowlist and approver normalizers already resolve user:<id> to the native sender id. * test(discord): prove typed owner approval authority at the capability boundary * test(discord): prove typed owner vc leave authority follows live owner policy --------- Co-authored-by: Dallin Romney <[email protected]>
…and exec approvals (#172385) * fix(discord): honor discord:user:<id> command owners in voice access and exec approvals Doctor now preserves commands.ownerAllowFrom entries such as discord:user:<id> as the canonical direct-user owner form (#167059), but the Discord owner selector still dropped every discord:user: entry as a retired envelope. For an owner list holding only that form the selector returned an empty list, so /vc rejected the owner with "You are not authorized to use this command.", voice speakers lost owner status, and owner-derived exec approvers resolved to none, leaving execApprovals enabled "auto" disabled. Keep discord:user: entries in the selector. The existing allowlist and approver normalizers already resolve user:<id> to the native sender id. * test(discord): prove typed owner approval authority at the capability boundary * test(discord): prove typed owner vc leave authority follows live owner policy --------- Co-authored-by: Dallin Romney <[email protected]> (cherry picked from commit 2a41d1f) (cherry picked from commit 3b0a9f5)
What Problem This Solves
Fixes heartbeat delivery silently stopping after an update runs Doctor and rewrites a Discord owner from
discord:user:<id>todiscord:<id>. Closes #166724. Thanks @jaiden0 for reporting the repeated update regression.User Impact
Updates preserve the owner's direct-message target kind and command authority. Doctor repairs an already-stripped kind only when matching config backup history records it; otherwise it leaves the owner unchanged and reports the exact correction for the operator to confirm. Warnings do not block updates, and repairs use the existing config backup/write path. No new settings are required.
Why This Change Was Made
The existing plugin
messaging.directTargetStyledeclaration owns whether a direct target needsuser:. Discord exposes the same declaration and classifier through its setup and runtime views, so cold Doctor can consult the existing read-only installed-plugin resolver. Doctor now preserves that kind, and command authorization lets the declaring plugin normalize it to a native sender ID. Core contains no Discord-specific policy, and heartbeat's direct-target admission remains unchanged. An unavailable plugin contract also leaves the authored kind intact.Recovery reads the existing five config backups, requires the entire owner list to match the old migration's output, and stops at changed owners, includes, unreadable files, or unsafe paths. It never invents a user kind for an ambiguous ID.
Evidence
no-routeafterward; the original Doctor flow neither reports the actionable warning nor restores the recorded kind.node scripts/run-vitest.mjs <files> --maxWorkers=1in isolated state. The new regression file takes 3.651–5.145s of test time and also checks command authorization, Telegram normalization, and refusal to guess from unsafe or conflicting history.pnpm buildpassed (304.3s); the final committed runtime refresh passed (pnpm build qaRuntime, 48.2s). The build emitted a UI startup-JS gzip advisory (365.1 KiB versus 364.7 KiB), with exit 0. The clean-head Discord import profile qualified successfully (98.3 MiB peak RSS).check:changedstep passed. The aggregate command was interrupted at extension test typechecking with exit 143 and no diagnostic; the identical typecheck passed on direct replay, then every remaining planned check passed. The termination cause is unresolved. Native extension lint passed; the direct alternative also detected the deliberate canary and passed after its removal.Production: +195/-18 lines. Tests: +231/-6. Docs: +25/-4. CI timing is pending.
Test-cost observations
The new backup-boundary cases initially used an unnecessarily broad Doctor fixture; the first case took 21.615s. A file-only temporary directory and the existing loaded plugin registry reduced that case to 4ms. The full Doctor persistence cases retain the real flow and avoid plugin installation. The cold installed-plugin case uses the real Discord setup object through a tiny installed entry, reducing repeated source-graph loading from 84.798s to 37–67ms; it fails with the original setup contract and passes with the shared target-kind contract.
Existing slow suites were retained. Summed reported test times:
doctor-config-flow.legacy-composition.test.ts255.613s,doctor-config-flow.session-store-owner.test.ts182.811s,doctor-config-flow.cron-owners.test.ts166.584s,doctor-config-flow.billing-route.test.ts160.249s, anddoctor-config-flow.include-refusal.test.ts128.147s.Individual slow cases: July-upgrade convergence 141.858s (four built CLI processes); fleet capture reuse 47.993s (six Doctor health flows); billing deferral via run ID/result channel 37.750s/40.508s (three prepare-and-persist cycles each); explicit ACP reset 30.570s; Doctor warning sanitization 33.544s; July TTS locator preservation 30.827s. The shared cost owner is Doctor preflight and subprocess lifecycle: several suites lack a retained reader scope, while billing changes the update environment and invalidates cached children. These are source-backed cost explanations, not measured profiling attribution. No timeout, retry, or assertion changes were made to these suites.
The direct extension-lint command used both changed extension files with
--tsconfig test/tsconfig/tsconfig.extensions.test.json. Canary output, followed by the clean run: