fix(agents): send maxOutputTokens for prompt agents #11007
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.62) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.62 · 247 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.330
Sensitive Paths
sensitive_paths
0.062
Real PR Conversation Timeline
1 comments
"Review active on #11007"
general
weight: 0.35
1AbdullahButt
Summary
kind: promptservice withmaxOutputTokensset deployed withmax_output_tokens: null, becausePromptAgenthad no field for it andCreatePromptAgentAPIRequestnever copied it into the prompt definition.MaxOutputTokens *inttoPromptAgent(authored asmaxOutputTokens, liketopP) and toManagedAgentDefinition(sent asmax_output_tokens), and map it next totemperatureandtop_p.ValidateAgentDefinition, and narrow the schema'skind: promptbranch to an integer from 1 to 2147483647. The voice-only"inf"value stays valid for prompt-voice agents only. I also updated the shared property description, which said the field was voice-only.Fixes #10924.
Validation
GOTOOLCHAIN=auto):go test ./internal/pkg/agents/agent_yaml/ ./internal/pkg/agents/agent_api/andgo test ./internal/project/ -run "DocExample|Schema|Prompt"pass.go veton the changed packages is clean, and the changed files are gofmt-clean.TestPromptAgent_MaxOutputTokensReachesTheAPI(set and unset) andTestPromptAgent_MaxOutputTokensMustBePositive. With the source changes reverted and the tests kept, both fail. Thesetcase shows the request body{"name":"capped-agent","definition":{"kind":"prompt","model":"gpt-4.1-mini","instructions":"You are helpful."}}with nomax_output_tokens, which is the reported behavior.azure.yamlpath from the issue with a throwaway test (not committed): the issue's service properties go throughPromptAgentFromResolvedServiceand thenCreatePromptAgentAPIRequest. On main the body has nomax_output_tokens. With this change it has"max_output_tokens":4000.No Azure deployment or interactive scenario was run.
AI disclosure: I made this change with help from Claude Code, and I reviewed the diff and the test results myself.
🤖 Generated with Claude Code