Repository navigation
fix(server): include Claude version probe stderr in failure details #22878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import * as NodeUtil from "node:util"; | ||
| import { | ||
| type ClaudeSettings, | ||
| type ModelCapabilities, | ||
|
|
@@ -562,10 +563,19 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")( | |
| const version = versionProbe.success.value; | ||
| const parsedVersion = parseGenericCliVersion(`${version.stdout}\n${version.stderr}`); | ||
| if (version.code !== 0) { | ||
| const firstStderrLine = NodeUtil.stripVTControlCharacters(version.stderr) | ||
| .split(/\r?\n/) | ||
| .map((line) => line.trim().replace(/\s+/g, " ")) | ||
| .find((line) => line.length > 0); | ||
| const stderrExcerpt = | ||
| firstStderrLine && firstStderrLine.length > 512 | ||
| ? `${firstStderrLine.slice(0, 511)}…` | ||
| : firstStderrLine; | ||
| yield* Effect.logWarning("Claude Agent CLI version probe exited with a non-zero status.", { | ||
| exitCode: version.code, | ||
| stdoutLength: version.stdout.length, | ||
| stderrLength: version.stderr.length, | ||
| stderrExcerpt, | ||
| }); | ||
| return buildServerProvider({ | ||
| presentation: CLAUDE_PRESENTATION, | ||
|
|
@@ -577,7 +587,9 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")( | |
| version: parsedVersion, | ||
| status: "error", | ||
| auth: { status: "unknown" }, | ||
| message: "Claude Agent CLI is installed but failed to run.", | ||
| message: stderrExcerpt | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This puts arbitrary CLI stderr into the provider message (and Posted via Macroscope — Effect Service Conventions |
||
| ? `Claude Agent CLI is installed but failed to run. ${stderrExcerpt}` | ||
| : "Claude Agent CLI is installed but failed to run.", | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Do not publish arbitrary stderr in provider diagnostics.
If the first stderr line contains a credential or signed URL,
stderrExcerptcopies it into the warning log andprobe.message. Removing terminal controls and limiting the line to 512 characters does not remove that value. Keep the generic message for unknown output. If a known failure needs more detail, map it to fixed, safe diagnostic text.As per coding guidelines, log attributes must contain “no raw payloads, command arguments or output.” As per path instructions, diagnostic attributes “should not expose arbitrary command output or defect text.”
🤖 Prompt for AI Agents
Sources: Coding guidelines, Path instructions