Repository navigation
fix(discord): let active turns receive steering - #122452
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Maintainer decision: approved. Shared reply admission is the sole same-session ordering owner for Discord inbound messages. User-facing |
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 2:14 AM ET / 06:14 UTC. ClawSweeper reviewWhat this changesThe PR changes Discord inbound scheduling from per-session transport serialization to per-message scheduling so a later message can steer an active agent turn through shared reply admission. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-owned repair open: current main serializes Discord jobs by session before shared admission, while the branch lets the correction reach the existing active-turn steering owner. No blocking patch defect was found; landing still needs merge-result review and exact-head required checks. Priority: P1 Review scores
Verification
How this fits togetherDiscord preflights inbound messages and schedules them before handing them to shared reply admission. Shared admission owns active-turn steering, follow-up queuing, transcript handling, and agent-run ownership. flowchart LR
A[Discord inbound message] --> B[Preflight and debounce]
B --> C[Discord transport scheduler]
C --> D[Shared reply admission]
D --> E{Active turn exists}
E -->|Yes| F[Inject steering message]
E -->|No| G[Start or queue reply]
F --> H[Discord response]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource -14, Tests -88. Total -102 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the net-negative removal of Discord’s duplicate session serialization after rebasing or otherwise validating the merge result on an exact green head, leaving shared reply admission as the sole session-ordering owner. Do we have a high-confidence way to reproduce the issue? Yes—source establishes a concrete current-main path: send a second same-session Discord message while the first holds the session, and the transport queue prevents that event from reaching shared steering admission. Is this the best way to solve the issue? Yes—the branch removes the duplicate transport-layer session gate instead of reimplementing steering in Discord; shared admission already owns injection, fallback, and active-run state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 77d89b2fa843. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Remove Discord's duplicate whole-turn session serialization so corrections reach shared reply admission and steer the active run. Preserve shared steer, followup, collect, and interrupt behavior. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #48003
What Problem This Solves
Fixes an issue where Discord users sending a correction during an active turn would have that message held until the original turn finished, so default
steermode could not affect the running model.Why This Change Was Made
Discord no longer serializes complete model turns by session at the transport layer. Each Discord event can reach the shared reply admission path, which already owns session ordering and chooses active-run steering or a queued follow-up.
User Impact
Normal Discord messages sent during an active turn can steer that turn at the next model boundary. Discord busy-state tracking, durable ingress, shutdown cleanup, and transport ordering remain intact.
Evidence
steer, injects it once, starts no second agent run, and retains the original run owner.OPENCLAW_E2E_STEERED_OKand no original-turn completion marker. Message IDs, account IDs, channel IDs, and usernames are omitted.pnpm test -- 'extensions/discord/src/monitor/**/*.test.ts': 89 files, 1,048 tests passed.pnpm vitest run src/auto-reply/reply/agent-runner.runreplyagent.e2e.test.ts: 15 shared-admission tests passed.pnpm test -- extensions/discord/src/monitor/message-handler.queue.test.ts: 15 Discord queue tests passed.pnpm tsgo:prodpnpm check:test-typesOPENCLAW_E2E_BASICreply after one provider request; the isolated gateway scratch state was removed after exit. Account, bot, chat, and message identifiers are omitted.Production delta:
+3/-17lines. Test delta:+63/-151lines.