Skip to content

fix: keep approval requests on the owning channel account - #121673

Merged
obviyus merged 1 commit into
mainfrom
investigate/issue-112067
Aug 10, 2026
Merged

obviyus merged 1 commit into
mainfrom
investigate/issue-112067

Conversation

@obviyus

@obviyus obviyus commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #112067

What Problem This Solves

Fixes native exec or plugin approvals without an account binding appearing on every eligible account for the same channel. It also prevents a copied approval ID from being resolved through an account that did not own the request route.

Why This Change Was Made

Native approval routing and resolution now share one account-custody contract. A closed reviewer identity (channel, accountId, senderId) reaches the Gateway; the Gateway checks the authoritative live request and one config snapshot immediately before the existing resolution CAS. Exact source/session accounts and explicit forwarding targets remain a union. Accountless targets use the documented default. Unbound requests belong only to the sole actor-authorized account.

Canonical and legacy prefix resolution enforce custody before ambiguity and terminal lookup. Discord and QQBot propagate the real clicking actor. The old client-side list/find/enabled-account preflight is deleted, so visibility-filtered lists cannot bypass Gateway custody and delivery runtime availability cannot disable manual approval.

Native delivery separately snapshots raw-eligible live runtimes once per approval and channel. Bound or explicitly targeted accounts remain a union. An unbound route selects only its sole live candidate; multiple candidates produce one visible manual-approval outcome. The snapshot remains stable through expiry, so stopped or late runtimes cannot steal or duplicate delivery.

No config, persistent state, cache, or retry path was added.

Maintainer Decision

Decision owner: Ayaan Zaidi — APPROVED. Preserve the shipped reviewer-less Plugin SDK resolver path as a temporary compatibility exception for trusted legacy/admin callers. Every bundled channel control now sends the complete channel/account/sender reviewer triple; partial reviewer facts fail closed. This PR claims account custody only for complete-reviewer channel controls. Do not fabricate a default account for omitted SDK facts. Make reviewer custody mandatory only through a future versioned Plugin SDK cutover.

User Impact

Operators with several bots or workspaces on one channel receive approval commands only on intended accounts. Explicit multi-account forwarding still works. Copied IDs and buttons from unrelated accounts fail without executing the request. Same-account manual approval remains available when rich delivery is stopped or unavailable.

Evidence

  • Final focused proof: 215/215 tests across Gateway custody, shared native runtime/coordinator, Discord, Telegram, Matrix, QQBot, and Slack; 9 shards in 31.04s.
  • Partial-identity repair proof: 135/135 focused resolver, Gateway custody, and command tests; all six incomplete reviewer shapes fail before Gateway I/O, while reviewer-less trusted callers omit the tuple entirely.
  • Rebase proof: final patch rebased cleanly onto 620ca5f00880; main advanced again after push, with the PR remaining mergeable.
  • Static proof: git diff --check; targeted Oxfmt/Oxlint; core and extension production tsgo; extension-test tsgo. The untouched generic mock in src/infra/approval-gateway-resolver.test.ts remains the only core-test tsgo diagnostic.
  • Boundary cases: exact source account; explicit default+scoped targets; unbound sole raw-eligible account; multi-account ambiguity with a visible manual outcome; channel-local candidate groups; stable late-runtime rejection; legacy prefix filtering before ambiguity; canonical channel resolver persisted by the CAS; real Discord/QQBot actor propagation.
  • Production LOC: +974/-659 (net +315). Tests/test utilities: +894/-51 (net +843). Generated SDK baseline: +27/-26 (closure hashes only; declarations unchanged).
  • Positive production growth establishes two security owners that existing inference could not express: Gateway-atomic reviewer custody and a sticky per-request native-delivery candidate snapshot. Client preflight and five plugin-local configured-sibling scans were deleted; route classification runs once per channel and adds no request-time I/O or cache.

Exact-head Telegram behavior

Local $telegram-e2e-userbot proof on 968a0df9 used the broker's real QA user and SUT bot plus a deterministic second Telegram account on the same candidate Gateway. The owning account emitted exactly one approval card. The second account emitted no approval card; its injected copied /approve returned the expected unknown/expired result. The provider log stayed at one request, so no command or second model turn ran. The real-user recording observed progress plus the approval card, zero edits, and zero deletes. Runner-owned processes, ports, and the QA lease were clean after exit.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web scripts Repository scripts channel: qqbot size: XL maintainer Maintainer-authored PR labels Aug 10, 2026
@obviyus
obviyus force-pushed the investigate/issue-112067 branch 5 times, most recently from 7a08bb5 to f396281 Compare August 10, 2026 18:38
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime labels Aug 10, 2026
@obviyus
obviyus force-pushed the investigate/issue-112067 branch from f396281 to 8f52933 Compare August 10, 2026 18:49
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 3:51 PM ET / 19:51 UTC.

