From fbad17bf4f336a5afbbc6aa06c0263bfadf79e41 Mon Sep 17 00:00:00 2001 From: Simon <178938782+simonusa@users.noreply.github.com> Date: Sat, 2 May 2026 19:20:11 +0530 Subject: [PATCH] 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) --- src/agents/pi-embedded-runner/run.ts | 5 ++++- src/agents/pi-embedded-runner/run/types.ts | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/agents/pi-embedded-runner/run.ts b/src/agents/pi-embedded-runner/run.ts index 208c76fee48..4a3032ba5eb 100644 --- a/src/agents/pi-embedded-runner/run.ts +++ b/src/agents/pi-embedded-runner/run.ts @@ -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; } diff --git a/src/agents/pi-embedded-runner/run/types.ts b/src/agents/pi-embedded-runner/run/types.ts index 81c850eecdf..20cd456ac1c 100644 --- a/src/agents/pi-embedded-runner/run/types.ts +++ b/src/agents/pi-embedded-runner/run/types.ts @@ -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.