Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- Preserve active ACP prompt correlation on async-result and trigger-turn continuations.
7 changes: 5 additions & 2 deletions packages/coding-agent/src/session/agent-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5597,12 +5597,14 @@ export class AgentSession {
void this.#queueFollowUpAfterReservation(message, displayText, {
createDisplayEntry: false,
trackExternalFollowUp: false,
sdkRunToken: this.#activeSdkRunToken,
}).catch(error => {
this.#settleDeliveredOwnedRegistrations([message]);
logger.warn("Owned streaming follow-up was rejected", { error: String(error) });
});
},
injectIdle: async (messages, signal) => {
const sdkRunToken = this.#activeSdkRunToken;
// Mandated boundary comment (corrected turn semantics): same origin
// split as the streaming injector — an allowed owned-completion
// delivery starts a fresh turn attempt/lineage and is not a
Expand Down Expand Up @@ -5637,14 +5639,14 @@ export class AgentSession {
await this.agent.prompt(first, {
...this.#managedFallbackPromptOptions(),
onRunAccepted: (handle: AttemptRunHandle) => {
if (handle) this.#acceptSdkAttemptRun(handle);
if (handle) this.#acceptSdkAttemptRun(handle, sdkRunToken);
},
});
} else {
await this.agent.prompt(survivors, {
...this.#managedFallbackPromptOptions(),
onRunAccepted: (handle: AttemptRunHandle) => {
if (handle) this.#acceptSdkAttemptRun(handle);
if (handle) this.#acceptSdkAttemptRun(handle, sdkRunToken);
},
});
}
Expand Down Expand Up @@ -15483,6 +15485,7 @@ export class AgentSession {
forceOneAtATime: options?.followUpQueuePolicy === "sequential",
createDisplayEntry: false,
trackExternalFollowUp: false,
sdkRunToken: this.#activeSdkRunToken,
});
this.#bindCustomDisplayEntry(appMessage, "followUp");
// The session can report streaming while no agent loop owns the queue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,6 @@ describe("AgentSession concurrent prompt guard", () => {
await hiddenTurn;
await firstPrompt;
await session.waitForIdle();

expect(callMessages).toHaveLength(2);
expect(
callMessages[1]?.some(message => {
Expand Down
Loading