ClawSweeper review

What this changes

The PR carries complete channel, account, and actor identity through native approval delivery and resolution so only the owning account can display or approve a request.

Regression provenance

Possible regression — probable (reviewed change; failure trace; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: current main still permits the reported cross-account approval behavior, while this maintainer-owned PR adds a shared delivery selector and Gateway-side custody check. The prior Discord override finding is addressed; merge still needs an exact-head refresh after its behind-main base is reconciled.

Priority: P1
Reviewed head: 13e8cfde6dcba3c2c9ce7cd870ee611c64de68cc

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The revised source resolves the prior P1 and has coherent owner boundaries, but exact-head validation remains pending and full independent diff materialization was limited by the offline partial clone.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the reported focused test run remains supplemental validation.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the reported focused test run remains supplemental validation.
Evidence reviewed 7 items Current-main defect: For an unbound request, the current account matcher returns true when no bound account exists, allowing every eligible account to handle it.
Current-main delivery path: Current native runtime invokes each channel adapter independently after only observing the request, rather than selecting one account owner.
PR route ownership: The PR groups active runtimes by channel and selects an unbound route only when exactly one candidate is eligible; multiple candidates produce an explicit ambiguity outcome.
Findings None None.
Security None None.

How this fits together

Channel runtimes receive pending approvals and choose eligible account-specific delivery targets. Their approval controls send reviewer facts to the Gateway, which authorizes that actor and atomically records the decision.

flowchart LR
A[Pending approval] --> B[Channel account runtimes]
B --> C[Shared route selection]
C --> D[Native approval control]
D --> E[Gateway custody check]
E --> F[Atomic approval decision]
Loading

Before merge

  • Resolve merge risk (P1) - The PR reports production net growth of +315 lines for a bug fix; its two new owner boundaries are justified by cross-runtime delivery selection and Gateway-atomic custody, and no smaller single-owner alternative was found.
  • Resolve merge risk (P1) - The branch is behind current main and local partial-clone access could not materialize every blob for a complete independent diff/check run; reconcile the head and rely on exact-head CI before merge.
  • Complete next step (P2) - This protected maintainer PR needs the normal exact-head merge validation after its base refresh, not an automated replacement patch.
Agent review details

Security

None.

PR surface

Source +319, Tests +844, Generated +1, Other 0. Total +1164 across 62 files.

View PR surface stats
Area Files Added Removed Net
Source 36 976 657 +319
Tests 24 889 45 +844
Docs 0 0 0 0
Config 0 0 0 0
Generated 1 27 26 +1
Other 1 2 2 0
Total 62 1894 730 +1164

Review metrics

Metric Value Why it matters
Production versus test LOC production +974/-659 (net +315); tests/test support +894/-51 (net +843); generated baseline +27/-26 The reported production growth is substantial for a bug fix and must remain justified by the shared selection and Gateway custody owners rather than plugin-local duplication.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #112067
Summary: This PR is a candidate fix for the linked report of approvals appearing in unrelated Telegram accounts and being actionable outside their owning route.

Members:

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

Mantis proof suggestion

A Telegram Desktop recording would directly demonstrate owning-account delivery and rejection of a copied action from another account. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram desktop proof: verify that an approval appears only in its owning account and a copied action from another account is rejected.

Merge-risk options

Maintainer options:

  1. Refresh and validate the exact merge head (recommended)
    Reconcile current main, then require the focused custody suites and required exact-head CI before merging this compatibility- and delivery-sensitive change.

Technical review

Best possible solution:

Land one canonical approval-custody flow: shared runtime selection for delivery, plus a live Gateway recheck before the resolution CAS, without restoring plugin-local sibling scans.

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

Yes, from current source: an unbound approval makes the matcher accept every account at src/infra/approval-request-account-binding.ts:153, and each runtime independently invokes its adapter at src/infra/approval-native-runtime.ts:232. Focused execution was not performed in this read-only review.

Is this the best way to solve the issue?

Yes. Shared selection owns cross-runtime delivery, while the Gateway owns authorization against the live record immediately before resolution; a channel-local guard alone would leave copied IDs and non-native controls unchecked.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8a5978154f69.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the reported focused test run remains supplemental validation.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Incorrect account selection can expose or route pending approvals to unrelated active channel accounts.
  • merge-risk: 🚨 compatibility: The Gateway Protocol and Plugin SDK resolution paths gain an optional reviewer identity while preserving a legacy caller path.
  • merge-risk: 🚨 message-delivery: The native runtime coordinator now decides which configured account receives each pending approval.
  • merge-risk: 🚨 security-boundary: The patch makes channel, account, and actor identity an authorization boundary for executing approval decisions.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the reported focused test run remains supplemental validation.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. Telegram approval cards and callbacks have a user-visible account-selection and authorization change that a short desktop proof can demonstrate.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current binding, native-runtime, and unified-resolution lines trace to the same main-branch refactor. (role: recent approval-routing contributor; confidence: high; commits: 3b3c540896ab; files: src/infra/approval-request-account-binding.ts, src/infra/approval-native-runtime.ts, src/gateway/server-methods/approval.ts)
  • Ayaan Zaidi: The PR body records approval for retaining reviewer-less SDK resolution as a temporary compatibility path. (role: recorded Plugin SDK compatibility decision owner; confidence: medium; commits: 13e8cfde6dcb; files: src/infra/approval-gateway-resolver.ts, packages/gateway-protocol/src/schema/approvals.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Reconcile current main and wait for required exact-head CI.
  • Keep the focused custody suites covering asymmetric account eligibility and copied cross-account actions.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-10T18:59:57.278Z sha 8f5293372a11df383c86e1d183a1aed21b4ea439 :: found issues before merge. :: [P1] Scope Discord overrides to the active account

steipete added a commit that referenced this pull request Aug 10, 2026
Unrelated main breakage blocking this PR's merge gate, healed here per
landing policy:

- #121653 left dead exports in src/skills/workshop: make
  removeSkillCollectionDirectory and SkillCollectionRestoreResult
  module-local; register collection-review.ts under the documented knip
  ignoreIssues test-only-export convention (production runs it via the
  scheduled maintenance loop).
- #121673 added ApprovalResolveParams.reviewer without regenerating the
  Swift mirror; regenerate GatewayModels.swift (additive only).
steipete added a commit that referenced this pull request Aug 10, 2026
…er test

Third main-heal carried by this PR: #121673 (9935ca3) left the
scoped-request mock's concrete inferred type unassignable to the generic
GatewayNativeApprovalRuntime request signature, breaking check-test-types
on main. Cast the mock at the runtime literal; assertions keep the Mock.
steipete added a commit that referenced this pull request Aug 10, 2026
Unrelated main breakage blocking this PR's merge gate, healed here per
landing policy:

- #121653 left dead exports in src/skills/workshop: make
  removeSkillCollectionDirectory and SkillCollectionRestoreResult
  module-local; register collection-review.ts under the documented knip
  ignoreIssues test-only-export convention (production runs it via the
  scheduled maintenance loop).
- #121673 added ApprovalResolveParams.reviewer without regenerating the
  Swift mirror; regenerate GatewayModels.swift (additive only).
steipete added a commit that referenced this pull request Aug 10, 2026
…er test

Third main-heal carried by this PR: #121673 (9935ca3) left the
scoped-request mock's concrete inferred type unassignable to the generic
GatewayNativeApprovalRuntime request signature, breaking check-test-types
on main. Cast the mock at the runtime literal; assertions keep the Mock.
steipete added a commit that referenced this pull request Aug 10, 2026
* feat(agents): rename spawn_task tool to suggest_task

Models across vendors read the name spawn_task as 'starts background
work' and refuse to call it when the user has not asked to start
anything (Claude Sonnet 5, verbatim: 'spawn_task (which actively starts
background work)... Since you didn't ask me to start work, I'm flagging
this as a follow-up instead'). The tool only records a suggestion card,
so the name defeated the feature.

Rename the model-facing tool to suggest_task everywhere (catalog,
descriptors, presets, display config, OpenClawKit tool-display, docs)
and migrate persisted operator state via doctor: config tool policies
and cron SQLite toolsAllow entries that reference spawn_task are
rewritten to suggest_task. No runtime alias remains; runtime exposes
only the canonical name.

Live clean-room matrix on a dev gateway (virgin session per cell):
suggested-task-card phrasing now yields exactly one card on
anthropic/claude-sonnet-5, claude-haiku-4-5, openai/gpt-5.6-sol,
gpt-5.6-luna, and google/gemini-3.1-pro; pre-rename the same bait
produced prose-only follow-ups.

* chore(doctor): keep legacy tool-name predicate module-local

isLegacyTaskSuggestionToolName has no external consumers; the exported
form tripped the knip unused-export gate (deadcode:exports).

* fix(doctor): keep tool-name migration out of plugin-owned config

The rename migration traversed the whole raw config, so any object
carrying a toolsAllow key was rewritten - including opaque
plugins.entries.*.config, which core must not mutate. Scope the apply
pass to the typed core roots (tools, agents, channels, gateway) and pin
plugin config preservation in the test. Plugin-owned tool lists migrate
via the owning plugin's doctor contract instead.

* fix(ci): heal main deadcode and stale Swift protocol mirror

Unrelated main breakage blocking this PR's merge gate, healed here per
landing policy:

- #121653 left dead exports in src/skills/workshop: make
  removeSkillCollectionDirectory and SkillCollectionRestoreResult
  module-local; register collection-review.ts under the documented knip
  ignoreIssues test-only-export convention (production runs it via the
  scheduled maintenance loop).
- #121673 added ApprovalResolveParams.reviewer without regenerating the
  Swift mirror; regenerate GatewayModels.swift (additive only).

* fix(ci): satisfy generic approval-runtime request signature in resolver test

Third main-heal carried by this PR: #121673 (9935ca3) left the
scoped-request mock's concrete inferred type unassignable to the generic
GatewayNativeApprovalRuntime request signature, breaking check-test-types
on main. Cast the mock at the runtime literal; assertions keep the Mock.

* chore(ci): drop approval-test cast superseded by main's typed mock rewrite

* chore(ci): drop duplicate knip entry superseded by main's heal
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 11, 2026
…1673)

Native approval delivery and resolution now stay bound to the originating or explicitly targeted channel account. Unbound requests fail closed across multiple eligible accounts; trusted reviewer-less SDK callers remain compatible.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 11, 2026
* feat(agents): rename spawn_task tool to suggest_task

Models across vendors read the name spawn_task as 'starts background
work' and refuse to call it when the user has not asked to start
anything (Claude Sonnet 5, verbatim: 'spawn_task (which actively starts
background work)... Since you didn't ask me to start work, I'm flagging
this as a follow-up instead'). The tool only records a suggestion card,
so the name defeated the feature.

Rename the model-facing tool to suggest_task everywhere (catalog,
descriptors, presets, display config, OpenClawKit tool-display, docs)
and migrate persisted operator state via doctor: config tool policies
and cron SQLite toolsAllow entries that reference spawn_task are
rewritten to suggest_task. No runtime alias remains; runtime exposes
only the canonical name.

Live clean-room matrix on a dev gateway (virgin session per cell):
suggested-task-card phrasing now yields exactly one card on
anthropic/claude-sonnet-5, claude-haiku-4-5, openai/gpt-5.6-sol,
gpt-5.6-luna, and google/gemini-3.1-pro; pre-rename the same bait
produced prose-only follow-ups.

* chore(doctor): keep legacy tool-name predicate module-local

isLegacyTaskSuggestionToolName has no external consumers; the exported
form tripped the knip unused-export gate (deadcode:exports).

* fix(doctor): keep tool-name migration out of plugin-owned config

The rename migration traversed the whole raw config, so any object
carrying a toolsAllow key was rewritten - including opaque
plugins.entries.*.config, which core must not mutate. Scope the apply
pass to the typed core roots (tools, agents, channels, gateway) and pin
plugin config preservation in the test. Plugin-owned tool lists migrate
via the owning plugin's doctor contract instead.

* fix(ci): heal main deadcode and stale Swift protocol mirror

Unrelated main breakage blocking this PR's merge gate, healed here per
landing policy:

- openclaw#121653 left dead exports in src/skills/workshop: make
  removeSkillCollectionDirectory and SkillCollectionRestoreResult
  module-local; register collection-review.ts under the documented knip
  ignoreIssues test-only-export convention (production runs it via the
  scheduled maintenance loop).
- openclaw#121673 added ApprovalResolveParams.reviewer without regenerating the
  Swift mirror; regenerate GatewayModels.swift (additive only).

* fix(ci): satisfy generic approval-runtime request signature in resolver test

Third main-heal carried by this PR: openclaw#121673 (ca933de) left the
scoped-request mock's concrete inferred type unassignable to the generic
GatewayNativeApprovalRuntime request signature, breaking check-test-types
on main. Cast the mock at the runtime literal; assertions keep the Mock.

* chore(ci): drop approval-test cast superseded by main's typed mock rewrite

* chore(ci): drop duplicate knip entry superseded by main's heal
obviyus added a commit that referenced this pull request Sep 13, 2026
This reverts commit 73fba52. Keep the existing per-runtime selection policy from #121673 while preserving the Slack current-message finalization fix.
obviyus added a commit that referenced this pull request Sep 13, 2026
## What Problem This Solves

The OpenClaw Change approval card appears, but its buttons cannot approve. A late callback can overwrite the application result, and a Slack card can stay pending after its delivery receipt is lost.

## Fix and Impact

Accept the existing three approval kinds in Discord, Slack, and shared presentation validation. Native updates and callbacks share a per-message queue in each channel. Callbacks read current controls before editing, so old pending cards finish and final Applied, Not applied, or Denied cards survive.

Native delivery keeps its existing frozen runtime selection from #121673. Restart/list replay does not send a second card; an authorized operator can still resolve the original card. No schema, migration, config-key, protocol, dependency, or delivery-policy change.

Supersedes #137169 by @LiuwqGit. Contributor authorship is preserved. Reported by @anyech in #137142. Refs #134670.

## Consumers

The shared presentation normalizer also feeds Telegram and the fallback renderers for other channels. Telegram already accepts the system-agent callback kind. Its existing typed-action tests remain intact. Other renderers retain their existing unsupported-control and text-fallback behavior; this change does not claim native approval support for them.

## Documentation

No product documentation change is required. `docs/plugins/sdk-channel-plugins/approvals.md:104` already requires all three kinds and the final application result. The Slack codec unit test covers a direct encoder/decoder round trip; the registered-handler and real Gateway evidence below establish the complete approval flow.

## Evidence

- Main `37130969fa54`: both emitted Discord buttons returned “This approval is no longer valid”; SQLite stayed pending and the resolver was not reached.
- Slack baseline `fc188ff0b943`: after native delivery and runtime stop, Allow Once and Deny persisted their decisions but left the original card pending with buttons.
- Narrowed candidate `b5e76a8386f03380a369dd5150f57b5e488cd64b`: three fresh real Slack handler → Gateway → application/SQLite → card cases passed. Actual stop/start/list replay selects no replacement and sends no second card. Original Allow Once and Deny clear the controls; the threaded case reads and finishes the exact original reply. Full captures: `runtime-narrowed-3.json`.
- Retained evidence: 21 non-replay Slack cases at `73fba5283a4b` cover both native/callback orders, Applied/Not applied/Denied, generic controls, stale winners, authority checks, and exec/plugin siblings. Source-aware review confirmed unchanged inputs. These are reused records, not new executions. Earlier replacement-delivery records are historical only. The retained 21 Discord Gateway scenarios cover the real dispatcher, approval resolver, application executor, SQLite results, and final cards against local HTTP responses.

The boundary uses a real bundled Gateway and native HTTP clients with isolated local HTTP and deterministic inference fixtures. Recorded harness commands (`SLACK_PROOF` is the retained evidence directory; start runs in a separate terminal):

```sh
node "$SLACK_PROOF/start.mjs" narrowed
node "$SLACK_PROOF/call.mjs" narrowed
node "$SLACK_PROOF/verify.mjs"
```

Fresh merge `f9ccdd51aa0d590adb72d35c83eb937bbe9fa13e` has direct parents candidate `b5e76a8386f03380a369dd5150f57b5e488cd64b` and main `adb6e518a44218650883f3daec4bd319165e0017`. The affected approval lifecycle group passed 836 tests (2 skipped), full Slack passed 3,017, and the Discord native/registered-callback sibling passed 44. All three commands exited 0.

```sh
pnpm changed:lanes --json --base 3713096 --head f9ccdd51aa0d590adb72d35c83eb937bbe9fa13e
node --import tsx scripts/ci-run-node-test-shard.mts
```

The retained plan and command/result receipts specify each CI config, include list, and environment. Local `pnpm exec oxlint --config .oxlintrc.json` passed for all 15 retained PR files plus both reverted files; `oxlint-final.json` records the exact command and exit. Unchanged suite evidence remains tied to its earlier merge `68930a5e67a2`, rather than being counted as a new run. CI run `34773959228` completed successfully at landing head `f08ae38f5237e35276bdf9bb2f50c68cbe4af31b`, including the previously failing type-aware jobs. The last commit changes only two Discord test fixtures; production and the accepted Gateway evidence are unchanged. Both affected test files also passed all 44 local tests.

Limit: no human click.

Co-authored-by: LiuwqGit <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…147152)

