fix(zai): propagate file listing errors when all requests fail #3721
All Vouch review confidence checks passed
Residual risk 0.22 = 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 · 319 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
Diff Size
diff_size
0.345
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3721"
general
weight: 0.35
chrikrah
Why are these changes needed?
Z.AI file listing queries three purposes concurrently. Currently, if every request fails, AG2 filters out all errors and returns
[]. Authentication failures, service errors, and timeouts therefore look like a successful empty listing.Raise the first original SDK error in purpose order when all requests fail. Keep the existing best-effort behavior when any request succeeds, even if that successful response is empty. The concurrent requests are still awaited together; there are no changes to retries, dependencies, or public parameters.
The regression tests exercise
FilesAPIwith a real Z.AI SDK client throughZAIConfig.http_client. They cover HTTP 401/429/500/503, timeouts, complete success, and partial success with empty and nonempty results. No AG2 internals or SDK methods are patched.Validation (Python 3.12.13, Debian 12/WSL, zai-sdk 0.2.3):
just test: 9,158 passed, 11 skipped, 2 xfailed, 453 deselected. The unchanged base has 9,145 passed and identical skipped/xfail outcomes; all 13 additional cases pass and every existing outcome matches.git diff --checkpasses.The 11 skips cover unavailable sounddevice/redis-server and Windows-only or google-genai 2.x-only tests; the two xfails are pre-existing markers. This used the locked test/optionals/types dependencies with CPU-only torch, not the full CI platform/version matrix or live provider tests.
Related issue number
Fixes #3720
Checks
The provider method's docstring now describes complete failure versus partial success. Remote CI is pending.
AI assistance