Skip to content

fix(channels): restore system-agent approval reactions - #159132

Merged
steipete merged 4 commits into
mainfrom
deslop/l88-native-approval-reactions
Sep 27, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/l88-native-approval-reactions

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Native iMessage, Signal, and WhatsApp runtimes already advertise system-agent approvals, but their reaction registration and shared target reader/resolver rejected that kind. Prompts could advertise reactions without binding an actionable target. iMessage's persisted poll/reaction readers also rejected it after restart.

Configured Signal forwarded approvals lost the same ownership at another boundary: the shared reply-metadata reader changed explicit system-agent to exec before the delivered-message hook registered the reaction.

User Impact

Restores the declared approval kind through native delivery, reaction registration/resolution, iMessage state restoration, and already-enabled matching Signal forwarded targets. Default forwarded Signal prompts remain manual. Existing actor authorization, routing, allowed decisions, expiration, replay suppression, and Gateway authority stay with their current owners.

No config, protocol, SDK signature, persisted format, namespace, retention, or migration changes. Omitted/unknown legacy metadata kinds retain the existing exec fallback.

Why This Change Was Made

Preserve the declared kind at its existing owner boundaries. Remove the shared resolver's private legacy-inference branch, whose only caller always disabled it; retain its public typed signature and optional legacy record shape. This is the separate bug repair discovered during #158937.

Evidence

Independent Codex review is scoped-clean through P2. The final rebase preserved both reviewed product patches exactly; its duplicate WhatsApp fixture repair was dropped in favor of the stronger upstream repair.

On Blacksmith Testbox tbx_01m3fhcq50psc9rcg75k360q30 (native negative/positive proof), all five native regressions failed against the exact original production blobs for the intended behavior assertions. The repaired candidate passed all four complete changed files (70 tests), including native registration, unauthorized actor refusal, authorized Gateway handoff, replay suppression, and real SQLite restoration.

On Blacksmith Testbox tbx_01m3fqfk8nrbm3h9szd2b1vmrp (forwarding proof), the actual forwarding producer and registered Signal outbound pipeline failed the configured binding assertion with the original metadata reader; the manual-default control passed. Both passed with the repaired reader. Transport and Gateway resolution are mocked; the real delivered-message hook records bindings in a synthetic runtime store. This is boundary proof, not a live channel claim.

Complete production proof on Blacksmith Testbox tbx_01m3fwveamyqxnnhwjmmzdeqxf (run), Node 24.19.0 / pnpm 12.4.2, published main base c147e0e6521d1652c99a8152985c3c586f368d5d:

  • All five changed test files passed: 72 cases.
  • pnpm test:extensions:batch imessage, signal, and whatsapp passed: 3,319 tests, three existing Signal skips, 225 file executions (128.707 s, 136.555 s, and 93.031 s).
  • Core/SDK/Discord/Matrix/iMessage/Signal consumers and all four import-boundary suites passed: 213 tests in 13 files across nine shards, 59.311 s. Duplicate reporter summaries are counted once.
  • pnpm build passed in 410.010 s.
  • node scripts/check-changed.mjs --base c147e0e6521d1652c99a8152985c3c586f368d5d passed every stage except one unnecessary generic in the new test fixture (1,820.272 s overall). After removing that generic, the canonical affected-file check passed in 194.270 s:
    node scripts/check-changed.mjs --base c147e0e6521d1652c99a8152985c3c586f368d5d -- test/signal-approval-forwarding.integration.test.ts.
    This reran root test typing, lint, formatting, and selected repository guards. Both integration cases passed again in 17.686 s. The fixture-only correction received fresh clean review; production bytes and assertions are unchanged.
  • Full plugin/consumer/build proof used tree 4d79fdc816ff712e528a7904379e6cee2a0110c5. Subsequent changes only correct the new integration test's types and public-artifact loading; production bytes and assertions are unchanged.

Final fixture and boundary proof on Blacksmith Testbox tbx_01m3g29xk4f99zhbmt5j66jk83 (run) verified tree 9c1ff905536554dbadfbb8e4d2f81058fd1ff9ce, identical to final committed head 6856054f9a7eebcc4b3e7fc73fd479a3a97948a3:

  • The original metadata reader again failed exactly the configured stored-binding assertion, while the manual control passed; the candidate was restored afterward.
  • The affected-file check-changed command above passed in 241.953 s.
  • node scripts/run-vitest.mjs --config test/vitest/vitest.boundary.config.ts passed the entire formerly failing shard: 140 tests in 12 files, 30.585 s. The three additional fs-safe/test-helper/checker import-boundary suites also passed (4.581 s).
  • Both forwarding cases passed in 17.314 s. The existing loadBundledPluginFacade helper loads the same public Signal channel artifact; no boundary exception or production export was added. This correction received fresh independent review through P2 with no actionable findings.

