fix(retry): report IncompleteOutputException to error hooks #3088
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 171 lines diff across 2 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.308
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #3088"
general
weight: 0.35
ychampion
Describe your changes
When a response hits the token limit, the v2 retry loop re-raises
IncompleteOutputExceptionwithout emitting any hook, socompletion:errorandcompletion:last_attempthandlers never see it. v1 emittedcompletion:errorfor this case, and the "Error Handling" example indocs/concepts/hooks.mdbranches onIncompleteOutputExceptioninside acompletion:errorhandler.This change emits
completion:errorandcompletion:last_attemptwithis_last_attempt=Truebefore re-raising. Terminal API errors already get the same treatment. Both the sync and async loops share one small helper.TokenBudgetErrorhandling is unchanged, and the exception type that callers see is unchanged.Tests: added sync and async cases to
tests/v2/test_retry_runtime.py. Both fail onmain(no hooks emitted) and pass with this change.uv run pytest tests/ -k "not llm and not docs": 5647 passed, 213 skipped.ruff check/ruff format --checkandty checkon the touched files are clean.Issue ticket number and link
Fixes #3087
Checklist before requesting a review