Uh oh!
There was an error while loading. Please reload this page.
feat(session): watchdog for stuck tool/session recovery - #20104
Conversation
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
2423da1Compare…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)
…ssions (anomalyco#20104, anomalyco#20103)" This reverts commit ab7ff56.
rekram1-node
commented
May 15, 2026
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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.