diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index f5f3d1fd..82c4ec5a 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -10,7 +10,6 @@ ### Fixed - Fixed startup model selection to skip unauthenticated saved defaults so configured local custom models can be selected instead ([#6231](https://github.com/earendil-works/pi/issues/6231)). -- Fixed Escape aborts to clear runs stuck in extension context hooks that ignore abort signals ([#6234](https://github.com/earendil-works/pi/issues/6234)). - Fixed the question extension example to run question tool calls sequentially so multiple questions in one assistant turn remain answerable ([#6189](https://github.com/earendil-works/pi/issues/6189)). - Fixed `/login` to report auth storage persistence failures instead of claiming credentials were saved when `auth.json` is locked ([#6223](https://github.com/earendil-works/pi/issues/6223)). - Fixed split-turn compaction to serialize summary requests so single-concurrency local providers do not fail with 429 errors ([#5536](https://github.com/earendil-works/pi/issues/5536)). diff --git a/packages/coding-agent/src/core/extensions/runner.ts b/packages/coding-agent/src/core/extensions/runner.ts index c05d61bc..2a699a7d 100644 --- a/packages/coding-agent/src/core/extensions/runner.ts +++ b/packages/coding-agent/src/core/extensions/runner.ts @@ -115,25 +115,6 @@ interface BeforeAgentStartCombinedResult { systemPrompt?: string; } -async function callContextHandlerAbortable(fn: () => Promise | T, signal: AbortSignal): Promise { - if (signal.aborted) { - throw new Error("Agent run aborted"); - } - - let cleanup = () => {}; - const abortPromise = new Promise((_resolve, reject) => { - const onAbort = () => reject(new Error("Agent run aborted")); - signal.addEventListener("abort", onAbort, { once: true }); - cleanup = () => signal.removeEventListener("abort", onAbort); - }); - - try { - return await Promise.race([Promise.resolve().then(fn), abortPromise]); - } finally { - cleanup(); - } -} - /** * Events handled by the generic emit() method. * Events with dedicated emitXxx() methods are excluded for stronger type safety. @@ -945,7 +926,6 @@ export class ExtensionRunner { async emitContext(messages: AgentMessage[]): Promise { const ctx = this.createContext(); - const signal = ctx.signal; let currentMessages = structuredClone(messages); for (const ext of this.extensions) { @@ -955,17 +935,12 @@ export class ExtensionRunner { for (const handler of handlers) { try { const event: ContextEvent = { type: "context", messages: currentMessages }; - const handlerResult = signal - ? await callContextHandlerAbortable(() => handler(event, ctx), signal) - : await handler(event, ctx); + const handlerResult = await handler(event, ctx); if (handlerResult && (handlerResult as ContextEventResult).messages) { currentMessages = (handlerResult as ContextEventResult).messages!; } } catch (err) { - if (signal?.aborted) { - throw err; - } const message = err instanceof Error ? err.message : String(err); const stack = err instanceof Error ? err.stack : undefined; this.emitError({