Repository navigation
refactor(channels): share native approval control ownership - #140695
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
d03e22e to
93dcc97
Compare
|
Codex review: blocked before merge. Reviewed September 7, 2026, 3:21 AM ET / 07:21 UTC. ClawSweeper reviewWhat this changesShares Google Chat and Microsoft Teams approval-card token handling through one SDK registry and retires an unused forwarding helper export. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-directed consolidation remains distinct from current main and the related PRs. No blocking correctness finding remains; the updated discussion addresses the prior retirement-approval concern and reports completion of the requested build and startup checks. Priority: P3 Review scores
Verification
How this fits togetherNative approval cards let operators approve or deny requests from chat. Plugins validate the click and actor, use the registry to prevent concurrent settlement, then resolve through the Gateway and update the card. flowchart TD
A[Approval card click] --> B[Plugin scope and actor checks]
B --> C[Plugin-local token registry]
C --> D[Gateway approval resolution]
D --> E[Terminal card update]
E --> F[Retire token and cleanup]
D --> G[Release claim on retryable failure]
E --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -133, Tests +116, Docs +10. Total -7 across 18 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared lifecycle and plugin-owned authorization, with the documented SDK retirement governed by the recorded maintainer replacement decision. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving consolidation, and review found no introduced runtime defect to reproduce. Is this the best way to solve the issue? Yes: a single generic registry removes duplicated lifecycle code while preserving plugin policy; the export tradeoff now has explicit maintainer-visible justification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d58961f33fd. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
93dcc97 to
5c0b781
Compare
Hold each token claim through Gateway resolution and terminal card updates. Keep plugin expiry policy, identity checks, and Google Chat suppression local. Proof: node scripts/run-vitest.mjs across 12 native-control suites (96 tests); extension production/test typechecks and isolated autoreview through P2 passed.
Expose native controls through approval-runtime and retire the uncalled forwarding evaluator. Preserve the shared routing predicates, callback types, and each plugin's claim, expiry, retry, and completion policy. Proof: canonical SDK export/surface checks (4446 exports, 2630 callables), 50 files/583 focused tests, targeted typechecks, and isolated review passed.
Keep the same void latch without a redundant type argument in the native approval registry test. Production and public API code are unchanged. Proof: native approval registry suite (4 passed) and fresh isolated review.
5c0b781 to
3d19045
Compare
|
Merged via squash.
|
…#140695) * refactor(channels): share native approval control ownership Hold each token claim through Gateway resolution and terminal card updates. Keep plugin expiry policy, identity checks, and Google Chat suppression local. Proof: node scripts/run-vitest.mjs across 12 native-control suites (96 tests); extension production/test typechecks and isolated autoreview through P2 passed. * refactor(plugin-sdk): replace unused approval forwarding export Expose native controls through approval-runtime and retire the uncalled forwarding evaluator. Preserve the shared routing predicates, callback types, and each plugin's claim, expiry, retry, and completion policy. Proof: canonical SDK export/surface checks (4446 exports, 2630 callables), 50 files/583 focused tests, targeted typechecks, and isolated review passed. * test(plugin-sdk): omit the default deferred result type Keep the same void latch without a redundant type argument in the native approval registry test. Production and public API code are unchanged. Proof: native approval registry suite (4 passed) and fresh isolated review.
Related: #140645 and #140677.
What Problem This Solves
Google Chat and Microsoft Teams duplicated native approval token registries and the claim/settle/release lifecycle. Concurrent clicks and failed terminal-card updates require that lifecycle to remain consistent while retaining each plugin's expiry policy.
Why This Change Was Made
createNativeApprovalControlRegistry, exposed only through the existingopenclaw/plugin-sdk/approval-runtimeentrypoint, owns each plugin's independent in-memory bindings and claims. The 18-byte base64url tokens and 1,024-binding FIFO limit are unchanged. A claim covers Gateway resolution and terminal-card update; retryable failures release the claim while retaining the binding, and terminal/not-found results retire controls.Google Chat keeps its lookup-expiry behavior and manual-followup suppression through its registration wrapper and completion callback. Teams keeps its distinct lookup-expiry claim release. Explicit sweeps clear claims, while eviction retains in-flight claims. Native event scope checks, actor authorization, card rendering, error propagation and Gateway first-answer authority remain with their existing owners.
The unused public
createChannelApprovalForwardingEvaluatorbinding and implementation are retired to fund the single new registry export. Its shared routing predicates and public parameter types remain; equivalent direct private callback types replace the obsolete params record. Global and OpenClaw-org searches were fully paged and all matching import blobs inspected. The nine consuming matches belong to self-contained historical hosts with their own matching SDK implementation; no independent upstream consumer was found. No compatibility alias or SDK budget increase is introduced.User Impact
No user-visible behavior or appearance change. Approval decisions, authorization, retry behavior, expiry, persistence and configuration are unchanged.
Evidence
Fresh validation is for
3d19045240de38ef22c327bfba72af58788536fb, rebased onto main including #140645 and #140677. The original changes are preserved; docs, formatter imports, and SDK exports retain both earlier consolidations alongside this registry.node scripts/run-vitest.mjswith 48 concrete approval, registry, route-gate, Telegram handler, request-filter, and Google Chat configuration test files: 551 tests passed. Coverage includes concurrent clicks, terminal-card-update failures, retry, expiry, authorization, suppression, and canonical-winner reporting.node scripts/check-changed.mjspassed ratchets, formatting, SDK checks, all core/plugin production and test types, declaration/deprecation guards, three zero-entry dead-export scans, and core lint. Local plugin lint reaches the documented nested-worktree declaration-boundary exception; exact-head hosted lint, types, and extension package-boundary checks passed.pnpm buildpassed in 6m16s.pnpm plugin-sdk:surface:checkpassed with 4,445 public exports and 2,627 callables, within unchanged budgets. The approved public replacement remains one addition on approval-runtime and one removal on approval-native-runtime.OPENCLAW_LOCAL_CHECK=0 node --import tsx scripts/profile-extension-memory.mts --extension <id> --skip-combined --concurrency 1. IDs: discord, googlechat, imessage, matrix, msteams, signal, slack, telegram, whatsapp.openclaw/ci-gatepassed: https://github.com/openclaw/openclaw/actions/runs/34123752872. No failed-job rerun was needed.Live channel proof remains unavailable. The isolated mock-Gateway card handlers and registry tests cover the changed lifecycle boundary; they are not live transport proof.
Maintainer-directed SDK replacement
The maintainer explicitly required a fixed SDK budget and retirement of at least as many public exports as this consolidation adds. The lane's public-contract rule authorizes removal with internal migration when the GitHub-wide and OpenClaw-org consumer check finds no external consumer, and requires a named compatibility re-export if one exists. The completed, fully paged audit found no independent consumer of this binding. This is an intentional import-level removal under that direction, not a claim that flat aggregate counts guarantee compatibility. Internal users are migrated and the retirement is documented. The bot's request for a new allocation conflicts with the explicit no-budget-increase decision; the requested build and startup evidence is now complete.