Skip to content

Match Claude replays that drop standalone blank text blocks - #3208

Open
xeophon wants to merge 1 commit into
mainfrom
codex/3205-claude-replay
Open

xeophon wants to merge 1 commit into
mainfrom
codex/3205-claude-replay

Conversation

@xeophon

@xeophon xeophon commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Claude Code drops an independently blank Anthropic text block when replaying a tool turn. Preserve the original block boundaries so replay matching ignores just that block. A newline inside a nonblank block remains significant. The regression test exercises both inputs. The original live failure recorded only the branch count. The block behavior was reproduced with the real CLI and scripted responses.

Local unit suite on this commit reported 298 passed, 19 skipped. Full-stack CI

Layer 1 of 13. Targets main. Stack index

Note

Drop only standalone blank text blocks in Claude replay matching

  • Adds an optional text-block offset list to AssistantMessage in types.py, omitted from serialization when unset.
  • The Anthropic dialect's parse_messages and response_from_wire in anthropic.py now record character offsets between consecutive text blocks via a new _text_block_offsets helper.
  • New drop_blank_text_blocks utility in replay.py splits assistant content at those offsets and removes each whitespace-only block, preserving whitespace inside nonblank blocks. It falls back to whole-message drop_blank_text when offsets are missing or non-monotonic.
  • ClaudeCodeHarness.replay_view in harness.py now uses this utility, matching Claude Code 2.1.327's replay filtering.
  • Behavioral Change: assistant messages with multiple text blocks now carry a text_block_offsets field, and replay normalization drops individual blank blocks instead of only fully blank messages.

Macroscope summarized 14c169a.


Note

Low Risk
Replay normalization and graph-matching metadata only; no auth, persistence, or wire-format contract changes beyond optional internal offsets.

Overview
Fixes trace prefix matching when Claude Code replays Anthropic assistant turns that split text across multiple blocks and drop only whitespace-only blocks, while keeping newlines that sit inside non-blank blocks.

AssistantMessage now carries optional text_block_offsets so the Anthropic dialect can remember where native text blocks were joined into content. drop_blank_text_blocks uses those offsets to remove standalone blank segments (with a fallback to whole-message drop_blank_text), and ClaudeCodeHarness.replay_view switches to that helper. A unit test covers the three-block vs single-block newline cases.

Reviewed by Cursor Bugbot for commit 14c169a. Bugbot is set up for automated code reviews on this repo. Configure here.

@macroscopeapp

macroscopeapp Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 14c169a

Macroscope's review found this PR approvable — This change lets Claude replay matching ignore standalone blank text blocks without ignoring whitespace inside meaningful blocks. Its effects are confined to parsing metadata and trace matching, with regression coverage for both cases.

You can add or adjust custom eligibility rules. Learn more.

This branch has not been deployed

No deployments
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.

1 participant