fix(server): pin the Claude CLI verbose setting for text generation - #7735
fix(server): pin the Claude CLI verbose setting for text generation#7735sti0 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Text generation through the Claude CLI failed silently whenever a
user- or project-level `verbose` setting was enabled: `claude -p
--output-format json` then prints an array of stream events instead of
the flat `{ structured_output }` envelope the decoder expects. The
resulting `SchemaError` was swallowed as a log warning, so thread
titles, worktree branch names, commit messages and PR bodies fell back
to their placeholders (`t3code/<hex>`) forever.
`settings` now always carries `verbose: false`, which also means the
`--settings` payload goes out on every call instead of only when
thinking, fastMode or ultracode are set. Measured against Claude CLI
2.1.233, `--settings` beats both user and project settings, so no
tolerant parsing of the event array is needed. A test pins the
assumption: streamed events must fail loudly.
f581de8 to
44a4a61
Compare
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Small defensive bug fix that pins You can add or adjust custom eligibility rules. Learn more. |
What Changed
makeClaudeTextGenerationnow always setsverbose: falsein thesettingsobject it passes to--settings. Because the key is always present, the--settingspayload now goes out on every call instead of only whenthinking,fastModeorultracodeare set. Those three are otherwise untouched.Tests: a new case for the pinned
--settings {"verbose":false}with no other settings, a new case proving that streamed events fail loudly, and the existing fixtures'--settingsexpectations extended byverbose.Three added lines of production code, the rest is tests.
Why
Text generation through the Claude CLI fails silently whenever the user has
verboseenabled in their Claude settings. Withverboseon,claude -p --output-format jsonprints an array of stream events instead of the flat{ structured_output }envelope the decoder expects, so decoding dies withSchemaError: Expected object, wrapped inTextGenerationError: Claude CLI returned unexpected output format.That error is only ever swallowed as a log warning, so nothing surfaces to the user. Thread titles, worktree branch names, commit messages and PR bodies just keep falling back to their placeholders (
t3code/<hex>), permanently, with no indication why.Pinning the setting is enough — no tolerant parsing of the event array is needed. Measured against Claude CLI 2.1.233,
--settingsbeats both the user-level and the project-level settings:verbose: true)--settings[{"type":"system",…— array--settings {"verbose":false}{"is_error":false,…— flat objectThe second test holds that assumption in place: if the CLI ever streams events despite the pinned setting, it fails loudly instead of silently.
Other providers are unaffected — Codex, Cursor, Grok and OpenCode parse the response text straight against the output schema, without an envelope.
Checklist
Claude Opus 5 via Claude Code.
Created with AI assistance (Claude), reviewed by Timo.
Note
Low Risk
Small, localized CLI settings override for Claude text generation only; no auth, data, or provider-contract changes.
Overview
Stops Claude text generation from breaking when the user has CLI
verboseenabled. User-level verbose madeclaude -p --output-format jsonemit a stream-event array instead of the{ structured_output }envelope, so titles, branch names, commit messages, and PR bodies silently fell back to placeholders.runClaudeJsonnow always includesverbose: falsein--settings, so that flag is sent on every Claude CLI call (not only when thinking/fastMode/ultracode are set). Tests cover the always-on settings payload and fail loudly if the CLI still streams events.Reviewed by Cursor Bugbot for commit 44a4a61. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Pin
verbose:falsein Claude CLI--settingsfor text generationverbose:falsein the settings object before merging optional flags, so--settingsis always passed to the Claude CLI.verbose:falsein the settings JSON and adds a new test verifying--settings {"verbose":false}is sent even when no other settings are specified.TextGenerationErrorcontaining 'unexpected output format'.--settingswith at least{"verbose":false}, whereas previously--settingscould be omitted when no optional flags were set.Macroscope summarized 44a4a61.