All lane-owned leases are stopped. Every test, check, and build ran remotely.

Measured pnpm test <file> --maxWorkers=1 command wall times:

Test file Cases Testbox wall CI case time
extensions/imessage/src/approval-handler.runtime.test.ts 29 22.509 s 0.065 s
extensions/imessage/src/approval-reactions.persistence.test.ts 5 22.320 s 0.994 s
extensions/signal/src/approval-reactions.test.ts 15 20.951 s 0.077 s
extensions/whatsapp/src/approval-reactions.test.ts 21 20.948 s 0.032 s
test/signal-approval-forwarding.integration.test.ts 2 17.314 s 5.492 s

Testbox wall includes wrapper/worker preparation. CI case time sums the successful Linux Node case durations and excludes wrapper/transform/setup time. Native persistence uses the real SQLite lifecycle; forwarding uses the registered outbound pipeline, whose first module load accounts for most of its measured case time.

Fixes Found Along the Way

Initial CI exposed a WhatsApp debounce fixture race. The canonical repair landed in #159115 (32e46c9bb1bcdedb79bcca8e4f5b3cb0429934ca) and is included in this branch's base. The final PR does not modify that inbox fixture. Twenty standalone and three original-shard runs of a superseded local repair are not claimed as proof for the upstream implementation.

The preceding CI run passed all 335 Node cases in checks-node-changed-compact-large-9, then failed suite teardown in src/gateway/session-group-mutation-targets.test.ts: Retired agent cleanup cannot adopt a replacement shared database. It canceled the remaining jobs. The fixture closed shared state before asynchronous agent cleanup settled; this PR changes neither that fixture nor the cleanup owners.

The test-only ordered-await repair is now merged in #159163 (d9fd43d6cf4286e1734e4a6ff91b962cb3e35e82). Its owner reports 20 standalone and three original-shard passes, retaining all assertions and production identity checks. The next CI merge ref includes that upstream repair; no duplicate fix or retry-only commit was added here.

Head 5989726e706eebccaaaddcfc206f6ff99a3a6ce6 passed the previously failing cleanup shard, then CI found the test import violation corrected and fully validated above.

Final head 6856054f9a7eebcc4b3e7fc73fd479a3a97948a3 passed exact-head CI: all 162 jobs completed, no failures, and both required openclaw/ci-gate checks are green. READY-TO-LAND, intentionally unmerged.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: imessage Channel integration: imessage channel: signal Channel integration: signal channel: whatsapp-web Channel integration: whatsapp-web size: L labels Sep 26, 2026
@steipete
steipete marked this pull request as ready for review September 26, 2026 19:49
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 8:59 PM ET / September 27, 2026, 00:59 UTC (Revision 5).

ClawSweeper review

What this changes

The branch preserves system-agent approval identity through iMessage, Signal, and WhatsApp reactions, adds regression coverage, and updates channel-plugin guidance.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still has the approval failure. The pinned patch has no identified correctness or security defect, and exact-head CI passed.

Priority: P1
Reviewed head: 6856054f9a7eebcc4b3e7fc73fd479a3a97948a3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused owner-boundary regressions and successful exact-head CI support a small compatible runtime repair; channel evidence remains synthetic.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored contributor-proof gate does not apply. Reported Testbox negative and positive checks exercise channel registration, iMessage SQLite restoration, and the Signal outbound binding; the forwarding transport and Gateway resolver are mocked, so no live-channel result is claimed. The stored record format is unchanged.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored contributor-proof gate does not apply. Reported Testbox negative and positive checks exercise channel registration, iMessage SQLite restoration, and the Signal outbound binding; the forwarding transport and Gateway resolver are mocked, so no live-channel result is claimed. The stored record format is unchanged.
Evidence reviewed 7 items Current main still rejects the kind: The current-main shared persisted-target reader accepts exec and plugin but rejects system-agent; the WhatsApp registration guard has the same restriction.
Current main downgrades reply metadata: The current-main metadata reader maps explicit system-agent metadata to exec.
Pinned repair: The introduced patch admits system-agent in the shared target reader and typed resolver and preserves it in reply metadata; the changed channel guards admit the same declared kind.
Findings None None.
Security None None.

