fix(telemetry): sharpen Sentry signal for v2.1.0 residual defects (#498)

Follow-ups to the v2.1.0 Sentry telemetry overhaul, found by reviewing live release:2.1.0 events:

- error_code tag was empty because reportError read only the top-level err.code; add extractErrorCode() to walk the cause chain (pg SQLSTATE, node E-code, else first short code).
- InputValidationError from a tool's processV2 in the worker was logged as error_class=bug; classify it as expected for any source. Worker-side ZodError stays a bug (schema drift).
- AI dispatcher timeouts rejected with a bare Error, which the sanitizer scrubbed to a message-less "Error: Error"; reject with an operational SafeError (code "timeout") at both timeout sites.

Each fix written failing-test-first; affected and adjacent unit suites green plus full CI (integration + e2e).
This commit is contained in:
SnapOtter
2026-07-11 16:18:26 +08:00
committed by GitHub
parent b8c3700c15
commit b457596649
7 changed files with 165 additions and 7 deletions
+6 -2
View File
@@ -429,7 +429,9 @@ export class PythonDispatcher {
if (this.child && !this.child.killed) {
this.child.kill("SIGTERM");
}
rejectPromise(new Error("Python script timed out"));
rejectPromise(
new SafeError("Python script timed out", { kind: "operational", code: "timeout" }),
);
}, timeout);
const wrappedResolve = (result: { stdout: string; stderr: string }) => {
@@ -557,7 +559,9 @@ export class PythonDispatcher {
}
if (timedOut) {
rejectPromise(new Error("Python script timed out"));
rejectPromise(
new SafeError("Python script timed out", { kind: "operational", code: "timeout" }),
);
return;
}