Skip to content

fix(server): keep OpenCode sessions alive while background subagents run - #52

Closed
macodev00 wants to merge 1 commit into
mainfrom
cursor/opencode-child-session-liveness-ac6e
Closed

macodev00 wants to merge 1 commit into
mainfrom
cursor/opencode-child-session-liveness-ac6e

Conversation

@macodev00

@macodev00 macodev00 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

What Changed

Related OpenCode child session.status now feeds the existing background-liveness registry. busy and retry record a live task; idle clears that child. The session reaper is unchanged and already skips a thread while backgroundLiveness is set.

Why

Fixes pingdotgg#13514

On a headless OpenCode session, long-running background subagents keep the provider busy after the parent turn settles, but they never emit task.* events. The reaper measured only user-facing activity and stopped the session with inactivity_threshold, aborting in-flight work. Child status is the signal that this work is still live. Completion notifications on the parent do not move the idle clock, so they are not used.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

No UI changes.

Open in Web Open in Cursor 

OpenCode background subagents stay busy after the parent turn settles, but
they never emit task lifecycle events. The reaper therefore treats the
thread as idle and stops the provider session.

Related child session.status of busy or retry now records a live task, and
idle clears it. The existing background-liveness guard skips the reap while
that work is running.

Fixes pingdotgg#13514

Co-authored-by: maco <macodev00@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 27, 2026
@macodev00 macodev00 closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: session reaper counts opencode background agents activity as idle time on remote connection (headless)

2 participants