






















@@ -2069,6 +2069,17 @@ export async function runEmbeddedPiAgent(
20692069toolMediaUrls: attempt.toolMediaUrls,
20702070toolAudioAsVoice: attempt.toolAudioAsVoice,
20712071});
2072+const timedOutDuringPrompt =
2073+timedOut && !timedOutDuringCompaction && !timedOutDuringToolExecution;
2074+const hasPartialAssistantTextAfterPromptTimeout =
2075+timedOutDuringPrompt &&
2076+(attempt.assistantTexts ?? []).some((text) => text.trim().length > 0) &&
2077+!attempt.clientToolCalls &&
2078+!attempt.yieldDetected &&
2079+!attempt.didSendViaMessagingTool &&
2080+!attempt.didSendDeterministicApprovalPrompt &&
2081+!attempt.lastToolError &&
2082+(attempt.toolMetas?.length ?? 0) === 0;
20722083const attemptToolSummary = buildTraceToolSummary({
20732084toolMetas: attempt.toolMetas,
20742085hadFailure: Boolean(attempt.lastToolError),
@@ -2078,14 +2089,11 @@ export async function runEmbeddedPiAgent(
20782089lastToolError: attempt.lastToolError,
20792090});
208020912081-// Timeout aborts can leave the run without any assistant payloads.
2082-// Emit an explicit timeout error instead of silently completing, so
2083-// callers do not lose the turn as an orphaned user message.
2092+// Timeout aborts can leave the run without payloads or with only a
2093+// partial assistant fragment. Emit an explicit timeout error instead.
20842094if (
2085-timedOut &&
2086-!timedOutDuringCompaction &&
2087-!timedOutDuringToolExecution &&
2088-!payloadsWithToolMedia?.length
2095+timedOutDuringPrompt &&
2096+(!payloadsWithToolMedia?.length || hasPartialAssistantTextAfterPromptTimeout)
20892097) {
20902098const timeoutText = idleTimedOut
20912099 ? "The model did not produce a response before the model idle timeout. " +
@@ -2094,7 +2102,7 @@ export async function runEmbeddedPiAgent(
20942102"Please try again, or increase `agents.defaults.timeoutSeconds` in your config.";
20952103const replayInvalid = resolveReplayInvalidForAttempt(null);
20962104const livenessState = resolveRunLivenessState({
2097-payloadCount: payloads.length,
2105+payloadCount: hasPartialAssistantTextAfterPromptTimeout ? 0 : payloads.length,
20982106 aborted,
20992107 timedOut,
21002108 attempt,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。