Skip to content

Commit bb1d152

Browse files
Gourav224claude
andcommitted
test(server): a Claude turn start fails with the MCP registration timeout as its cause
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent f31c4d5 commit bb1d152

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11017,6 +11017,68 @@ describe("ClaudeAdapterV2 background wake turns", () => {
1101711017
),
1101811018
);
1101911019

11020+
it.effect("fails a turn start with the MCP registration timeout as its cause", () =>
11021+
Effect.scoped(
11022+
Effect.gen(function* () {
11023+
const fileSystem = yield* FileSystem.FileSystem;
11024+
const idAllocator = yield* IdAllocator.IdAllocatorV2;
11025+
const attachmentsDir = yield* fileSystem.makeTempDirectoryScoped({
11026+
prefix: "t3-claude-v2-mcp-timeout-start-",
11027+
});
11028+
const adapter = yield* ClaudeAdapterV2.makeClaudeAdapterV2({
11029+
instanceId: ClaudeAdapterV2.CLAUDE_DEFAULT_INSTANCE_ID,
11030+
settings: DEFAULT_CLAUDE_SETTINGS,
11031+
environment: {},
11032+
attachmentsDir,
11033+
fileSystem,
11034+
path: yield* Path.Path,
11035+
crypto: yield* Crypto.Crypto,
11036+
idAllocator,
11037+
continuationRequests: { offer: () => Effect.void },
11038+
queryRunner: {
11039+
allocateSessionId: Effect.succeed(WAKE_NATIVE_SESSION),
11040+
open: () => Effect.fail(new ClaudeAdapterV2.ClaudeMcpRegistrationTimeoutError()),
11041+
forkSession: () => Effect.die("unused forkSession"),
11042+
subagentLaunchToolUseId: () => Effect.succeed(null),
11043+
assertComplete: Effect.void,
11044+
},
11045+
});
11046+
const threadId = ThreadId.make("thread-claude-mcp-timeout-start");
11047+
const runtime = yield* adapter.openSession({
11048+
threadId,
11049+
providerSessionId: ProviderSessionId.make("provider-session-claude-mcp-timeout-start"),
11050+
modelSelection: CLAUDE_TEST_MODEL_SELECTION,
11051+
runtimePolicy: CLAUDE_TEST_RUNTIME_POLICY,
11052+
});
11053+
const providerThread = yield* runtime.ensureThread({
11054+
threadId,
11055+
modelSelection: CLAUDE_TEST_MODEL_SELECTION,
11056+
runtimePolicy: CLAUDE_TEST_RUNTIME_POLICY,
11057+
});
11058+
11059+
// The turn service restores the unsent handoff marker by finding this tag in the cause chain.
11060+
const failure = yield* runtime
11061+
.startTurn(
11062+
makeClaudeTestTurnInput({
11063+
threadId,
11064+
providerThread,
11065+
now: yield* DateTime.now,
11066+
attemptId: RunAttemptId.make("attempt-claude-mcp-timeout-start"),
11067+
text: "Hello",
11068+
attachments: [],
11069+
}),
11070+
)
11071+
.pipe(Effect.flip);
11072+
assert.equal(failure._tag, "ProviderAdapterTurnStartError");
11073+
assert.instanceOf(failure.cause, ClaudeAdapterV2.ClaudeMcpRegistrationTimeoutError);
11074+
}).pipe(
11075+
Effect.provide(
11076+
Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer),
11077+
),
11078+
),
11079+
),
11080+
);
11081+
1102011082
it.effect(
1102111083
"keeps the process and its roster when a model change meets a running background shell",
1102211084
() =>

0 commit comments

Comments
 (0)