Skip to content

Commit 617b685

Browse files
fix(agents): scope direct-text fallback to no_active_run/compacting wake failures
ClawSweeper review of #94656 flagged that the proactive direct-text fallback fired for every activeRequesterWakeFailed, which broke the existing Telegram requester-handoff test that uses reason=not_streaming and expects callGateway to be invoked. Scope the fallback to issue #92076's failure modes only — no_active_run and compacting. Other queue reasons (not_streaming, source_reply_delivery_mode_mismatch, transcript_commit_wait_unsupported, runtime_rejected) keep the existing requester-agent handoff path. No-op for the proactive fallback's behavior in issue #92076's scenario (no_active_run still triggers the direct-text path; compacting now does too). The standalone repro at scripts/repro/issue-92076-subagent-fallback.mts continues to pass.
1 parent 37ce11b commit 617b685

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/agents/subagent-announce-delivery.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,11 +1406,16 @@ async function sendSubagentAnnounceDirectly(params: {
14061406
wakeOutcome,
14071407
)}`,
14081408
);
1409-
// NEW: Try direct text delivery as proactive fallback before requester-agent handoff
1409+
// NEW: Try direct text delivery as proactive fallback before requester-agent handoff.
1410+
// Scope the fallback to #92076's failure modes (no_active_run / compacting) — other
1411+
// queue failures (not_streaming, source_reply_delivery_mode_mismatch,
1412+
// transcript_commit_wait_unsupported, runtime_rejected) keep the requester handoff.
1413+
const wakeFailureReason = wakeOutcome.reason;
14101414
if (
14111415
params.expectsCompletionMessage &&
14121416
deliveryTarget.deliver &&
1413-
isDirectMessageDeliveryTarget(deliveryTarget, canonicalRequesterSessionKey)
1417+
isDirectMessageDeliveryTarget(deliveryTarget, canonicalRequesterSessionKey) &&
1418+
(wakeFailureReason === "no_active_run" || wakeFailureReason === "compacting")
14141419
) {
14151420
defaultRuntime.log(`[info] Attempting direct text delivery (active wake failed)`);
14161421
const textDelivery = await deliverTextCompletionDirect({

0 commit comments

Comments
 (0)