ductor icon indicating copy to clipboard operation
ductor copied to clipboard

[Bug]: Codex background task leaks raw JSONL events after interrupt

Open paprikaw opened this issue 6 months ago • 1 comments

What happened?

After interrupting a Codex-backed background task, Ductor can send raw Codex --json events into Telegram as the task failure message.

Steps to Reproduce

1: send message in telegram 2: codex is working, running some background task 3: running /interupt interrupt in telegram 4: observed jsonl output

Expected Behavior

Users should see a sanitized message, e.g.:

text Background task was interrupted or failed before producing a final response.

Raw Codex JSONL protocol events should never be shown to users.

Operating System

Linux

Environment

Local (pip install)

Which LLM provider?

Codex

ductor version

0.16.3

/diagnose output


Relevant log output


LLM self-diagnosis (optional)

Suspected Cause

In ductor_bot/cli/codex_provider.py, when Codex exits non-zero and no assistant text is parsed, the error fallback uses raw stdout:

python elif is_error: result = parsed_error or cleaned_stderr or cleaned_stdout

For interrupted Codex runs, cleaned_stdout may be only JSONL protocol events.

This then gets forwarded as the task error through tasks/hub.py and injected by bus/adapters.py.

Suggested Fix

Do not surface raw Codex JSONL stdout as a user-facing error. If stdout contains only Codex protocol events, replace it with a generic sanitized message.

Additional context

No response

Before submitting

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

paprikaw avatar May 13 '26 14:05 paprikaw

I fixed this in v0.17.0. I changed Codex parsing so protocol-only JSONL stdout is no longer shown to users after interrupt/error; structured error text, stderr, or partial assistant text still win when present. Thanks for the clear report.

PleasePrompto avatar May 17 '26 08:05 PleasePrompto