-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Feature] Channel-aware device scope upgrade approval — send approval card back to triggering channel #92666
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
OpenClaw device pairing scope upgrade requests currently require SSH / control-plane approval via
openclaw devices approve. This breaks the flow when the scope upgrade was triggered by a CLI command issued from a chat session (webchat / QQ / 飞书 / Discord / etc.).We should attach the triggering chat session context (channel + sender) to the pending request, and have the Gateway auto-send an approval card back to that channel, so the user can click ✅ in-channel without SSH.
Motivation
Today, when a chat session asks the agent to do something that needs broader operator scope (e.g.,
openclaw cron runneedsoperator.admin), the flow is:~/.openclaw/devices/pending.jsongets a new entryopenclaw devices approve <requestId>This is a poor UX. We want:
Existing precedent
OpenClaw 6.6.6 already implements this for DM pairing:
When approved, OpenClaw automatically sends a confirmation back to the same channel via
notify.js(which already exists in thedevice-pairstock plugin). The same notification mechanism can be reused for device scope upgrade approval.This proves the channel-bound approval path is already viable internally — we just need to extend it from DM pairing to device scope upgrade.
Proposed implementation
Schema change (
pending.json){ "requestId": "2889c4f2-...", "deviceId": "...", "scopes": ["operator.admin"], ... "origin": { "channel": "webchat", "accountId": "default", "sessionKey": "agent:starry:webchat:...", "senderId": "owner" } }Behavior change (gateway)
When
pending.jsongains a new entry withoriginset:[Approve] [Reject]button (Control UI WebSocket)✅/❌in 60s)device.pair.approve <requestId>/device.pair.reject <requestId>Fallback
If channel doesn't support inline approval (or outbound fails), send a markdown card + link to
http://gateway.local/devices/approve/<requestId>for web UI approval. If both fail, fall back to email + SSH-required warning.Security considerations
Owner verification required: Even if a user clicks ✅ in-channel, the approval action itself must verify
commands.ownerAllowFrom. Channel-level click is convenience, NOT privilege escalation.pending.jsonremains single source of truth: Channel approval is UI only, NOT a new source of truth. The durable record is still~/.openclaw/devices/pending.json+paired.json.Scope check at
device.pair.approveis unchanged: The standard operator.pairing / operator.admin check still applies. We're just moving the UI from terminal to chat.Multi-device race condition: If multiple devices trigger scope upgrades simultaneously, each gets its own
requestId. The approval UI must scope buttons perrequestIdto avoid confusion.No silent auto-approve: The
silent: trueflag must NOT enable channel auto-approve for scope upgrades — only metadata upgrades (display name, OS version hints) are eligible for silent approval, per existing docs.Affected components
gateway/pairingpending.jsonschema gainsoriginfieldgateway/devicesdevice.pair.notifyoutbound RPCchannels/*control-uidevice-pairstock pluginnotify.jsTest cases
T1 · webchat triggers → webchat receives approval card
openclaw cron run X(needs admin)T2 · 飞书 triggers → 飞书 receives interactive card
openclaw devices remove XT3 · Non-owner tries to approve
commands.ownerAllowFromT4 · Channel doesn't support inline approval
T5 · Channel outbound fails
Related code locations
Note:
device-pairstock plugin already hasnotify.js— the channel-bound notification path is architecturally present, we just need to wire device-pair approval into it, not just device-pairing notifications.Reproduction steps
operator.admin(e.g.,openclaw cron run)~/.openclaw/devices/pending.jsonwith no user-facing notificationopenclaw devices list, thenopenclaw devices approve <requestId>Filed by: OpenClaw self-hosted user on 群晖 NAS (single-user deployment). Motivation: improve UX for scope upgrades triggered by chat-driven agent workflows.