Repository navigation
refactor(discord): deslop Discord transport flows - #156579
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 23, 2026, 4:25 PM ET / 20:25 UTC (Revision 6). ClawSweeper reviewWhat this changesThe Discord plugin consolidates reaction and media handling, action and component authorization, command replies, message sending, and voice transport code while aiming to preserve existing behavior. Merge readiness⛔ Blocked before merge - 3 items remain Keep open. The cleanup remains distinct from current main, and the reviewed paths show no concrete blocking code defect. OpenClaw’s refactor-only policy still needs a verified maintainer request tied to a concrete active fix or deliverable; the PR body asserts approval, but the captured discussion and reviews do not establish that link. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s Discord plugin receives Discord events and Gateway message actions, checks channel policy, and routes work to agent sessions. It also sends replies and voice output through Discord transport clients. flowchart LR
A[Discord events and commands] --> B[Discord plugin]
C[Gateway message actions] --> B
B --> D[Channel authorization and routing]
D --> E[Agent session events]
D --> F[Message and voice delivery]
F --> G[Discord API]
Decision needed
Why: The repository requires explicit maintainer sponsorship for refactor-only work; code quality and the author’s PR-body assertion cannot establish that intent. Before merge
Agent review detailsSecurityNone. PR surfaceSource -1228, Tests -4, Other -1. Total -1233 across 50 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one owner for each Discord authorization, delivery, and voice receipt decision, and land this consolidation only when a project maintainer identifies the active fix or deliverable it serves. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR addresses duplicated implementation paths rather than a reported user-facing defect. Its boundary checks exercise the affected paths after the change. Is this the best way to solve the issue? Unclear: the consolidation follows existing Discord owners and preserves the reviewed contracts, but its acceptance under the refactor-only rule depends on a named active deliverable. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bdeca1661473. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper re-review The current head The main PR body now describes the after-change behavior evidence explicitly: real Gateway scheduled-job/message-tool/Discord-adapter paths against synthetic endpoints, including revocation before a 429 retry and settlement of an accepted edit, plus 28 voice-runtime E2E cases. The root working agreement states that a covering isolated mock-Gateway harness is valid channel boundary proof. This is that validation route; no live Discord-server observation is claimed. The body links the successful Testbox runs and retains the baseline-reproduced Mac fixture failures. |
|
🦞👀 Re-review progress:
|
60b2ae8 to
54bc753
Compare
54bc753 to
cb0006a
Compare
|
Merged via squash.
|
* refactor(discord): deslop Discord transport flows * refactor(discord): keep request body types acyclic * refactor(discord): consolidate interaction and voice owners
Consolidate transport preparation, result projection, interaction handling, and private SDK helper ownership after #156579 and #156773. Preserve channel authorization, registration payloads, credentials, public exports, and persisted state. Fix stale Slack HTTP route disposal so repeated cleanup cannot unregister a replacement handler. Keep a boundary regression for same-callback re-registration and preserve transport assertions through fixture cutovers.
Consolidate transport preparation, result projection, interaction handling, and private SDK helper ownership after #156579 and #156773. Preserve channel authorization, registration payloads, credentials, public exports, and persisted state. Fix stale Slack HTTP route disposal so repeated cleanup cannot unregister a replacement handler. Keep a boundary regression for same-callback re-registration and preserve transport assertions through fixture cutovers.
* refactor(channels): deslop discord and slack second pass Consolidate transport preparation, result projection, interaction handling, and private SDK helper ownership after #156579 and #156773. Preserve channel authorization, registration payloads, credentials, public exports, and persisted state. Fix stale Slack HTTP route disposal so repeated cleanup cannot unregister a replacement handler. Keep a boundary regression for same-callback re-registration and preserve transport assertions through fixture cutovers. * fix(discord): keep shared transport contracts acyclic Move RequestData to its serializer owner and import it directly from private consumers. Give voice listeners a leaf contract implemented by the manager, removing both type-import cycles reported by the architecture CI gate. Preserve request fields, listener method signatures, and runtime behavior.
…8085) * refactor(channels): deslop discord and slack second pass Consolidate transport preparation, result projection, interaction handling, and private SDK helper ownership after openclaw#156579 and openclaw#156773. Preserve channel authorization, registration payloads, credentials, public exports, and persisted state. Fix stale Slack HTTP route disposal so repeated cleanup cannot unregister a replacement handler. Keep a boundary regression for same-callback re-registration and preserve transport assertions through fixture cutovers. * fix(discord): keep shared transport contracts acyclic Move RequestData to its serializer owner and import it directly from private consumers. Give voice listeners a leaf contract implemented by the manager, removing both type-import cycles reported by the architecture CI gate. Preserve request fields, listener method signatures, and runtime behavior.
What Problem This Solves
This is a maintainer-requested Discord architecture cleanup, requested by @steipete to remove duplicated production logic while preserving behavior and public contracts.
Discord maintains parallel reaction, media, command, component, and voice paths that repeat transport decisions. Keeping those copies consistent adds maintenance work and obscures which function owns authorization, serialization, or delivery.
User Impact
No intended behavior change. Permissions, request ordering, serialized payloads, voice admission, public client methods, plugin SDK exports, configuration, and persisted state remain unchanged.
Why This Change Was Made
Public client methods exposed through
runtime-api.tsremain intact. The only file outside Discord is an exact downward assertion-ratchet update: its obsolete picker entry goes from one assertion to zero.Evidence
Head:
cb0006ae7ecc59f3f36b01d04b418451127c201e(rebased onto3d66eb5656736343b00a156329fda9cc6054a4c1).OPENCLAW_TESTBOX=0 node scripts/check-changed.mjs: passed all selected guards, formatting, production/test types, and lint.pnpm check:architecture: passed, including zero runtime and Madge import cycles.pnpm build: passed, including plugin SDK export validation.pnpm test:extensions:batch discord: 4,164 tests passed / 297 executed files (49 database-worker tests plus 4,115 Discord tests).node scripts/run-vitest.mjsinvocation for the additional interaction, picker, component, channel, and voice changes: 412 passed / 17 files.Architecture, build, the full Discord lane, consumers, and voice E2E passed in Blacksmith Testbox, delegated command exit 0. The wrapper verified exact committed source tree
50bc2cfafed52c8e47df48a2b4e4fd332ed4eade. The changed gate, architecture, build, focused tests, full Discord suite, consumers, and voice E2E all passed in this final run (delegated exit 0). The rebased commits are patch-identical to the clean Codex review bygit range-diff. The backing Testbox Actions step may show canceled when its successful one-shot lease is released.Behavior evidence: the tests exercise actual Gateway scheduled-job/message-tool/Discord-adapter paths against synthetic HTTP endpoints, including revocation before a 429 retry and settlement of an already-accepted edit. Transcript and voice-runtime cases cover session replacement, recording ownership, and cleanup. This is isolated boundary/E2E evidence, not a live Discord-server observation.
Changed-test costs measured with
pnpm test <file> --maxWorkers=1:actions/handle-action.test.ts— 41 passed, 473.40s wall;voice/ingress.test.ts— 12 passed, 266.94s wall. Most elapsed time was fixture compilation and transforms. No tests were added or changed in the continuation sweep. The earlier expanded-head CI run completed with 104 successful jobs, 18 skips, and four failed leaf jobs plus the aggregate. The Discord extension bundle passed in 316 seconds. The failures and their attribution are recorded below; no failed check has been bypassed.Production deletion
1,229 net lines under the requested measurement: 1,228 production lines plus one obsolete baseline row.
Focused, consumer, and E2E commands
Failures investigated
The first implementation dropped enum aliases and introduced a type-only request-body import cycle. Clean-base comparisons attributed both failures to those simplifications, which were reverted; lint rules and architecture gates remain intact. The continuation's cast-helper inlining raised
interactions.tsfrom 8 assertions to 9, so that sub-change was also reverted. The picker independently removed its last cast; the required baseline entry was deleted rather than relaxed.One review claimed chunked media would repeat components/embeds. The send owner clears both variables after accepted delivery, and the existing multi-chunk test asserts a text-only follow-up. Review with that full source and test context is clean.
An earlier local scheduled-read run had 2 failures / 7 passes:
claude-cli/readtimed out after 60 seconds, thenopenclaw/channel-infoobserved duplicate metadata GETs before scheduled-job creation/action dispatch. Clean merge basebdd47f252a33146c8c4dd055a9ce1c6d7e0c31dfreproduced both in the same order. Hosted runs passed unchanged, including all nine scheduled cases in this final run. This does not claim the local fixture instability was fixed.No merge or auto-merge requested; coordinator review and a land order remain required.
CI attribution and recovery
The merge run incorporated main's dependency refresh
7dbfab8c2c7, after this branch's validated base. Its failed jobs were whole-tree formatting (an untouched UI geometry test), extension-test types (two incompatible Vitest 5.0.1 peer instances atextensions/qa-lab/src/control-ui-openclaw-delegation.real-gateway.e2e.test.ts:426), core-test types (an unresolved Vitest augmentation), and the unchanged Gateway model-catalog fixture (60-second timeout followed by an unavailable catalog). The catalog fixture disables bundled plugins and channel execution; the original 15-file group replay on clean base completed with 148 passes and 5 failures, including all four catalog cases (first timeout 60,070 ms versus 60,063 ms in CI) plus a clock-test timeout. This is attribution evidence, not a claimed fixture fix.Clean merge base
f649fdf3381passes the UI file's format check and both affected typecheck commands. Recent merged controls #156676, #156665, and #156661 show no failed checks. Main repair82411a34c8bfixes the formatting and module-augmentation failures; both now pass locally after rebasing. The separate QA/UI Vitest context mismatch reproduced both on the rebased candidate and on a clean checkout of repaired main82411a34c8bwith the Discord patch absent (node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental false, exit 1). The original base passes that command. The consumer at QA-lab line 426 receives a context from root Vitest;ui/src/e2e/control-ui-e2e-suite.test-support.ts:60requires the UI Vitest task tree, whose nested suite/file task types are incompatible across peer instances. Its owning test-support boundary is outside this Discord refactor. The remaining owning repair has now landed as3d66eb56567(fix(ci): decouple UI scenario contexts from Vitest peers). The previously failing extension typecheck passes after rebasing onto it. The three PR commits are patch-identical bygit range-diff; full final validation passed on the rebased head. The fresh exact-head CI result and remaining timeout are recorded below.The final rebased build exits 0 but reports a non-fatal Control UI diagnostic: isolated Mermaid JS is 1,555.8 KiB gzip versus its unchanged 960 KiB budget. Main upgraded
packages/mermaid-rendererfrom Mermaid 11.17.2 to 12.0.0 (and its parser from 1.2.1 to 2.0.0); the earlier validated base measured 951.7 KiB. This PR changes neither Mermaid/UI inputs nor the budget. The observation is retained for the UI/dependency owner rather than changing unrelated files.Exact-head CI timeout and recovery
CI run 35908895715 initially completed with failure on PR head
cb0006ae7ecc59f3f36b01d04b418451127c201e(event=pull_request, branchdeslop/l15-discord-sweep-20260923). Its sole failed leaf job ischecks-node-compact-large-27:src/gateway/server-methods/models-connect-publication.integration.test.ts:52exceeded its 60-second test deadline at 60,220 ms; 180 sibling tests passed. The aggregate failed accordingly. The failing test is byte-identical at the clean base and candidate and explicitly disables plugins and channels. The log does not identify which awaited operation exceeded the deadline.The saved original 14-file CI group was replayed using
node --import tsx scripts/ci-run-node-test-shard.mtswith its originalOPENCLAW_NODE_TEST_GROUPS_GZIP_BASE64plan in Blacksmith Testbox. The wrapper verified the candidate tree; a separate clean worktree at merge base3d66eb5656736343b00a156329fda9cc6054a4c1was installed and tested first, then removed before testing the candidate. Both sides passed 181 tests / 14 files: base 121.12s, candidate 118.44s. The catalog case took 10,237 ms on base and 11,563 ms on candidate. Delegated command exit 0; lease completed.This comparison used Node 24.19.0 on both sides. The resource owner observed 4 CPUs/16 GiB and correctly admitted the plan's two-worker fallback; the failing CI job had 8 CPUs/32 GiB and admitted eight workers. Thus the replay found no reproducible regression on the tested allocation, but does not prove the original timeout was fixed or reproduce its worker concurrency. No test timeout, worker admission policy, assertion, or source file was changed. Recent merged controls #156724, #156718, and #156696 had no failed checks. There is no source conflict with current main.
A maintainer-authorized rerun of the failed compact-27 job on the same head passed; run 35908895715 and both enforced
openclaw/ci-gatechecks are now green. The PR has 125 successful checks, 44 skips, and one neutral check. No source, timeout, assertion, or worker-policy change was needed. The intermittent timeout and the limits of its A/B evidence remain recorded above. The maintainer reviewed and approved this diff for native landing.