fix(acp): keep the session alive for commands still running when the post-settle hold expires #41701
OpenBluePlexus(GitHub profile, opens in a new tab)wants to merge 12 commits into
main fromrefs/pull/41701/headopened View on GitHubPushedf68fe44
- @@ -10313,3 +10348,4 @@1031310348 if ((yield* Ref.get(midTurnUnreportedCompletedTaskIds)).size > 0) return true;1031410349 if (yield* Ref.get(continuationRequested)) return true;1031510350 if ((yield* Ref.get(runningBackgroundTaskIds)).size > 0) return true;10351+ if (expiredHoldCommandIds.size > 0) return true;
Pushede5baf7b
- @@ -1663,3 +1663,8 @@16631663 : yield* probedRuntime.hasPendingBackgroundWork.pipe(16641664 Effect.catchCause(() => Effect.succeed(false)),16651665 )) ||1666+ (probedRuntime.keepsIdleSessionAlive === undefined1667+ ? false1668+ : yield* probedRuntime.keepsIdleSessionAlive.pipe(1669+ Effect.catchCause(() => Effect.succeed(false)),1670+ )) ||
juliusmarminge added labelstakeover:blocked
juliusmarminge removed labelstakeover:in-progress
github-actions[bot](GitHub profile, opens in a new tab) added labelsneeds-rebase
Pushed47979bd
- @@ -8048,3 +8051,7 @@80488051 yield* markSessionCompacted(normalized.sessionId, normalized.update.compactionId);80498052 }80508053 yield* handleSessionUpdate(normalized);8054+ const update = normalized.update;8055+ if (8056+ (update.sessionUpdate === "tool_call" ||8057+ update.sessionUpdate === "tool_call_update") &&
- @@ -8048,3 +8051,21 @@80488051 yield* markSessionCompacted(normalized.sessionId, normalized.update.compactionId);80498052 }80508053 yield* handleSessionUpdate(normalized);8054+ const update = normalized.update;8055+ if (8056+ (update.sessionUpdate === "tool_call" ||8057+ update.sessionUpdate === "tool_call_update") &&8058+ (update.status === "completed" ||8059+ update.status === "failed" ||8060+ update.status === "cancelled")8061+ ) {8062+ expiredHoldCommandIds.delete(8063+ sessionScopedId(normalized.sessionId, update.toolCallId),8064+ );8065+ }8066+ // A terminal-only command's pin is its synthetic tool; a linked tool clears its own.8067+ if (update.sessionUpdate === "terminal_update") {8068+ const terminalKey = sessionScopedId(normalized.sessionId, update.terminalId);8069+ if (8070+ agentTerminalsById.get(terminalKey)?.exitStatus !== undefined &&8071+ !(toolCallIdsByAgentTerminalId.get(terminalKey)?.size ?? 0)
Sign in to join this conversation.
Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
Walkthrough
The runtime contract adds an optional idle keep-alive effect. The session manager checks it during idle release. The ACP adapter tracks commands after post-settle hold expiry, reports whether holds remain, and clears them on command or runtime lifecycle updates.
Changes: Idle session command tracking
packages/provider-core/src/server/ProviderAdapter.ts,apps/server/src/orchestration-v2/ProviderSessionManager.ts,apps/server/src/orchestration-v2/ProviderSessionManager.test.tskeepsIdleSessionAliveeffect. The session manager checks it during idle release, and tests verify that the session remains alive within the idle-pin budget.packages/provider-acp/src/server/adapter.ts,apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.tsEstimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)#
Possibly related issues
Suggested reviewers:
lokkuchakreshkumar,juliusmarmingeMerge Risk:
Low · previous review
9c8feLong-running commands now keep the agent session alive past the post-settle hold. A narrow idle-release race could still close the runtime just before the follow-up result is delivered, and an already-exited terminal command could keep a session pinned until the idle-pin budget expires. Both are limited in scope and recoverable, so the change is mergeable with owner awareness.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the fix (keeping the session alive for commands still running when the post-settle hold expires) and the area (acp). It matches the main change in the adapter and session manager. It is specific and follows the conventional commit form.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections, and each is filled in with specific detail. The Problem section gives the reproduction context and cause. The Change section explains the fix and the components touched. The Scope section links the issue, states the limits, and names related PRs. The Verification section gives live results, test names, pass/fail evidence on base, and items not checked. It also names the model and harness that did the work, as the template asks. The description does not link a maintainer request, but the template only requires that when one exists.
Finishing Touches
Generate unit tests (beta)