GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(claude): bound native history fork worker runtime · pingdotgg/t3code@aeee9df

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2/Adapters
    • ClaudeAdapterV2.test.ts
    • ClaudeAdapterV2.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+51Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
ThreadId,
3131
} from "@t3tools/contracts";
3232
import { assert, describe, it } from "@effect/vitest";
33+
import * as Clock from "effect/Clock";
3334
import * as Context from "effect/Context";
3435
import * as DateTime from "effect/DateTime";
3536
import * as Deferred from "effect/Deferred";
@@ -45,6 +46,8 @@ import * as Schema from "effect/Schema";
4546
import * as Scope from "effect/Scope";
4647
import * as Stream from "effect/Stream";
4748
import { Tool } from "effect/unstable/ai";
49+
import { TestClock } from "effect/testing";
50+
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
4851
import { formatClaudeResumeCompactionQuestion } from "@t3tools/shared/claudeCompaction";
4952
import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
5053
import { SpawnExecutableResolution } from "@t3tools/shared/shell";
@@ -1607,6 +1610,54 @@ describe("ClaudeAdapterV2 attachments", () => {
16071610
});
16081611

16091612
describe("ClaudeAdapterV2 native fork", () => {
1613+
it.effect("times out and terminates a stalled history worker", () =>
1614+
Effect.gen(function* () {
1615+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1616+
const spawned = yield* Deferred.make<ChildProcessSpawner.ChildProcessHandle>();
1617+
const stalledSpawner = {
1618+
...spawner,
1619+
spawn: () =>
1620+
Effect.gen(function* () {
1621+
const child = yield* spawner.spawn(
1622+
ChildProcess.make(process.execPath, ["-e", "setInterval(() => {}, 1000)"]),
1623+
);
1624+
yield* Deferred.succeed(spawned, child);
1625+
return child;
1626+
}),
1627+
};
1628+
const fork = yield* Effect.gen(function* () {
1629+
const runner = yield* ClaudeAdapterV2.ClaudeAgentSdkQueryRunner;
1630+
return yield* runner.forkSession({
1631+
environment: {},
1632+
sessionId: NodeCrypto.randomUUID(),
1633+
options: {},
1634+
threadId: ThreadId.make("fork-target"),
1635+
providerSessionId: ProviderSessionId.make("fork-session"),
1636+
});
1637+
}).pipe(
1638+
Effect.provide(ClaudeAdapterV2.claudeAgentSdkQueryRunnerLiveLayer),
1639+
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, stalledSpawner),
1640+
Effect.provide(
1641+
Layer.succeed(ProviderEventLoggers.ProviderEventLoggers, {
1642+
native: undefined,
1643+
canonical: undefined,
1644+
}),
1645+
),
1646+
Effect.forkChild,
1647+
);
1648+
const child = yield* Deferred.await(spawned);
1649+
yield* TestClock.adjust("30 seconds");
1650+
const error = yield* Fiber.join(fork).pipe(
1651+
Effect.flip,
1652+
Effect.timeout("2 seconds"),
1653+
Effect.provideService(Clock.Clock, Clock.Clock.defaultValue()),
1654+
);
1655+
assert.equal(error.method, "forkSession");
1656+
assert.include(String(error.cause), "Timeout");
1657+
assert.equal(yield* child.isRunning, false);
1658+
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
1659+
);
1660+
16101661
it.effect(
16111662
"forks history from the provider environment without changing the server environment",
16121663
() =>
Collapse file

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

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ export const claudeAgentSdkQueryRunnerLiveLayer: Layer.Layer<
791791
return yield* decodeForkSessionResult(stdout.text);
792792
}).pipe(
793793
Effect.scoped,
794+
Effect.timeout("30 seconds"),
794795
Effect.mapError((cause) => queryRunnerError(cause, "forkSession")),
795796
);
796797
yield* logProtocolEvent({

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.