@devries-cameron20 / t3code Mirror · read-only / commits / 00d1a828ab
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 22, 03:15 UTC

fix(client-runtime): sanitized error stacks keep line and column for URLs with a query (#30726)

Co-authored-by: Geezy <igor.licko@gloryck.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

TheGuyWithHAT committed Nov 6, 2026 at 05:38 UTC 00d1a828aba57ee9ce0195277f2fe950658130c7
2 files changed +10 -2
packages/client-runtime/src/errors/safeLog.test.ts
+7 -1
@@ -13,6 +13,8 @@ describe("safeErrorLogAttributes", () => {
13 error.stack = [
14 "ProjectRemovalError: outer-error-secret-sentinel",
15 " at removeProject (https://user:password@example.com/project.ts?token=secret#fragment)",
16 + " at loadSettings (http://localhost:5173/src/useSettings.ts?t=1730700000000:162:7)",
17 + "removeAll@https://example.com/app.js?token=secret:12:5",
18 ].join("\n");
19
20 const attributes = safeErrorLogAttributes(error);
@@ -22,7 +24,11 @@ describe("safeErrorLogAttributes", () => {
24 errorName: "Error",
25 errorTag: "ProjectRemovalError",
26 traceId: "trace-safe-123",
25 - stack: " at removeProject (https://example.com/project.ts)",
27 + stack: [
28 + " at removeProject (https://example.com/project.ts)",
29 + " at loadSettings (http://localhost:5173/src/useSettings.ts:162:7)",
30 + "removeAll@https://example.com/app.js:12:5",
31 + ].join("\n"),
32 });
33 const diagnosticText = Object.values(attributes).map(String).join("\n");
34 expect(diagnosticText).not.toContain("outer-error-secret-sentinel");
packages/client-runtime/src/errors/safeLog.ts
+3 -1
@@ -18,11 +18,13 @@ function readSafeLabel(value: unknown): string | undefined {
18 function sanitizeStackUrl(value: string): string {
19 try {
20 const url = new URL(value);
21 + // A frame's trailing :line:column parses as part of the query or fragment when one is present.
22 + const position = /(?::\d+){1,2}$/.exec(url.hash || url.search)?.[0] ?? "";
23 url.username = "";
24 url.password = "";
25 url.search = "";
26 url.hash = "";
25 - return url.toString();
27 + return url.toString() + position;
28 } catch {
29 return value;
30 }