How this fits together

The Gateway sends typed approval requests to channel plugins, which deliver prompts and retain targets for reactions or polls. Authorized responses return to the Gateway, where a system-agent approval can permit a persistent change.

flowchart LR
  A[Gateway approval request] --> B[Channel prompt]
  B --> C[Reaction or poll target]
  C --> D[Stored target reader]
  D --> E[Actor and route checks]
  E --> F[Gateway custody check]
  F --> G[Approval decision]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -6, Tests +364, Docs +4. Total +362 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 7 32 38 -6
Tests 5 569 205 +364
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 605 243 +362

Review metrics

Metric Value Why it matters
Production versus test growth production −6 net lines; tests +364 net lines The runtime repair is net smaller, while the added coverage spans channel entry points and persistence.

Root-cause cluster

Relationship: canonical
Canonical: #159132
Summary: The related channel-cleanup PR explicitly treats this approval defect as separate work.

Members:

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

Technical review

Best possible solution:

Keep one typed approval path through channel bindings and let the Gateway revalidate reviewer custody when it records the decision.

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

Yes. Current-main source rejects the declared kind in reaction targets and downgrades it in reply metadata; the PR reports matching baseline failures. This read-only review did not execute the tests.

Is this the best way to solve the issue?

Yes. The branch repairs the existing typed approval path without adding a competing resolver or changing the stored record shape.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 038b10b48de0.

Labels

Label changes:

  • add merge-risk: 🚨 security-boundary: The repair makes system-agent reactions able to reach decisions for persistent changes, so actor authorization and live Gateway custody are the relevant merge boundary.

Label justifications:

  • P1: Broken approval reactions interrupt an existing channel workflow for operator decisions.
  • merge-risk: 🚨 security-boundary: The repair makes system-agent reactions able to reach decisions for persistent changes, so actor authorization and live Gateway custody are the relevant merge boundary.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored contributor-proof gate does not apply. Reported Testbox negative and positive checks exercise channel registration, iMessage SQLite restoration, and the Signal outbound binding; the forwarding transport and Gateway resolver are mocked, so no live-channel result is claimed. The stored record format is unchanged.

Evidence

