Repository navigation
Conversation
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)
…ase-idle-delegated-sessions
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com
This branch has not been deployed
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.
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
ProviderSessionManagergives 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
- 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.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.