Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): stop no longer hangs on an unresponsive Claude runtime #7349

Closednhorto(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/7349/headopened View on GitHub

Showing 2 changed files with 89 additions and 3 deletions.

x
0 of 2 viewed, 2 left
67 additions and 0 deletionsapps/server/src/provider/Layers/ClaudeAdapter.test.tsModified
View file
@@ -8,6 +8,7 @@
Options as ClaudeQueryOptions,
PermissionMode,
PermissionResult,
+ SDKControlGetContextUsageResponse,
SDKMessage,
SDKUserMessage,
} from "@anthropic-ai/claude-agent-sdk";
@@ -95,8 +96,21 @@
​
+ /** Simulates a wedged CLI: the control request is taken and never answered. */
+ public hangInterrupt = false;
+​
+ /**
+ * Left undefined by default so `queryCurrentContextUsage` short-circuits,
+ * matching the tests that predate context usage. Assigned per-test to cover
+ * the probe, including the wedged case where it never settles.
+ */
+ public getContextUsage?: () => Promise<SDKControlGetContextUsageResponse>;
+​
readonly interrupt = async (): Promise<void> => {
this.interruptCalls.push(undefined);
+ if (this.hangInterrupt) {
+ await new Promise<never>(() => {});
+ }
​