Repository navigation
fix(server): steers on Claude threads no longer cancel running tool calls #35088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e037aa2
3353dd6
c0358f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10899,6 +10899,21 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* ( | |
| ); | ||
| return; | ||
| } | ||
| // Claude answers a steer it has not read yet as the next native turn, which echoes | ||
| // the steer. A result without echoes cannot prove that turn will come. | ||
| if ( | ||
| !interrupted && | ||
| context.pendingSteers.size > 0 && | ||
| claudeEchoedPromptUuids(message).length > 0 && | ||
| terminalStatusFromResult(message) === "completed" | ||
| ) { | ||
| context.steeredSegmentUsage.push(message.usage); | ||
| context.steeredLedgerUsage = addClaudeLedgerUsage( | ||
| context.steeredLedgerUsage, | ||
| resultLedgerUsage.get(message), | ||
| ); | ||
| return; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High When the steered turn returns its own result-only answer, - return;
+ context.assistant.fallbackText = "";
+ context.assistant.fallbackNativeItemId = null;
+ return;🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep each deferred segment's result-only reply. When the original reply arrives only as a result, Publish the pending fallback as that segment's reply before the deferral returns, then clear it. A steer reply can then set the fallback for its own segment. Replies that arrive with an assistant frame are not affected, because they already suppress the fallback at finalization.
|
||
| } | ||
| yield* Ref.update(steeredTurns, (current) => { | ||
| const next = new Set(current); | ||
| next.delete(context.providerTurnId); | ||
|
|
@@ -12529,7 +12544,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* ( | |
| ), | ||
| ); | ||
|
|
||
| // Move subagents to the background before priority "now" steers cancel foreground tools. | ||
| // Move subagents to the background so a steer reaches Claude without waiting for them to finish. | ||
| const backgroundForegroundSubagents = Effect.fnUntraced(function* ( | ||
| live: ClaudeLiveQueryContext, | ||
| deadline: number, | ||
|
|
@@ -12656,7 +12671,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* ( | |
| ).promptEffort, | ||
| ), | ||
| attachments: turnInput.message.attachments, | ||
| priority: "now", | ||
| // "now" makes Claude Code cancel the tool calls in flight and report them as a user refusal. | ||
| priority: "next", | ||
| uuid: steerUuid, | ||
| attachmentsDir, | ||
| fileSystem, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply the authentication failure hint when deciding whether to defer a result.
The deferral check at line 10908 computes the status without
context.authenticationFailureMessage. When anauthentication_failederror was already seen, an echoed success result withis_error: trueand noterminal_reasonyields"completed". The deferral block then returns beforefinalizeActiveTurn, so the authentication failure is not recorded from that result. The turn stays active until a later result arrives or the session ends.Pass the recorded hint into the check, so the same result is classified as
"failed"and falls through to finalization:Suggested fix
Successful results without an authentication failure keep their current status, so the deferral behavior for other steered turns is unchanged.
Committable suggestion