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(server): surface a missing workspace folder instead of a spawn er… · incognitojam/styal@34a1cb8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server
    • integration
      • providerService.integration.test.ts
    • src
      • orchestration/Layers
        • ProviderCommandReactor.test.ts
        • ProviderCommandReactor.ts
      • provider
        • Errors.ts
        • Layers
          • ProviderService.test.ts
          • ProviderService.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/integration/providerService.integration.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/integration/providerService.integration.test.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ const makeIntegrationFixture = (options?: { readonly analytics?: Layer.Layer<Ana
100100
Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers),
101101
).pipe(Layer.provide(SqlitePersistenceMemory));
102102

103-
const layer = makeProviderServiceLive().pipe(Layer.provide(shared));
103+
const layer = makeProviderServiceLive().pipe(
104+
Layer.provide(NodeServices.layer),
105+
Layer.provide(shared),
106+
);
104107

105108
return {
106109
cwd,
Collapse file

‎apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts
+58-2Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ import { afterEach, describe, expect, it, vi } from "vite-plus/test";
3939

4040
import { deriveServerPaths, ServerConfig } from "../../config.ts";
4141
import { TextGenerationError } from "@t3tools/contracts";
42-
import { ProviderAdapterRequestError } from "../../provider/Errors.ts";
42+
import {
43+
ProviderAdapterRequestError,
44+
ProviderWorkspaceMissingError,
45+
type ProviderServiceError,
46+
} from "../../provider/Errors.ts";
4347
import { OrchestrationEventStoreLive } from "../../persistence/Layers/OrchestrationEventStore.ts";
4448
import { OrchestrationCommandReceiptRepositoryLive } from "../../persistence/Layers/OrchestrationCommandReceipts.ts";
4549
import { SqlitePersistenceMemory } from "../../persistence/Layers/Sqlite.ts";
@@ -182,7 +186,7 @@ describe("ProviderCommandReactor", () => {
182186
readonly stopSessionEffect?: () => Effect.Effect<void, ProviderAdapterRequestError>;
183187
readonly startSessionEffect?: (
184188
session: ProviderSession,
185-
) => Effect.Effect<ProviderSession, ProviderAdapterRequestError>;
189+
) => Effect.Effect<ProviderSession, ProviderServiceError>;
186190
readonly tryHandlePromptCommandEffect?: ProviderAuthService["Service"]["tryHandlePromptCommand"];
187191
}) {
188192
const now = "2026-01-01T00:00:00.000Z";
@@ -1435,6 +1439,58 @@ describe("ProviderCommandReactor", () => {
14351439
}),
14361440
);
14371441