## What Problem This Solves

The OpenClaw Change approval card appears, but its buttons cannot approve. A late callback can overwrite the application result, and a Slack card can stay pending after its delivery receipt is lost.

## Fix and Impact

Accept the existing three approval kinds in Discord, Slack, and shared presentation validation. Native updates and callbacks share a per-message queue in each channel. Callbacks read current controls before editing, so old pending cards finish and final Applied, Not applied, or Denied cards survive.

Native delivery keeps its existing frozen runtime selection from openclaw#121673. Restart/list replay does not send a second card; an authorized operator can still resolve the original card. No schema, migration, config-key, protocol, dependency, or delivery-policy change.

Supersedes openclaw#137169 by @LiuwqGit. Contributor authorship is preserved. Reported by @anyech in openclaw#137142. Refs openclaw#134670.

## Consumers

The shared presentation normalizer also feeds Telegram and the fallback renderers for other channels. Telegram already accepts the system-agent callback kind. Its existing typed-action tests remain intact. Other renderers retain their existing unsupported-control and text-fallback behavior; this change does not claim native approval support for them.

## Documentation

No product documentation change is required. `docs/plugins/sdk-channel-plugins/approvals.md:104` already requires all three kinds and the final application result. The Slack codec unit test covers a direct encoder/decoder round trip; the registered-handler and real Gateway evidence below establish the complete approval flow.

