[Fix] Tasks hang forever when OpenCode session creation never returns#383
Merged
mrubens merged 7 commits intoJul 15, 2026
Merged
Conversation
…osed Add request timeouts and session-create diagnostics so tasks no longer sit running forever when OpenCode never returns from the first POST /session.
Contributor
Author
Contributor
Author
|
Fixed the successful-create cancel race too. If Latest: cc06e11b |
Stop mapping OpenCode session-create failures through TaskAborted (Canceled); emit a transcript error and shut down via commandError so resolveStatus returns Failed.
If the user cancels before OpenCode invents a session, CancelTask is a no-op and a later StartNewTask timeout must still force sandbox shutdown.
If CancelTask arrives before ensureSession finishes, mark the race and abort any session that still gets created so a stopped manager cannot keep an orphan live turn.
Make the OpenCode session-create timeout copy tell users to open the Logs sidebar and inspect harness.log instead of a vague worker logs reference.
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.
Related issue
Related to #379 (mitigation / fail-closed diagnostics; does not claim to fix the underlying OpenCode instance bootstrap hang).
Why this PR exists
What changed
Self-hosted tasks that hang forever on OpenCode's first session/create bootstrap now fail closed with diagnostics instead of staying
runningwith zero further logs.POST /sessiondefaults to 90s; other unary calls 60s; health 15s), overridable via envopencode_session_create_faileddiagnostic (workspace, MCP names, HOME, model, elapsed/timeout, error)StartNewTaskfailures leave a transcript-visible error and shut down as a terminal Failed run — not a resumableTaskAborted/CanceledHow it was tested
Checklist
pnpm lintandpnpm check-typespass locallypnpm changeset