What I checked:

  • Current main still rejects the kind: The current-main shared persisted-target reader accepts exec and plugin but rejects system-agent; the WhatsApp registration guard has the same restriction. (src/plugin-sdk/approval-reaction-runtime.ts:102, 038b10b48de0)
  • Current main downgrades reply metadata: The current-main metadata reader maps explicit system-agent metadata to exec. (src/infra/exec-approval-reply.ts:352, 038b10b48de0)
  • Pinned repair: The introduced patch admits system-agent in the shared target reader and typed resolver and preserves it in reply metadata; the changed channel guards admit the same declared kind. (src/plugin-sdk/approval-reaction-runtime.ts:102, 6856054f9a7e)
  • Final authority checks: The reaction settlement helper checks explicit approvers and actor authorization; the unchanged Gateway handler checks live reviewer custody and rechecks it before the approval decision write. (src/gateway/server-methods/approval.ts:382, 038b10b48de0)
  • Boundary and persistence coverage: The introduced tests exercise an unauthorized and an authorized iMessage participant, persisted iMessage targets after reset, and configured versus default-manual Signal forwarding. The PR body reports baseline failures and after-fix Testbox passes; transport and Gateway resolution in the forwarding test are mocked. (test/signal-approval-forwarding.integration.test.ts:109, 6856054f9a7e)
  • Exact-head CI: GitHub reports a successful completed pull-request run for the pinned head; this validates the checks, not a live channel interaction. (6856054f9a7e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-09-26T19:57:21.517Z sha 2f3d1cd :: needs changes before merge. :: none
  • reviewed 2026-09-26T22:03:56.687Z sha f6bcf26625488fb9e9ce90f0c0cde4bfde62a97a :: blocked before merge. :: none
  • reviewed 2026-09-26T22:43:20.283Z sha da9edc4 :: needs changes before merge. :: none
  • reviewed 2026-09-27T00:35:52.287Z sha 6856054 :: needs maintainer review before merge. :: none

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 6856054f9a7eebcc4b3e7fc73fd479a3a97948a3
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/exec-approval-reply.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@steipete steipete changed the title fix(channels): restore native system-agent approval reactions fix(channels): restore system-agent approval reactions Sep 26, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Sep 27, 2026
@steipete
steipete enabled auto-merge (squash) September 27, 2026 01:11
@steipete
steipete merged commit 768b28c into main Sep 27, 2026
230 checks passed
@steipete
steipete deleted the deslop/l88-native-approval-reactions branch September 27, 2026 01:11
MichaelC001 pushed a commit to MichaelC001/openclaw that referenced this pull request Sep 27, 2026
…n inventory (openclaw#159340)

openclaw#159132 replaced the existing unknown-cast in the WhatsApp invalid
approval-kind test with a @ts-expect-error. The type-suppression inventory
test (tooling shard, not selected by that PR's path-scoped CI) now sees 18
negative assertions against 17 recorded ones and fails on every PR whose CI
runs the tooling shard. Restore the previous cast form instead of growing
the inventory.
steipete added a commit that referenced this pull request Sep 27, 2026
Keep the negative-type assertion from #159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.
steipete added a commit that referenced this pull request Sep 27, 2026
Keep the negative-type assertion from #159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
* fix(channels): restore native system-agent approval reactions

* fix(approvals): preserve system-agent reply metadata

* test(channels): simplify forwarding fixture store types

* test(channels): load Signal through its public artifact owner
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…n inventory (openclaw#159340)

openclaw#159132 replaced the existing unknown-cast in the WhatsApp invalid
approval-kind test with a @ts-expect-error. The type-suppression inventory
test (tooling shard, not selected by that PR's path-scoped CI) now sees 18
negative assertions against 17 recorded ones and fails on every PR whose CI
runs the tooling shard. Restore the previous cast form instead of growing
the inventory.
steipete added a commit that referenced this pull request Sep 27, 2026
Keep the negative-type assertion from #159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.
steipete added a commit that referenced this pull request Sep 27, 2026
Keep the negative-type assertion from #159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.
steipete added a commit that referenced this pull request Sep 27, 2026
Keep the negative-type assertion from #159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.
steipete added a commit that referenced this pull request Sep 27, 2026
* feat(presence): let agents inspect people and active devices

Expose a read-only presence tool for online people, requester-scoped device activity, and optional network and IP geography. Reuse live connection, profile, node, and geolocation owners; preserve activity provenance and worker requester authority without retaining activity history.

* fix(presence): register tool display metadata

* fix(presence): require live source authority for agent reads

Preserve authenticated Team read scopes and explicitly admitted owner or scheduled sources before synthetic Gateway dispatch. Retain the same source through worker execution and revalidate before returning observations. Append the advertised RPC to preserve existing method indices.

Include the already-landed c0e6951 Cron fixture scheduler corrections so the branch typechecks independently. Add real local router and worker admission regressions for unknown, limited, scheduled, and revoked sources.

* fix(protocol): regenerate appended presence method enum

* fix(tooling): include presence schema in PR wrapper extraction

* test(gateway): drain buffered MCP keepalives on shutdown

* test: qualify synthetic approval kind assertion

Keep the negative-type assertion from #159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.

* test(presence): reconcile rebased lookup and inventory fixtures

* build(presence): refresh plugin assets after dependency update

* test(presence): verify activity reporting retains device attribution
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
…9117)

* feat(presence): let agents inspect people and active devices

Expose a read-only presence tool for online people, requester-scoped device activity, and optional network and IP geography. Reuse live connection, profile, node, and geolocation owners; preserve activity provenance and worker requester authority without retaining activity history.

* fix(presence): register tool display metadata

* fix(presence): require live source authority for agent reads

Preserve authenticated Team read scopes and explicitly admitted owner or scheduled sources before synthetic Gateway dispatch. Retain the same source through worker execution and revalidate before returning observations. Append the advertised RPC to preserve existing method indices.

Include the already-landed 03f9f7e Cron fixture scheduler corrections so the branch typechecks independently. Add real local router and worker admission regressions for unknown, limited, scheduled, and revoked sources.

* fix(protocol): regenerate appended presence method enum

* fix(tooling): include presence schema in PR wrapper extraction

* test(gateway): drain buffered MCP keepalives on shutdown

* test: qualify synthetic approval kind assertion

Keep the negative-type assertion from openclaw#159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.

* test(presence): reconcile rebased lookup and inventory fixtures

* build(presence): refresh plugin assets after dependency update

* test(presence): verify activity reporting retains device attribution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: imessage Channel integration: imessage channel: signal Channel integration: signal channel: whatsapp-web Channel integration: whatsapp-web docs Improvements or additions to documentation merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: L 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