You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: OpenCode agents do not resume after restart when an awaited background shell is cancelled #44788
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Enable Continue threads after server update (continueThreadsAfterServerUpdate: true) with T3-managed OpenCode.
Ask the agent to run a long Cargo build with the native shell tool (background: true), register the shell ID using t3_background_wait, and end its turn without polling. Verify the wait tool returns the ID in matched.
While the build is still running and the agent's turn has completed, kill the T3 server with SIGKILL, then restart with the same data directory.
Observe whether a new agent turn starts without sending a message.
For a deterministic build, use a dependency-free Rust project with a build.rs containing fn main() { std::thread::sleep(std::time::Duration::from_secs(150)); } and run cargo build --offline --release.
Expected behavior
The interrupted awaited build is recorded as cancelled and the agent automatically receives a cancellation notification in a new turn. Intentionally detached shells should not wake a settled agent.
Actual behavior
The shell is cancelled and the continuation effect is scheduled and marked successful, but the agent stays idle. The shell appears in both turn items and the pending task roster. Recovery records the turn item first and deduplicates the roster entry, losing awaited: true in the cancellation record. The continuation handler then rejects it.
Related to closed #32829, but this failure occurs after explicit wait registration; shell tracking and cancellation work.
Impact
Major degradation or frequent failure
Version or commit
T3 Code 0.1.14-nightly.20261128.5372; also reproduced in a regression test on main at a7acbf5746825954e2b4f1e890fc12b80ec56fce.
Environment
Linux ARM64 (Debian), T3-managed OpenCode 2.4.2, opencode/hy4-flash-free.
Logs or stack traces
Observed state (summarized):
Before crash: run 1 completed; Cargo shell running; explicit wait matched; roster awaited=true.
After restart: shell cancelled; cancellation record omits awaited; continuation effect succeeded; run 2 never created.
Activity