feat(session): watchdog for stuck tool/session recovery#20104
Open
ESRE-dev wants to merge 1 commit intoanomalyco:devfrom
Open
feat(session): watchdog for stuck tool/session recovery#20104ESRE-dev wants to merge 1 commit intoanomalyco:devfrom
ESRE-dev wants to merge 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
- Add SessionActivity tracker for session liveness monitoring - Add cleanupOrphanedParts() to recover tool parts stuck from prior crashes - Add periodic watchdog that detects stuck tools beyond configured timeout - Leaf-filtering: only force-errors actual stuck tools, not task tools waiting on children - Idle detection: cancels sessions with no activity beyond idle threshold - Config support for tool_timeout, task_timeout, idle_timeout
753a4b4 to
2423da1
Compare
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Apr 2, 2026
…nomalyco#20104, anomalyco#20103) - SessionActivity tracker for per-session activity timestamps - Watchdog tick (60s) with leaf-filtering to force-error stuck tools - Idle detection (default 5min) cancels unresponsive subagent sessions - Orphan cleanup on startup for crash recovery - raceSignal() for abort-aware tool execution with configurable timeouts - Non-task tools: 15min global timeout (configurable) - Task tools: 4hr default timeout with partial output recovery - Fixed pre-existing typecheck error in app.tsx (removed externalOutputMode)
6 tasks
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Apr 3, 2026
…ssions (anomalyco#20104, anomalyco#20103)" This reverts commit ab7ff56.
6 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.
Issue for this PR
Closes #20099
Type of change
What does this PR do?
Adds a runtime watchdog safety net for stuck tools and sessions, complementing startup recovery work.
This PR introduces:
Session activity tracking
Startup orphan cleanup
runningtool parts from prior process exits as errored on bootstrap.Runtime watchdog tick
tool_timeoutandtask_timeoutas independent cutoffs per tool type, so a short tool timeout is not overridden by a longer task timeout.Idle session detection
Config wiring
experimental.tool_timeout,experimental.task_timeout, andexperimental.idle_timeoutto tune watchdog behavior.This is intentionally scoped as a runtime watchdog feature and is complementary to #19023 (startup recovery).
How did you verify your code works?
packages/opencode/test/session/watchdog.test.ts(21 tests).bun typecheck).Screenshots / recordings
Not a UI change.
Checklist
If you do not follow this template your PR will be automatically rejected.