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… · henrik092/t3code@4f07253

This repository was archived by the owner on Nov 2, 2026. It is now read-only.

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";
@@ -181,7 +185,7 @@ describe("ProviderCommandReactor", () => {
181185
readonly stopSessionEffect?: () => Effect.Effect<void, ProviderAdapterRequestError>;
182186
readonly startSessionEffect?: (
183187
session: ProviderSession,
184-
) => Effect.Effect<ProviderSession, ProviderAdapterRequestError>;
188+
) => Effect.Effect<ProviderSession, ProviderServiceError>;
185189
readonly tryHandlePromptCommandEffect?: ProviderAuthService["Service"]["tryHandlePromptCommand"];
186190
}) {
187191
const now = "2026-01-01T00:00:00.000Z";
@@ -1217,6 +1221,58 @@ describe("ProviderCommandReactor", () => {
12171221
}),
12181222
);
12191223

1224+
effectIt.effect("shows the missing workspace message without a provider stack trace", () =>
1225+
Effect.gen(function* () {
1226+
const attempted = yield* Deferred.make<void>();
1227+
const missingCwd = "/missing/project/worktree";
1228+
const missingWorkspace = new ProviderWorkspaceMissingError({
1229+
threadId: ThreadId.make("thread-1"),
1230+
cwd: missingCwd,
1231+
});
1232+
const harness = yield* Effect.promise(() =>
1233+
createHarness({
1234+
startSessionEffect: () =>
1235+
Deferred.succeed(attempted, undefined).pipe(
1236+
Effect.andThen(Effect.fail(missingWorkspace)),
1237+
),
1238+
}),
1239+
);
1240+
1241+
yield* harness.engine.dispatch({
1242+
type: "thread.turn.start",
1243+
commandId: CommandId.make("cmd-turn-start-missing-workspace"),
1244+
threadId: ThreadId.make("thread-1"),
1245+
message: {
1246+
messageId: asMessageId("user-message-missing-workspace"),
1247+
role: "user",
1248+
text: "continue",
1249+
attachments: [],
1250+
},
1251+
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
1252+
runtimeMode: "approval-required",
1253+
createdAt: "2026-01-01T00:00:00.000Z",
1254+
});
1255+
yield* Deferred.await(attempted);
1256+
yield* Effect.promise(() => harness.drain());
1257+
1258+
const thread = (yield* Effect.promise(() => harness.readModel())).threads.find(
1259+
(entry) => entry.id === ThreadId.make("thread-1"),
1260+
);
1261+
expect(thread?.session).toMatchObject({
1262+
status: "error",
1263+
activeTurnId: null,
1264+
lastError: missingWorkspace.message,
1265+
});
1266+
const failure = thread?.activities.find(
1267+
(activity) => activity.kind === "provider.turn.start.failed",
1268+
);
1269+
expect(failure?.payload).toMatchObject({ detail: missingWorkspace.message });
1270+
expect(harness.runtimeSessions).toEqual([]);
1271+
expect(harness.sendTurn).not.toHaveBeenCalled();
1272+
expect(yield* Effect.promise(() => harness.readPendingTurnStarts())).toEqual([]);
1273+
}),
1274+
);
1275+
12201276
effectIt.effect("settles a failed provider startup and allows a clean retry", () =>
12211277
Effect.gen(function* () {
12221278
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";
@@ -56,6 +57,7 @@ import { VcsStatusBroadcaster } from "../../vcs/VcsStatusBroadcaster.ts";
5657
import { GitWorkflowService } from "../../git/GitWorkflowService.ts";
5758
const isProviderAdapterRequestError = Schema.is(ProviderAdapterRequestError);
5859
const isProviderAdapterValidationError = Schema.is(ProviderAdapterValidationError);
60+
const isProviderWorkspaceMissingError = Schema.is(ProviderWorkspaceMissingError);
5961
const isProviderDriverKind = Schema.is(ProviderDriverKind);
6062

6163
type ProviderIntentEvent = Extract<
@@ -394,6 +396,9 @@ const make = Effect.gen(function* () {
394396
if (isProviderAdapterValidationError(failReason?.error)) {
395397
return failReason.error.issue;
396398
}
399+
if (isProviderWorkspaceMissingError(failReason?.error)) {
400+
return failReason.error.message;
401+
}
397402
return Cause.pretty(cause);
398403
};
399404

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.