Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): bound Claude interrupt and close requests #17498

Closedconnwalk(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/17498/headopened View on GitHub

Showing 2 changed files with 139 additions and 6 deletions.

x
0 of 2 viewed, 2 left
112 additions and 1 deletionapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -2097,7 +2097,7 @@
const makeWakeHarnessWithOptions = (options?: {
readonly close?: (sdkMessages: Queue.Queue<SDKMessage>) => Effect.Effect<void>;
- readonly interrupt?: Effect.Effect<void>;
+ readonly interrupt?: Effect.Effect<void, ClaudeAdapterV2.ClaudeAgentSdkQueryRunnerError>;
readonly environment?: NodeJS.ProcessEnv;
// A CLI process opened after the first streams from its own queue, so the
// first one can exit (Queue.shutdown) and a later turn can start another.
@@ -2427,6 +2427,117 @@
+ it.effect.each(["hang", "error"] as const)(
+ "closes the query and permits another turn when Claude interrupt returns %s",
+ (behavior) =>
+ Effect.gen(function* () {
+ const interruptStarted = yield* Deferred.make<void>();
+ const queryClosed = yield* Deferred.make<void>();
+ const harness = yield* makeWakeHarnessWithOptions({
+ interrupt: Deferred.succeed(interruptStarted, undefined).pipe(
+ Effect.andThen(
+ behavior === "hang"
+ ? Effect.never
+ : Effect.fail(
+ new ClaudeAdapterV2.ClaudeAgentSdkQueryRunnerError({
+ method: "interrupt",
+ cause: new Error("Claude transport stopped responding"),
+ }),