Skip to content

fix(server): release idle delegated worker sessions after five minutes - #10

Draft
jhomra21 wants to merge 6 commits into
mainfrom
fix/release-idle-delegated-sessions
Draft

jhomra21 wants to merge 6 commits into
mainfrom
fix/release-idle-delegated-sessions

Conversation

@jhomra21

@jhomra21 jhomra21 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Problem

Every idle provider session stays open for 30 minutes, including a delegated worker's session after it finishes. An agent that delegates often keeps several finished worker processes running at once, each for up to half an hour.

Change

ProviderSessionManager gives local subagent threads and remotely delegated threads a five-minute idle timeout. It caches the timeout per attached thread and uses the longest one for a shared session, so a session that a user thread also uses keeps the 30-minute window. The existing guards still apply: a busy turn or pending background work keeps a session open. The pin recheck uses the session's timeout.

Scope and approval

This only changes server-side cleanup of delegated sessions and its tests. It decides by subagent lineage and remote delegation, not by provider.

Verification

  • vp env exec --node 26.12.1 -- vp test run apps/server/src/orchestration-v2/ProviderSessionManager.test.ts: 53 passed. New TestClock cases cover local and remote children, ordinary threads, forks, shared sessions, pin expiry and reopening a released session.
  • vp env exec --node 26.12.1 -- vp run check:changed: format, lint, knip, GraphQL and typecheck passed. Its tests had the same 10 upstream failures that expect Linux paths and services.
  • Not checked: a live run counting provider processes before and after.
Upstream preparation by GPT-6 Luna, orchestrated by Claude Opus 5.5, through Factory Droid in T3 Code.

jhomra21 and others added 3 commits October 29, 2026 19:27
Cache idle windows from local subagent lineage or remote delegation metadata when threads attach. Shared sessions retain the user window while a user thread is attached; busy guards and background-work pinning stay unchanged.

Add TestClock regressions for local and remote children, user and fork threads, mixed sessions, pin expiry, and reopening released sessions.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
(cherry picked from commit 2a7f5f0)
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Oct 30, 2026
@jhomra21 jhomra21 changed the title fix(server): release idle delegated worker sessions sooner fix(web): show a subagent's reported effort in its hover card Oct 30, 2026
@jhomra21 jhomra21 changed the title fix(web): show a subagent's reported effort in its hover card fix(server): release idle delegated worker sessions after five minutes Oct 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 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.

1 participant