Skip to content

ai: recover CLI report envelopes with literal control characters - #906

Merged
rgushchin merged 1 commit into
sashiko-dev:mainfrom
arighi:fix-cli-report-envelopes
Nov 16, 2026
Merged

rgushchin merged 1 commit into
sashiko-dev:mainfrom
arighi:fix-cli-report-envelopes

Conversation

@arighi

@arighi arighi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

CLI providers request a JSON content envelope even when a report stage needs plain text. Models can leave literal tabs or newlines inside that string. Strict parsing then returns the raw wrapper, making an otherwise usable report fail plain-text validation.

Reuse the existing control-character normalizer only for an otherwise invalid, single-field string content object. Preserve the decoded report exactly and leave malformed tool calls and structural errors on their existing paths. Clarify the envelope instructions and log expected raw-text fallback at debug level.

Include the design and regression coverage for fenced report recovery, preserved inner fences, and rejection of malformed envelopes and arrays.

Fixes: 9cccc05 ("feat: add claude-cli provider for Claude Code subscription auth")

CLI providers request a JSON content envelope even when a report stage
needs plain text. Models can leave literal tabs or newlines inside that
string. Strict parsing then returns the raw wrapper, making an otherwise
usable report fail plain-text validation.

Reuse the existing control-character normalizer only for an otherwise
invalid, single-field string content object. Preserve the decoded report
exactly and leave malformed tool calls and structural errors on their
existing paths. Clarify the envelope instructions and log expected
raw-text fallback at debug level.

Include the design and regression coverage for fenced report recovery,
preserved inner fences, and rejection of malformed envelopes and arrays.

Fixes: 9cccc05 ("feat: add claude-cli provider for Claude Code subscription auth")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
@sashiko-bot

sashiko-bot Bot commented Nov 14, 2026

Copy link
Copy Markdown

Sashiko review

✓ No issues found across 1 commit.

Full review log on sashiko.sashiko.dev

@rgushchin
rgushchin merged commit 73fb627 into sashiko-dev:main Nov 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants