Skip to content

fix(anthropic): coerce blank system text blocks at extraction (#70909) - #86643

Merged
teknium1 merged 1 commit into
mainfrom
salv-70910-anthropic-system-blank
Aug 15, 2026
Merged

fix(anthropic): coerce blank system text blocks at extraction (#70909)#86643
teknium1 merged 1 commit into
mainfrom
salv-70910-anthropic-system-blank

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvages the residual fix from #70910 (SHL0MS) after #77509 landed the message-list scrub.

Testing

  • tests/agent/test_anthropic_request_blank_block_guard.py — 5 passed
  • tests/agent/test_anthropic_whitespace_text_blocks.py + tests/agent/test_anthropic_adapter.py — 110 passed

Authorship preserved: commit authored by SHL0MS. Closes #70909. Supersedes #70910.

Infographic

70910-blank-system-block

Residual from PR #70910 after #77509 landed the message-list scrub: a
whitespace-only system content block carrying a cache_control marker
still reached the wire and 400'd the whole request ("text content
blocks must contain non-whitespace text"), wedging the session on every
retry. The block cannot be dropped (it carries the cache breakpoint),
so coerce its text to the shared non-whitespace placeholder when
extracting the system param, copying the block so caller message dicts
are never mutated.

Adds SHL0MS's request-level regression suite from #70910; four of its
five cases already pass on main via #77509 — the system-block case
fails without this fix.
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 608febc — fix(anthropic): coerce blank system text blocks at extractio

⚠️ Warnings

CI timings · View report · View job

Wall time 21m48s vs 9m59s (+118.4%). 10 job(s) slower, 14 faster,

  • Python tests / Run tests slice 3/12: +36.0s
  • Python tests / Run tests slice 5/12: -30.0s
  • Python tests / Run tests slice 4/12: +29.0s
  • Python tests / Run tests slice 8/12: -23.0s
  • Python tests / Run tests slice 7/12: +22.0s

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/anthropic Anthropic native Messages API sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 15, 2026
@teknium1
teknium1 merged commit bec7df1 into main Aug 15, 2026
49 checks passed
@teknium1
teknium1 deleted the salv-70910-anthropic-system-blank branch August 15, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/anthropic Anthropic native Messages API sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

3 participants