1442+
effectIt.effect("shows the missing workspace message without a provider stack trace", () =>
1443+
Effect.gen(function* () {
1444+
const attempted = yield* Deferred.make<void>();
1445+
const missingCwd = "/missing/project/worktree";
1446+
const missingWorkspace = new ProviderWorkspaceMissingError({
1447+
threadId: ThreadId.make("thread-1"),
1448+
cwd: missingCwd,
1449+
});
1450+
const harness = yield* Effect.promise(() =>
1451+
createHarness({
1452+
startSessionEffect: () =>
1453+
Deferred.succeed(attempted, undefined).pipe(
1454+
Effect.andThen(Effect.fail(missingWorkspace)),
1455+
),
1456+
}),
1457+
);
1458+
1459+
yield* harness.engine.dispatch({
1460+
type: "thread.turn.start",
1461+
commandId: CommandId.make("cmd-turn-start-missing-workspace"),
1462+
threadId: ThreadId.make("thread-1"),
1463+
message: {
1464+
messageId: asMessageId("user-message-missing-workspace"),
1465+
role: "user",
1466+
text: "continue",
1467+
attachments: [],
1468+
},
1469+
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
1470+
runtimeMode: "approval-required",
1471+
createdAt: "2026-01-01T00:00:00.000Z",
1472+
});
1473+
yield* Deferred.await(attempted);
1474+
yield* Effect.promise(() => harness.drain());
1475+
1476+
const thread = (yield* Effect.promise(() => harness.readModel())).threads.find(
1477+
(entry) => entry.id === ThreadId.make("thread-1"),
1478+
);
1479+
expect(thread?.session).toMatchObject({
1480+
status: "error",
1481+
activeTurnId: null,
1482+
lastError: missingWorkspace.message,
1483+
});
1484+
const failure = thread?.activities.find(
1485+
(activity) => activity.kind === "provider.turn.start.failed",
1486+
);
1487+
expect(failure?.payload).toMatchObject({ detail: missingWorkspace.message });
1488+
expect(harness.runtimeSessions).toEqual([]);
1489+
expect(harness.sendTurn).not.toHaveBeenCalled();
1490+
expect(yield* Effect.promise(() => harness.readPendingTurnStarts())).toEqual([]);
1491+
}),
1492+
);
1493+
14381494
effectIt.effect("settles a failed provider startup and allows a clean retry", () =>
14391495
Effect.gen(function* () {
14401496
let failStartup = true;
Collapse file

‎apps/server/src/orchestration/Layers/ProviderCommandReactor.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { increment, orchestrationEventsProcessedTotal } from "../../observabilit
3434
import {
3535
ProviderAdapterRequestError,
3636
ProviderAdapterValidationError,
37+
ProviderWorkspaceMissingError,
3738
} from "../../provider/Errors.ts";
3839
import type { ProviderServiceError } from "../../provider/Errors.ts";
3940
import { TextGeneration } from "../../textGeneration/TextGeneration.ts";
@@ -57,6 +58,7 @@ import { GitWorkflowService } from "../../git/GitWorkflowService.ts";
5758
import * as WorkspacePaths from "../../workspace/WorkspacePaths.ts";
5859
const isProviderAdapterRequestError = Schema.is(ProviderAdapterRequestError);
5960
const isProviderAdapterValidationError = Schema.is(ProviderAdapterValidationError);
61+
const isProviderWorkspaceMissingError = Schema.is(ProviderWorkspaceMissingError);
6062
const isProviderDriverKind = Schema.is(ProviderDriverKind);
6163

6264
type ProviderIntentEvent = Extract<
@@ -410,6 +412,9 @@ const make = Effect.gen(function* () {
410412
if (isProviderAdapterValidationError(failReason?.error)) {
411413
return failReason.error.issue;
412414
}
415+
if (isProviderWorkspaceMissingError(failReason?.error)) {
416+
return failReason.error.message;
417+
}
413418
return Cause.pretty(cause);
414419
};
415420

Collapse file

‎apps/server/src/provider/Errors.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/Errors.ts
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ export class ProviderAdapterProcessError extends Schema.TaggedErrorClass<Provide
8585
}
8686
}
8787

88+
/**
89+
* ProviderWorkspaceMissingError - The session's working directory no longer
90+
* exists on disk, so no provider process can start in it.
91+
*/
92+
export class ProviderWorkspaceMissingError extends Schema.TaggedErrorClass<ProviderWorkspaceMissingError>()(
93+
"ProviderWorkspaceMissingError",
94+
{
95+
threadId: Schema.String,
96+
cwd: Schema.String,
97+
},
98+
) {
99+
override get message(): string {
100+
return `This thread's workspace folder no longer exists or is not a directory: ${this.cwd}. Restore the folder at this path before retrying.`;
101+
}
102+
}
103+
88104
/**
89105
* ProviderValidationError - Invalid provider API input.
90106
*/
@@ -197,6 +213,7 @@ export type ProviderAdapterError =
197213
export type ProviderServiceError =
198214
| ProviderValidationError
199215
| ProviderUnsupportedError
216+
| ProviderWorkspaceMissingError
200217
| ProviderInstanceNotFoundError
201218
| ProviderSessionNotFoundError
202219
| ProviderSessionDirectoryPersistenceError

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.