fix: recover chat after rejected file uploads #419
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.37) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 217 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.322
Real PR Conversation Timeline
1 comments
"Review active on #419"
general
weight: 0.35
rupayon123
What changed
When an agent inference request failed, the client left optimistic user turns (including rejected base64 file payloads) in chat history. A later text-only request then resent the same invalid file and failed again. The client also retained the rejected attachment in its pending upload list.
This restores the conversation to its last accepted history on failed requests. For the server's
Invalid file formatresponse, it also clears pending image/document attachments and shows the specific server message; transient errors keep pending attachments available for retry. The user's text remains available. Adds dependency-free regression tests using Node's built-in test runner.Closes #413.
Validation
pnpm test: 3 passed.pnpm typecheck: passed.pnpm lint: passed with 16 existing warnings.pnpm build: blocked by four TypeScript errors in existing guardrails files (guardrails/index.tsx,PiiPreviewDialog.tsx, andPolicyTestPanel.tsx), outside this change.git diff --check: passed.The build failure remains visible and is not attributed to this patch.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Bug Fixes
Chat history is preserved when an inference request fails.
The submitted prompt is restored, making it easier to retry after a failure.
Uploaded files are cleared when the service rejects an invalid file format, while attachments remain available to retry after network errors.
* Error notifications appear when a meaningful error message is available, helping explain why a request could not be completed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->