Repository navigation
refactor: simplify channel reply context handling - #157185
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: needs maintainer review before merge. Reviewed September 25, 2026, 9:35 AM ET / 13:35 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch removes Discord's inbound-job adapter, hydrates replies from native message payloads, moves Slack bot-root history decisions into its thread preparer, and consolidates related tests. Merge readiness✅ Ready for maintainer review Current main retains the adapter and queue split this PR removes, so the cleanup remains useful. The pinned diff shows no confirmed blocking defect, and the prior completed ClawSweeper review reported no findings. Priority: P3 Review scores
Verification
How this fits togetherDiscord and Slack monitors turn platform messages into inbound context before OpenClaw dispatches an agent turn and sends a reply. This change shapes reply-parent and thread-history context between admission and dispatch. flowchart LR
A[Discord and Slack messages] --> B[Channel admission]
B --> C[Reply and thread context]
C --> D[Channel run queue]
D --> E[Agent turn]
E --> F[Channel reply]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -370, Tests -897, Other -2. Total -1269 across 18 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep channel-specific context decisions with the Discord and Slack owners, with handler-boundary coverage for reply context, filtering, and cancellation. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor reports no user-facing defect to reproduce. The PR records focused synthetic boundary checks, but no live-channel observation on this head. Is this the best way to solve the issue? Yes: removing the private adapter and keeping Slack's thread decisions in its existing caller is a narrow simplification; the inspected settlement and filtering paths preserve their prior decisions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dcc9fb958ab2. 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 (3 earlier review cycles) |
Integrate current main while retaining the legacy MediaUrl slot regressions and the delivery-format prompt owner cutover in the core metadata tests. Keep the original channel cleanup and author history intact.
|
Merged via squash.
|
* refactor: simplify channel reply context handling * test: preserve native Discord fixture contracts
Related: #157091
What Problem This Solves
Removes obsolete Discord message adaptation and duplicate inbound-context scaffolding around Discord, Slack, and shared reply handling.
User Impact
No intended behavior change. Bot-message defaults, reply-parent context, access filtering, history limits, and cancellation/retry behavior remain intact. No configuration or data migration is required.
Why This Change Was Made
Discord hydration uses its native API payload instead of reconstructing fields through legacy casts and fallbacks. The in-memory queue carries prepared context directly; durable raw-message persistence remains with ingress. Slack thread preparation owns its single-caller bot-root and filtering decisions.
Tests construct typed native Discord messages, reuse preflight fixtures, and assert literal context/media contracts instead of duplicating production normalization. Public SDK compatibility paths remain intact. Net reduction: 1,269 lines (370 production, 897 tests/support, and two obsolete assertion-baseline entries).
Evidence
Current refresh
0267ba4eincorporates main9fdb24bb, including the owning ratchet-test fix. It preserves the newer legacy-MediaUrl attachment regressions and main’s delivery-format-prompt test ownership while retaining the original cleanup. CI 36140986758 passed on this exact revision. Fresh ClawSweeper review reported no findings, and the native workflow verified the squash merge as8518d391. The separately recorded boundary-run evidence below belongs to the incoming head.Message.channeldescriptor was rejected after tracing the production entry point: rawMESSAGE_CREATEpayloads pass through durable ingress, whose mapper constructs a nativeMessagewithout that property. The exported handler uses the same raw-payload path; the private preflight fallback does not establish a producer. The original review finding and the source-based disposition are retained; no unsupported compatibility shim was added.Bounded ingress-failure assessment
The complete ingress file ran in its original order: 10 cases passed; both stale-route replacement variants timed out at 120 seconds, and the later ACP exhaustion case completed unexpectedly on its third disposition. The changed skipped-queue recovery case and the started-job cancellation cases passed. A fresh process running only the first failing replacement/ACP case passed without source changes (175.84 s wrapper wall, including transformation).
The failing matrix itself is unchanged. It runs real dispatch under fake timers, awaits dispositions without driving timers, does not pass cancellation into that dispatch, and reuses target session keys across replacement/exhaustion cases. Timed-out asynchronous work can therefore affect later cases. Source comparison confirms the queue refactor preserves every fixture-consumed message, route, config, lifecycle, and signal value. The isolated pass does not prove a fix or establish the exact cause; the full-file failure remains an unresolved test-reliability concern. No assertions, timeouts, or expected outcomes were weakened.
Measured changed-test cost
Incoming-head measurements with the supported repository runner, one file per invocation and
--maxWorkers=1(equivalent topnpm test <file> --maxWorkers=1). Wall times include this host's cold transforms and worker-generation verification; several runs spent 86–97% of worker duration transforming modules. The final grouped boundary run took 507.18 s across four routed shards.Initial CI run: https://github.com/openclaw/openclaw/actions/runs/35983089503. It exposed the three static-check failures above; its passing jobs do not establish that the locally failing ingress matrix passed. The incoming-head CI run is https://github.com/openclaw/openclaw/actions/runs/35988263678. Its sole non-aggregate failure was
checks-node-compact-small-43: the unchangedcheck-max-lines-ratchetworktree CLI test receivedcontext canceledon stderr despite status 0. That shard passed 1,497 other cases; its test phase took 153.71 s. The owning fix #157200 (809808b7) has since landed on main and is included in this refresh. It narrowly handles the known standalone compiler shutdown diagnostic while preserving other failures. No dependency or vendor patch is introduced here, and no required check has been bypassed. The refreshed exact-head CI completed successfully.