fix(coding-agent): bound refinement drain during disposal and extend session-replacement timeouts - #1205
Open
MingTeer wants to merge 1 commit into
Open
Conversation
…session-replacement timeouts fixes PrimeIntellect-ai#1190
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.
Summary
/new(daemonnew_sessioncommand),/resume(switch_session), andforkcan fail on the client with a false 30s timeout while the server is still draining in-flight continual-harness refinement during session disposal. The command actually succeeds server-side a few seconds later.Fixes #1190.
Changes
AgentSessionDisposeOptions.refineDrainBudgetMs); refinement is best-effort persistence, so abandoning it past the budget is preferable to stalling session replacement past client timeouts.runDueRefineOnDispose: false), so/new,/resume, and fork never trigger a fresh model call while leaving a session.new_session,switch_session, andforka dedicated 120s client timeout instead of the generic 30s default, so a slow-but-healthy replacement never surfaces as a false client-side failure.Tests
agent-connection-daemon.test.ts: replacement commands use the dedicated timeout.agent-session-runtime.test.ts: session replacement passesrunDueRefineOnDispose: false.agent-session-serialized-refine.test.ts: drain budget bounds in-flight refinement waits; due refinement is skipped on user-initiated disposal.Note
Bound refinement drain during session disposal and extend session-replacement timeouts
DEFAULT_REFINE_DISPOSE_DRAIN_BUDGET_MS) toAgentSession._drainPendingRefinementForDisposalso in-flight refinement cannot block teardown indefinitely; emits a refine-failed error if the budget is exhausted.AgentSessionDisposeOptionsto let callers skip due auto-refine on disposal; session replacement (viaAgentSessionRuntime.teardownCurrent) passes{ runDueRefineOnDispose: false }to avoid starting a fresh auto-refine during user-initiated teardown.new_session,switch_session, andforkrequests to 120s (DAEMON_SESSION_REPLACEMENT_TIMEOUT_MS) inDaemonAgentConnection, preventing false 30s timeout errors while the server drains refinement.Macroscope summarized 50653d4.