@devries-cameron20 / t3code Mirror · read-only / commits / 6155f5cf64
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 21:30 UTC

[codex] Preserve VCS project config error causes (#3474)

Co-authored-by: codex <codex@users.noreply.github.com>

Julius Marminge committed Jun 20, 2026 at 20:20 UTC 6155f5cf64e9f26d10f3c912985f8ca09f9c3fef
2 files changed +28 -22
apps/server/src/vcs/VcsProjectConfig.test.ts
+20 -15
@@ -96,16 +96,19 @@ describe("VcsProjectConfig", () => {
96 const kind = yield* config.resolveKind({ cwd });
97
98 assert.equal(kind, "jj");
99 - const [message, context] = messages[0] as [string, Record<string, unknown>];
99 const failedCandidate = path.join(cwd, ".t3code", "vcs.json");
101 - assert.equal(message, "Failed to inspect VCS project config at " + failedCandidate + ".");
102 - assert.deepInclude(context, {
100 + const [error] = messages[0] as ReadonlyArray<unknown>;
101 + assert.instanceOf(error, VcsProjectConfig.VcsProjectConfigError);
102 + assert.equal(
103 + error.message,
104 + "Failed to inspect VCS project config at " + failedCandidate + ".",
105 + );
106 + assert.deepInclude(error, {
107 operation: "inspect",
108 cwd,
109 configPath: failedCandidate,
106 - errorTag: "VcsProjectConfigError",
110 + _tag: "VcsProjectConfigError",
111 });
108 - assert.equal("cause" in context, false);
112 }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false })));
113 });
114 });
@@ -146,18 +149,19 @@ describe("VcsProjectConfig", () => {
149 const kind = yield* config.resolveKind({ cwd: root });
150
151 assert.equal(kind, "auto");
149 - const [message, context] = messages[0] as [string, Record<string, unknown>];
152 + const [error] = messages[0] as ReadonlyArray<unknown>;
153 + assert.instanceOf(error, VcsProjectConfig.VcsProjectConfigError);
154 assert.equal(
151 - message,
155 + error.message,
156 "Failed to decode VCS project config at " + path.join(configDir, "vcs.json") + ".",
157 );
154 - assert.deepInclude(context, {
158 + assert.deepInclude(error.cause, { _tag: "SchemaError" });
159 + assert.deepInclude(error, {
160 operation: "decode",
161 cwd: root,
162 configPath: path.join(configDir, "vcs.json"),
158 - errorTag: "VcsProjectConfigError",
163 + _tag: "VcsProjectConfigError",
164 });
160 - assert.equal("cause" in context, false);
165 }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false })));
166 });
167 });
@@ -182,15 +186,16 @@ describe("VcsProjectConfig", () => {
186 const kind = yield* config.resolveKind({ cwd: root });
187
188 assert.equal(kind, "auto");
185 - const [message, context] = messages[0] as [string, Record<string, unknown>];
186 - assert.equal(message, "Failed to read VCS project config at " + configPath + ".");
187 - assert.deepInclude(context, {
189 + const [error] = messages[0] as ReadonlyArray<unknown>;
190 + assert.instanceOf(error, VcsProjectConfig.VcsProjectConfigError);
191 + assert.equal(error.message, "Failed to read VCS project config at " + configPath + ".");
192 + assert.deepInclude(error.cause, { _tag: "PlatformError" });
193 + assert.deepInclude(error, {
194 operation: "read",
195 cwd: root,
196 configPath,
191 - errorTag: "VcsProjectConfigError",
197 + _tag: "VcsProjectConfigError",
198 });
193 - assert.equal("cause" in context, false);
199 }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false })));
200 });
201 });
apps/server/src/vcs/VcsProjectConfig.ts
+8 -7
@@ -55,13 +55,14 @@ function configuredKind(config: ProjectVcsConfigFile): VcsDriverKindType | "auto
55 }
56
57 const logVcsProjectConfigError = (error: VcsProjectConfigError) =>
58 - Effect.logWarning(error.message, {
59 - operation: error.operation,
60 - cwd: error.cwd,
61 - configPath: error.configPath,
62 - errorTag: error._tag,
63 - stack: error.stack,
64 - });
58 + Effect.logWarning(error).pipe(
59 + Effect.annotateLogs({
60 + operation: error.operation,
61 + cwd: error.cwd,
62 + configPath: error.configPath,
63 + errorTag: error._tag,
64 + }),
65 + );
66
67 export const make = Effect.gen(function* () {
68 const fileSystem = yield* FileSystem.FileSystem;