fix(task-chat): keep a yielded reply after its card is answered

A run that posted a question card is waiting on that card. Once the card
was answered, the turn became an accepted response wake and the wait
summary replaced the agent's reply. Any non-suppressed card from the run
now keeps it out of the response-wake path.

Wait stubs in the backward scan are skipped, so a stub echoed after the
authored reply no longer hides it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 committed 2026-11-05 13:49:23 -06:00
1 parent b1ccf0f9bc
commit c134d72620
4 files changed
+40 -5

No files matched your search

@@ -1483,7 +1483,8 @@ export function paperclipRunnerFinalResponse(
// The wait itself is not an answer, but prose the agent wrote for the user
// before yielding (e.g. explaining the question card it just posted) is.
// It streamed into view while the turn was live; dropping it on settle
// makes the conversation flash and lose that reply.
// makes the conversation flash and lose that reply. Wait stubs are
// skipped, not terminal: a provider may echo one after its reply.
const waitSummaries = [
options?.waitSummary,
...yieldedResults.map((result) => result.summary),
@@ -1491,7 +1492,7 @@ export function paperclipRunnerFinalResponse(
for (let index = parsed.length - 1; index >= 0; index -= 1) {
const item = parsed[index];
if (item.kind !== "message" || item.channel !== "final") continue;
if (isYieldedWaitStub(item.text, waitSummaries)) return undefined;
if (isYieldedWaitStub(item.text, waitSummaries)) continue;
return item;
}
return undefined;