## Evidence

- Main `f700a855a470`: both emitted Discord buttons returned “This approval is no longer valid”; SQLite stayed pending and the resolver was not reached.
- Slack baseline `fc188ff0b943`: after native delivery and runtime stop, Allow Once and Deny persisted their decisions but left the original card pending with buttons.
- Narrowed candidate `b5e76a8386f03380a369dd5150f57b5e488cd64b`: three fresh real Slack handler → Gateway → application/SQLite → card cases passed. Actual stop/start/list replay selects no replacement and sends no second card. Original Allow Once and Deny clear the controls; the threaded case reads and finishes the exact original reply. Full captures: `runtime-narrowed-3.json`.
- Retained evidence: 21 non-replay Slack cases at `73fba5283a4b` cover both native/callback orders, Applied/Not applied/Denied, generic controls, stale winners, authority checks, and exec/plugin siblings. Source-aware review confirmed unchanged inputs. These are reused records, not new executions. Earlier replacement-delivery records are historical only. The retained 21 Discord Gateway scenarios cover the real dispatcher, approval resolver, application executor, SQLite results, and final cards against local HTTP responses.

The boundary uses a real bundled Gateway and native HTTP clients with isolated local HTTP and deterministic inference fixtures. Recorded harness commands (`SLACK_PROOF` is the retained evidence directory; start runs in a separate terminal):

