Skip to content

fix(mental-models): accept a delta array the provider already parsed - #5669

Merged
nicoloboschi merged 1 commit into
mainfrom
fix/delta-ops-preparsed-list
Oct 16, 2026
Merged

nicoloboschi merged 1 commit into
mainfrom
fix/delta-ops-preparsed-list

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Fixes #5471. Fix by @superbiche (cherry-picked from their fork, authorship kept).

The delta call sets a response_format with skip_validation=True, so OpenAI-compatible providers hand back parsed JSON. parse_delta_operation_list handled a parsed dict but not a parsed list, so a bare array of operations hit (raw or "").strip() and raised AttributeError. That error also skipped the ask-again retry, which only catches ValueError/TypeError.

Now a parsed list is validated like the text-form array, and any other non-text reply raises TypeError so the retry still runs.

Tests: 4 new cases in test_delta_operation_parse.py (all fail without the fix); file passes, 37/37.

The delta call sets a response_format under skip_validation, so an OpenAI-compatible provider returns the parsed JSON. parse_delta_operation_list handled a parsed dict but not a parsed list: a bare array of operations (the #3820 shape) fell through to (raw or "").strip() and raised AttributeError, which the ask-again path does not catch, so the refresh ended in delta_ops_failed without its corrective retry. A parsed list now validates like the text-form array, and any other non-text reply raises TypeError so the retry still applies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicoloboschi
nicoloboschi merged commit 9e93841 into main Oct 16, 2026
117 checks passed
@nicoloboschi
nicoloboschi deleted the fix/delta-ops-preparsed-list branch October 16, 2026 12:37
@nicoloboschi nicoloboschi mentioned this pull request Nov 3, 2026
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.

Mental-model delta refresh: a delta reply the provider already parsed as a list raises AttributeError ('list' object has no attribute 'strip')

2 participants