Improve long-running stream timeout UX and restart auto-recovery#20
Closed
jhste102lab wants to merge 1 commit intoPleasePrompto:mainfrom
Closed
Improve long-running stream timeout UX and restart auto-recovery#20jhste102lab wants to merge 1 commit intoPleasePrompto:mainfrom
jhste102lab wants to merge 1 commit intoPleasePrompto:mainfrom
Conversation
Owner
|
Hey @jhste102lab — thank you for the thorough analysis and the well-structured PR! Your work on timeout resilience, startup recovery, and auto-resume really nailed the core problems. We couldn't merge this directly due to conflicts with parallel changes on main, but the ideas and approach have been adapted and integrated into v0.11.0. Specifically:
You're credited in the release notes as a contributor. Closing this PR since the changes are live — the related issue #19 is resolved as well. Thanks again for pushing this forward! 🙌 |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR hardens long-running stream behavior and restart recovery to prevent user-visible work loss.
It introduces timeout warning stages, bounded timeout extension, startup lifecycle notifications, and automatic best-effort recovery of interrupted foreground and named-session work.
Problem
Users running long tasks were seeing streams terminate near timeout with weak recovery context. After service restart/reboot, interrupted work often required manual re-prompting, causing avoidable friction and repeated effort.
Root Cause
Timeout handling, startup recovery, and ingress exception boundaries were implemented as separate concerns without an end-to-end reliability contract.
Specifically:
Scope of Changes
1)
ductor_bot/cli/executor.pyDUCTOR_DYNAMIC_TIMEOUT_MAX_SECONDS.timeout_warn_60timeout_warn_10timeout_extended2)
ductor_bot/bot/message_dispatch.pytimeout_warn_60timeout_warn_10timeout_extended3)
ductor_bot/bot/app.py_on_messageforTelegramAPIErrorand generic unexpected exceptions.4)
ductor_bot/session/named.pylast_promptpersistence for named sessions.mark_running(...)pop_recovered_running(...)5)
ductor_bot/orchestrator/core.pymark_running(...).pop_recovered_named_sessions(...).Behavior Changes (User-visible)
Risk / Compatibility
Validation
python3 -m py_compilepassed for all modified files.pytestsuite was not executed in this environment (pytestnot installed).Operational Notes
DUCTOR_DYNAMIC_TIMEOUT_MAX_SECONDS=<seconds>Checklist
Closes #19