```sh
node "$SLACK_PROOF/start.mjs" narrowed
node "$SLACK_PROOF/call.mjs" narrowed
node "$SLACK_PROOF/verify.mjs"
```

Fresh merge `f9ccdd51aa0d590adb72d35c83eb937bbe9fa13e` has direct parents candidate `b5e76a8386f03380a369dd5150f57b5e488cd64b` and main `e08263bdd3341031c219bb147638f23a1f4c3c03`. The affected approval lifecycle group passed 836 tests (2 skipped), full Slack passed 3,017, and the Discord native/registered-callback sibling passed 44. All three commands exited 0.

```sh
pnpm changed:lanes --json --base f700a85 --head f9ccdd51aa0d590adb72d35c83eb937bbe9fa13e
node --import tsx scripts/ci-run-node-test-shard.mts
```

The retained plan and command/result receipts specify each CI config, include list, and environment. Local `pnpm exec oxlint --config .oxlintrc.json` passed for all 15 retained PR files plus both reverted files; `oxlint-final.json` records the exact command and exit. Unchanged suite evidence remains tied to its earlier merge `68930a5e67a2`, rather than being counted as a new run. CI run `34773959228` completed successfully at landing head `f08ae38f5237e35276bdf9bb2f50c68cbe4af31b`, including the previously failing type-aware jobs. The last commit changes only two Discord test fixtures; production and the accepted Gateway evidence are unchanged. Both affected test files also passed all 44 local tests.

Limit: no human click.

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

Labels

app: web-ui App: web-ui channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: qqbot channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL 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.

1 participant