Skip to content

Commit 19ed7d2

Browse files
anandgupta42claude
andcommitted
fix(telemetry): cut the error line at a backtick-quoted span
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 4db44b8 commit 19ed7d2

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/opencode/src/altimate/telemetry/error-detail.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ const isCredential = (token: string) =>
6262
* that happen to spell a SQL statement are not recognised and can survive.
6363
*/
6464
// The line is cut at the token holding the first of: a credential stem (also inside quotes or a
65-
// compound key), a path separator, or an escape. Everything from there on is masked, because a
65+
// compound key), a path separator, an escape, or a backtick-quoted span. Everything from there on is masked, because a
6666
// value, path or escaped string can run on past whitespace and quote boundaries.
67-
const CUT = new RegExp(`${CREDENTIAL_STEMS.join("|")}|[\\\\/]`, "i")
67+
const CUT = new RegExp(`${CREDENTIAL_STEMS.join("|")}|[\\\\/\x60]`, "i")
6868

6969
function cutAtUnsafe(line: string): string {
7070
const hit = CUT.exec(line)

‎packages/opencode/test/telemetry/error-detail.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe("templateErrorMessage", () => {
4444
["login failed password: supersecret", "login failed password: <x>"],
4545
["Authorization: Bearer secrettoken", "Authorization: <x>"],
4646
["bad api key hunter, retry", "bad api key <x>"],
47+
["unknown column `customer name` in field list", "unknown column <x>"],
4748
["bad /Users/bob/proj/a.ts here", "bad <x>"],
4849
["bad C:\\Users\\bob\\a.ts here", "bad <x>"],
4950
[`bad ${pgUri} here`, "bad <x>"],

0 commit comments

Comments
 (0)