fix(plugin-sdk): keep harness timeout flag optional

Keep the new attempt-result field optional for third-party harness compatibility while defaulting absent values at the runner boundary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Simon
2026-05-02 19:20:11 +05:30
committed by Ayaan Zaidi
parent 8996161e99
commit fbad17bf4f
2 changed files with 10 additions and 2 deletions

View File

@@ -1133,12 +1133,15 @@ export async function runEmbeddedPiAgent(
timedOut,
idleTimedOut,
timedOutDuringCompaction,
timedOutDuringToolExecution,
sessionIdUsed,
sessionFileUsed,
lastAssistant: sessionLastAssistant,
currentAttemptAssistant,
} = attempt;
// Field is optional in the public harness SDK contract; default to
// false here so internal code can rely on a strict boolean. Internal
// embedded-runner attempt sets this explicitly. See #52147.
const timedOutDuringToolExecution = attempt.timedOutDuringToolExecution ?? false;
if (sessionIdUsed && sessionIdUsed !== activeSessionId) {
activeSessionId = sessionIdUsed;
}

View File

@@ -62,8 +62,13 @@ export type EmbeddedRunAttemptResult = {
* True if the run-level timer fired while at least one tool execution was
* still in flight. The LLM had already responded; the timeout is unrelated
* to the primary model and must not trigger model fallback. Closes #52147.
*
* Optional for plugin-SDK back-compat: this type is re-exported as
* `AgentHarnessAttemptResult` and third-party harnesses cannot necessarily
* observe in-flight tool state. Treat absent as `false` at the runner
* boundary; internal embedded-runner code always sets it explicitly.
*/
timedOutDuringToolExecution: boolean;
timedOutDuringToolExecution?: boolean;
promptError: unknown;
/**
* Identifies which phase produced the promptError.