ductor icon indicating copy to clipboard operation
ductor copied to clipboard

Improve resilience on SIGKILL (auto-retry + user guidance) and quick-command handling

Open jhste102lab opened this issue 9 months ago • 1 comments

Summary

I observed intermittent unresponsiveness when the Codex subprocess is terminated by SIGKILL (return code -9), and /status can feel blocked in busy chats unless it uses a quick bypass path.

I implemented and validated a local fix. Sharing details here for upstream feedback.

Observed behavior

  • System logs sometimes show:
  • Exec failed ... signal SIGKILL
  • User-facing impact:
  • response stream stops mid-run,
  • user often has to resend manually,
  • /status responsiveness in channel/group contexts should remain high.

Local changes

1) SIGKILL-aware recovery (highest priority)

  • Detect SIGKILL via return code (-signal.SIGKILL).
  • On first SIGKILL:
  • kill active chat process(es),
  • reset session,
  • auto-retry once.
  • If retry also ends with SIGKILL:
  • return explicit user guidance:
  • Execution was interrupted. Please send the same request again.
  • Add internal recovery markers:
  • recovery.sigkill ... action=retry
  • recovery.sigkill ... action=user-retry

2) Operational UX during recovery

  • In streaming mode, when retrying recovery, emit a system status message:
  • Please wait, recovering...

3) Quick command bypass improvement

  • is_quick_command() now also recognizes bot-mentioned commands:
  • /status@my_bot
  • /model@my_bot ...
  • This helps keep /status responsive in group/channel usage.

Key patch areas

  • ductor_bot/orchestrator/flows.py
  • ductor_bot/bot/app.py
  • ductor_bot/bot/middleware.py
  • tests/orchestrator/test_flows.py
  • tests/bot/test_middleware.py

Validation

Executed locally:

  • ruff format .
  • ruff check .
  • mypy ductor_bot
  • pytest tests/orchestrator/test_flows.py tests/bot/test_middleware.py

Result:

  • All lint/type checks passed

  • 82 passed

Request

If this direction aligns with project expectations, I can prepare a clean PR with:

  1. SIGKILL recovery retry path,
  2. final user guidance after retry failure,
  3. /status@bot quick-command behavior tests.

jhste102lab avatar Feb 19 '26 06:02 jhste102lab

Implemented in v0.4.2. Thanks for the detailed report, @jhste102lab!

PleasePrompto avatar Feb 19 '26 10:02 PleasePrompto