Repository navigation
fix: restore owner-only commands after legacy identity migration - #137780
Conversation
Rewrite legacy channel:user:id command owners before runtime consumes them, report each repaired entry, and remove duplicate Discord owner-prefix parsing. Preserve canonical IDs and unrelated channel policies. Fixes #137749. Reported by Shakker (@shakkernerd).
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 11:00 PM ET / September 4, 2026, 03:00 UTC. ClawSweeper reviewWhat this changesThe PR makes Doctor rewrite legacy Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain No blocking introduced defect was found in the pinned patch. This member-authored, maintainer-labeled compatibility repair should remain open for explicit maintainer acceptance of its documented one-time Doctor migration boundary. Priority: P1 Review scores
Verification
How this fits togetherDoctor is OpenClaw’s configuration repair flow; it persists canonical owner identities before runtime authorization reads them. Discord then uses those identities to decide who may invoke privileged native and voice commands or approve execution requests. flowchart LR
A[Legacy owner configuration] --> B[Doctor repair]
B --> C[Canonical channel owner]
C --> D[Discord owner selection]
D --> E[Native and voice commands]
D --> F[Exec approvals]
Decision needed
Why: The patch intentionally removes a divergent runtime interpretation of persisted authorization data; accepting that compatibility boundary requires maintainer judgment even though the migration and documentation are present. Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +114, Docs +3. Total +116 across 18 files. View PR surface stats
Review metrics
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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the Doctor-owned, idempotent canonicalization after a maintainer accepts the documented upgrade boundary, keeping retired runtime parsing unavailable rather than preserving divergent authorization semantics. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible: the persisted Doctor migration and Discord owner-selection path directly establish the legacy-to-canonical scenario, although this read-only review did not execute it. Is this the best way to solve the issue? Yes: persisting the repair at Doctor’s compatibility boundary and using one Discord selector avoids a runtime legacy fallback while retaining established target forms. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d84cdc5c03d3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
Keep bare user, pk, mention, and name matching contracts while doctor owns the retired channel:user:id envelope. Unqualified identities have different meanings across channel owners, so migration must not guess a Discord namespace. Remove redundant owner matching wrappers and repair the stale realtime close-race test to observe the provider audio boundary after late readiness.
|
Final source The bare-target finding and Rank-up move are addressed: shipped CI still needs its registry-timeout failures retried and queued jobs completed; no audit or lint gate was weakened. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer acceptance: the documented one-time The current-main source gap is also resolved. I fetched ClawSweeper reports no code or security findings on |
|
Merged via squash.
|
…nclaw#137780) * fix(doctor): migrate legacy channel command owners Rewrite legacy channel:user:id command owners before runtime consumes them, report each repaired entry, and remove duplicate Discord owner-prefix parsing. Preserve canonical IDs and unrelated channel policies. Fixes openclaw#137749. Reported by Shakker (@shakkernerd). * fix(discord): preserve shipped owner target syntax Keep bare user, pk, mention, and name matching contracts while doctor owns the retired channel:user:id envelope. Unqualified identities have different meanings across channel owners, so migration must not guess a Discord namespace. Remove redundant owner matching wrappers and repair the stale realtime close-race test to observe the provider audio boundary after late readiness. * refactor(discord): share command owner selection
Closes #137749. Reported by @shakkernerd (Shakker).
What Problem This Solves
Fixes an issue where configured owners could no longer use owner-only slash commands after an upgrade when
commands.ownerAllowFromstill contained legacy entries such asdiscord:user:123.Why This Change Was Made
Doctor now persists unambiguous
channel:user:identries aschannel:id, including Discord, Telegram, and Slack, and reports each rewritten list position. Discord uses one lightweight global-owner selector for native commands, voice, and owner-derived exec approvers, so the retired envelope cannot remain an alternate runtime authorization path. The migration is absorbed by simplifying owner selection and removing redundant matching wrappers.The shared command-owner selector removes the channel envelope, but the real channel formatter leaves
user:intact; that value cannot match a native sender ID. Earlier agent-roster migrations (#134706, #134758) do not own this list. The precise introducing commit is unknown; the formatter behavior also exists in the inspected July/August stable tags.Shipped bare Discord target forms (
user:,pk:, mentions, and configured name matching) retain their existing matcher and wildcard rules. Exec approvals retain the owner-only normalization pass and explicit-target behavior. These are existing contracts inv2026.8.1, not substitutes for the retired channel-qualified form. Doctor does not guess a channel for an unqualified entry: Signal and Slack interpret some of the same strings differently.User Impact
Running
openclaw doctor --fixrepairs legacy command owners once and explains the affected entries. Canonical, numeric, unknown-channel, wildcard, malformed, and colon-bearing native IDs remain unchanged. A second repair makes no further config write.Ordinary channel allowlists, message targets, and explicitly configured exec-approval targets retain their syntax. An unrepaired legacy Discord owner list cannot fall back to a broader channel allowlist.
Evidence
user:*/pk:*from becoming wildcard admission.node scripts/check-changed.mjsrun passed on the final source, including typechecks, lint, dead exports, and architectural guards.Crabbox process proof passed on final source
024ac64b6257b089efd405cfb64c46d0fe86f96f, with all 18 changed files verified by SHA-256 before a full build. The real CLI/Gateway and Discord plugin used synthetic Crabline REST/Gateway endpoints and isolated state on port 46551. Doctor received the legacyagents.listroster and legacy owners together, and persisted both repairs. Final Testbox workflow. All 30 broader voice runtime E2E tests passed on the same machine; the wrapper completed with exit 0 and the lease was stopped. This exercises a text slash command through the shared owner-only guard; native commands, approvals, and voice have focused integration coverage. Authenticated Discord interactions or audio are not claimed.The broader voice E2E run exposed a preexisting assertion against the room coordinator's removed private lifecycle field after #137433. The test now observes the real provider audio boundary across close, delayed connect completion, and late readiness. Production voice lifecycle behavior is unchanged.
Exact-head CI passed on attempt 2. The initial audit timed out at npm's bulk advisory endpoint, also observed on main and locally; one lint shard stopped during pnpm bootstrap on a registry timeout before lint ran. Both passed on an unchanged retry. No dependency or timeout workaround is included.
git diff --numstatclassification: production +68/-69 (net -1), tests +129/-15 (net +114), docs +3. The shared selection helper replaces duplicated selection and owner wrappers while preserving public target contracts.ClawSweeper's bare-target finding and Rank-up move are addressed by preserving shipped formats and adding compatibility coverage. Broader normalization of unqualified global owners remains a separate channel/authority policy question; this repair deliberately does not infer namespaces.
NO-FOLLOW-UP: the useful adjacent refactor is included in shared owner selection; another refactor would broaden authority policy without established migration semantics.