Skip to content

Discord: separate inbound worker timeout from listener timeout#36602

Merged
osolmaz merged 1 commit intoopenclaw:mainfrom
osolmaz:fix/discord-timeout-visible-notice
Mar 5, 2026
Merged

Discord: separate inbound worker timeout from listener timeout#36602
osolmaz merged 1 commit intoopenclaw:mainfrom
osolmaz:fix/discord-timeout-visible-notice

Conversation

@dutifulbob
Copy link
Copy Markdown
Contributor

@dutifulbob dutifulbob commented Mar 5, 2026

Summary

  • add a dedicated Discord inbound worker boundary for queued runs
  • stop reusing channels.discord.eventQueue.listenerTimeout as the timeout for queued agent turns
  • add explicit channels.discord.inboundWorker.runTimeoutMs config and document the new timeout split
  • keep the async worker follow-up plan in docs/experiments/plans/discord-async-inbound-worker.md

Why

The current Discord path used the Carbon listener timeout as the timeout for queued background runs in message-handler.ts.

That meant a healthy queued run could be aborted just because it outlived the gateway listener budget. The failing repro test in this PR captured that mismatch.

This change separates those concerns:

  • eventQueue.listenerTimeout now remains the gateway listener budget for normalization and enqueue work
  • queued Discord turns now run under a worker-owned timeout instead

Changes

  • src/discord/monitor/inbound-job.ts
    • add the first-pass Discord inbound job boundary and queue-key helper
  • src/discord/monitor/inbound-worker.ts
    • add the in-process inbound worker queue
    • own queued-run lifecycle, abort handling, and worker timeout logging there
    • default worker timeout is 30 minutes; runTimeoutMs: 0 disables it
  • src/discord/monitor/message-handler.ts
    • move queued execution behind the inbound worker
    • keep preflight and debounce logic in the handler
  • src/discord/monitor/provider.ts
    • stop passing eventQueue.listenerTimeout into the message handler as a run timeout
    • pass discord.inboundWorker.runTimeoutMs explicitly instead
  • config/docs
    • add channels.discord.inboundWorker.runTimeoutMs
    • clarify that channels.discord.eventQueue.listenerTimeout is only the listener budget
  • tests
    • keep the queued-timeout characterization coverage
    • add coverage that listener timeout is no longer reused as the worker timeout
    • add coverage that queued runs can complete when worker timeout is disabled

Verification

  • pnpm vitest src/discord/monitor/message-handler.queue.test.ts src/discord/monitor/provider.test.ts
  • pnpm tsgo
  • pnpm build

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord docs Improvements or additions to documentation size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants