fix(processor): Design step 'model produced invalid content' — retry + max_tokens (ADO #43771)#245
Open
Shreyas-Microsoft wants to merge 1 commit into
Open
fix(processor): Design step 'model produced invalid content' — retry + max_tokens (ADO #43771)#245Shreyas-Microsoft wants to merge 1 commit into
Shreyas-Microsoft wants to merge 1 commit into
Conversation
…tGenerator max_tokens (Bug #43771) Two-part fix for the Design step failure 'The model produced invalid content': 1. Add 'model produced invalid content' / 'invalid content' to the transient-error patterns recognised by _looks_like_rate_limit so that AzureOpenAIResponseClientWithRetry retries instead of failing. 2. Increase the ResultGenerator agent's max_tokens from 12_000 to 25_000 in OrchestratorBase to prevent truncation of large nested JSON schemas (the underlying cause of the 'invalid content' error). ADO #43771 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
765bb4e to
edf076b
Compare
Processor Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Surgical fix for ADO #43771 — [Demo] [Container-Migration] - Design step fails with "The model produced invalid content".
The fix is 2 production files, 11 net lines.
Root cause
The Design step's
ResultGeneratoragent produces a complex nested JSON schema (Design_ExtendedBooleanResult). The previousmax_tokens=12_000cap was truncating that output mid-stream, which causes Azure OpenAI's own response-validation to reject it with the message "The model produced invalid content". The orchestrator's retry decorator wasn't recognising that error as transient, so the Design step failed outright.Change
src/processor/src/libs/agent_framework/azure_openai_response_retry.py_looks_like_rate_limit()now also returnsTruefor messages containing"model produced invalid content"/"invalid content". This causesAzureOpenAIResponseClientWithRetry._inner_get_response()(and its streaming variant) to retry on this transient AOAI response-validation failure instead of bubbling it up. Up to 8 retries with exponential backoff + jitter (configurable viaAOAI_429_*env vars).src/processor/src/libs/base/orchestrator_base.pyResultGeneratoragent'smax_tokensbumped from12_000→25_000to give the nested-JSON serialiser headroom and prevent the truncation that triggers the error in the first place.Verification
_looks_like_rate_limit("The model produced invalid content")→True✅_looks_like_rate_limit("Invalid content was returned")→True✅_looks_like_rate_limit("429 Too Many Requests")→True(unchanged) ✅_looks_like_rate_limit("Some random error")→False(no over-retry) ✅ResultGeneratorflows throughorchestrator_base.py:189for the Design step (src/processor/src/steps/design/orchestration/design_orchestrator.py:233), so themax_tokensbump applies exactly where the failure occurs.Commit
edf076b— fix(processor): retry 'model produced invalid content' and bump ResultGenerator max_tokens (Bug #43771)Does this introduce a breaking change?
max_tokensbump is a per-agent ceiling increase only)Golden Path Validation
Deployment Validation
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com