Skip to content

fix(server): keep OpenCode sessions alive while child sessions run - #63

Closed
macodev00 wants to merge 1 commit into
mainfrom
cursor/opencode-child-liveness-redo2-effb
Closed

macodev00 wants to merge 1 commit into
mainfrom
cursor/opencode-child-liveness-redo2-effb

Conversation

@macodev00

Copy link
Copy Markdown
Owner

What Changed

Related OpenCode child session.status is quiet liveness for the provider-session reaper. The tracker is an Effect service (OpenCodeChildSessionLiveness) provided once per server runtime. The OpenCode adapter and the reaper both yield* that service.

busy and retry hold that thread's binding. idle, deletion, and session teardown release the child. While any related child is still live, an inactivity sweep leaves the OpenCode session running and does not move the idle clock. The next sweep can reap once the last child is gone. Other providers are unchanged.

The map lives in the service instance for that runtime. A second runtime, test, or isolated layer cannot see another runtime's holds.

Why

Fixes pingdotgg#13514

On a headless OpenCode session, long-running background subagents keep the provider process busy after the parent turn settles. They do not emit task.* events, so the reaper treated that silence as inactivity and stopped the session with inactivity_threshold, which cancels the tracked children.

The hold stays inside the reaper. Task activity is unchanged, so the sidebar liveness pill, thread settlement, and storage cleanup keep their existing task-event behavior.

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
Open in Web Open in Cursor 

OpenCode background subagents stay busy after the parent turn settles, but
they never emit task events, so the reaper treated the thread as idle and
stopped the provider session.

Related child session.status is now quiet liveness for that reaper check.
The tracker is an Effect service built with the runtime, so each runtime
has its own map. busy and retry hold the session; idle, deletion, and
teardown release it. The signal stays inside the reaper and leaves task
activity unchanged.

Fixes pingdotgg#13514
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 28, 2026
@macodev00

Copy link
Copy Markdown
Owner Author

Opened upstream.

@macodev00 macodev00 closed this Sep 28, 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)

1 participant