Repository navigation
refactor(channels): share terminal approval interpretation - #140677
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 8:25 AM ET / 12:25 UTC. ClawSweeper reviewWhat this changesCentralizes approval-result labels and text across six channel plugins while preserving their wording and precedence, and replaces three public SDK exports with presentation helpers. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-directed consolidation remains distinct from current main and the related PRs. No actionable correctness finding remains; the earlier compatibility-alias request was superseded by the documented export-replacement decision. Priority: P3 Review scores
Verification
How this fits togetherChannel approval handlers receive recorded decisions and application results from the Gateway. Shared presentation helpers turn those facts into labels and receipts, while each plugin retains its transport formatting and message limits. flowchart TD
A[Gateway approval result] --> B[Typed approval view]
B --> C[Shared outcome interpretation]
C --> D[Application-first card label]
C --> E[Denial-first receipt text]
D --> F[Channel formatting and limits]
E --> F
F --> G[Updated approval message]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -5, Tests +364, Docs +14. Total +373 across 19 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one shared presentation interpreter, transport-owned limits, and the documented migration paths under the accepted SDK replacement decision. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor preserves existing behavior rather than claiming a reproduced defect; source comparison and added cases cover the relevant presentation invariants. Is this the best way to solve the issue? Yes: a private shared interpreter removes repeated precedence logic while preserving channel-specific formatting, and the public export replacement follows the recorded maintainer decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 44269cf16d1f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
7d3d4cd to
50f77ae
Compare
Preserve application precedence in rich labels and denial precedence in system change prose, including the real deny/not-applied producer result. Keep transport label spelling and text bounds at their existing owners. Proof: node scripts/run-vitest.mjs across 48 approval/ingress files (547 tests); isolated autoreview clean through P2.
Expose terminal presentation only through approval-runtime and preserve both precedence orders. Retire three unused broad bindings, make the session predicate private, and retain the narrow account helpers used by plugins. Proof: canonical SDK export/surface checks (4446 exports, 2630 callables), 48 files/547 focused tests, 3 filter tests, and targeted typechecks passed.
50f77ae to
6e96706
Compare
|
Merged via squash.
|
…140677) * refactor(channels): share terminal approval interpretation Preserve application precedence in rich labels and denial precedence in system change prose, including the real deny/not-applied producer result. Keep transport label spelling and text bounds at their existing owners. Proof: node scripts/run-vitest.mjs across 48 approval/ingress files (547 tests); isolated autoreview clean through P2. * refactor(plugin-sdk): replace duplicate approval exports Expose terminal presentation only through approval-runtime and preserve both precedence orders. Retire three unused broad bindings, make the session predicate private, and retain the narrow account helpers used by plugins. Proof: canonical SDK export/surface checks (4446 exports, 2630 callables), 48 files/547 focused tests, 3 filter tests, and targeted typechecks passed.
Related: #140645 and #140695.
What Problem This Solves
Approval results were interpreted independently in Discord, Slack, Matrix, Google Chat, Teams, Telegram, and the SDK text helper. Denied system changes also publish
not-applied, so consolidating those copies without preserving their precedence would change existing receipts.Why This Change Was Made
One private SDK interpreter now supplies terminal labels and system-agent prose through the existing
openclaw/plugin-sdk/approval-runtimeentrypoint. Rich labels retain application-status precedence; prose retains denial precedence; both prioritize cancellation. Discord's decision spelling/colors, Telegram's UTF-16 limits, and the SDK wrapper's resolved-event decision override remain intact.The three new helpers replace three unused bindings on that same public entrypoint:
matchesApprovalRequestSessionFilter,resolveApprovalRequestAccountId, andresolveApprovalRequestChannelAccountId. Account lookup remains available throughapproval-native-runtime; the session predicate is private behind the retained full request-filter API. Its unsafe-regex test now exercises that public filtering path.Global and OpenClaw-org consumer searches were fully paged and import blobs inspected. No independent consumer of the retired broad bindings was found; matches were self-contained hosts or generated/historical artifacts. The verified Inline consumer uses the retained narrow binding. No compatibility alias or budget increase is introduced.
User Impact
No user-visible behavior or appearance change. Approval authorization, settlement, persistence, decision/application precedence, and message limits remain unchanged. Plugin authors use the existing approval runtime entrypoint for the shared presentation helpers and the native runtime entrypoint for account lookup.
Evidence
Fresh validation is for
6e96706af6e941aa8226b29174b8971ce5af38be, rebased onto main including #140645. Production patches are unchanged; the docs conflict was resolved by retaining both consolidations' guidance.node scripts/run-vitest.mjswith 46 concrete approval, Telegram handler, and public request-filter test files: 535 tests passed. Tests preserve cancellation, denial/application precedence, channel-specific receipt text, UTF-16 bounds, and the resolved-event decision override.node scripts/check-changed.mjspassed ratchets, formatting, SDK checks, core/plugin production and test typechecks, declaration/deprecation guards, all three dead-export scans (zero entries), and core lint. Local plugin lint reaches the documented nested-worktree declaration-boundary exception; exact-head hosted lint, typechecks, and extension package-boundary checks passed.pnpm buildpassed in 6m29s.pnpm plugin-sdk:surface:checkpassed with 4,446 public exports and 2,629 callables, within unchanged budgets. The public replacement remains three additions/three removals on the existing approval-runtime entrypoint.OPENCLAW_LOCAL_CHECK=0 node --import tsx scripts/profile-extension-memory.mts --extension <id> --skip-combined --concurrency 1, for Discord, Google Chat, iMessage, Matrix, Teams, Signal, Slack, Telegram, and WhatsApp.openclaw/ci-gate: https://github.com/openclaw/openclaw/actions/runs/34121243751. No CI rerun was needed.Live channel proof remains unavailable. Mock-Gateway handler suites verify the changed presentation boundary; they are not live transport proof.
Maintainer-directed SDK replacement
The maintainer explicitly required this consolidation to use the existing approval runtime entrypoint and replace at least as many public exports as it adds, without increasing SDK budgets. The lane's public-contract rule authorizes removal and internal migration after a GitHub-wide plus OpenClaw-org audit finds no external consumer. All search variants were paged to completion; the retiring broad bindings have no independent upstream consumer. Existing narrow account helpers remain available and the observed independent Inline consumer retains its import path. This is an intentional import-level removal under that direction, with migration documented; flat counts alone are not the compatibility argument. The bot's request to retain all broad bindings would conflict with the explicit replacement decision.