ductor icon indicating copy to clipboard operation
ductor copied to clipboard

[Bug]: Background task showed no response for ~30 minutes, then dumped session/error events when prompted

Open mkcount opened this issue 9 months ago • 1 comments

What happened?

I started a background task and got no visible result for about 30 minutes. When I sent a follow-up message to prompt it, the bot started showing session/error event dumps instead of a normal task result.

  • Task appeared stuck (no timely completion message)
  • After follow-up, session error/event JSON-like output was exposed to chat
  • Behavior looked like failure handling output was leaked instead of a clean error summary

Steps to Reproduce

Request to create a task on Telegram.

Expected Behavior

Automatically respond when the task is completed.

Operating System

Linux

Environment

Local (pip install)

Which LLM provider?

Codex

ductor version

0.11.0

/diagnose output


Relevant log output


LLM self-diagnosis (optional)

codex review:

• Likely root cause is a failure chain, not a single bug. The task appears to finish substantial work, but Codex result parsing treats “no final assistant text” as an error. In that path, raw Codex JSONL event output is used as result/ error instead of a sanitized message. That raw payload is then forwarded to task failure delivery and exposed to chat. While sending, Telegram HTML parsing fails (

 tag
mismatch), triggering plain-text fallback.
Fallback attempts to resend a very large remaining payload,
causing message flood behavior.
Telegram rate limiting (RetryAfter) then amplifies the delay
and noisy output.
A concurrent main-session codex exec resume failure around
the same time likely worsened “session error” visibility.
So the observed symptom is mainly parser/error-handling
leakage plus unsafe fallback resend behavior.
Disabling tasks avoids the path, but proper fix should
sanitize/limit error output and harden fallback sending.

Additional context

Currently running on Ubuntu in OCI.

Before submitting

  • [x] I have searched existing issues for duplicates.
  • [x] I am running the latest version.

mkcount avatar Mar 04 '26 04:03 mkcount

Hey @mkcount! Thanks for the detailed report — and especially the LLM self-diagnosis, which was spot on.

Root cause: The task result injection was forwarding the raw original_prompt (which could contain unparsed CLI output/JSONL events) directly into the chat instead of building a properly formatted result summary. When the raw payload hit Telegram's HTML parser, it caused parsing failures, plain-text fallback, message flooding, and rate limiting — exactly the cascade you described.

What's fixed in v0.12.0:

  • Task result injection (b890323) — Results now go through _build_task_injection_prompt() which creates a clean, formatted summary with task metadata, status, and the actual result text. No more raw JSONL leaking into chat.
  • Session timeout preservation (c189909, from PR #24) — CLI timeouts now preserve the session for auto-resume instead of producing error dumps.
  • Topic routing (879d774) — Task results are now correctly delivered back to the originating forum topic (if applicable).

This should resolve the symptoms you saw. If the issue recurs on 0.12.0, please reopen this with logs and we'll dig deeper — but I'm fairly confident the injection fix addresses the core problem.

Closing for now — please let us know if it comes back!

PleasePrompto avatar Mar 04 '26 08:03 PleasePrompto