fix: use VALIDATION_ERROR for invalid model ID in estimate_resources #258
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 214 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.321
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #258"
general
weight: 0.35
abhijeet-dhumal
Description
Problem
estimate_resources()inkubeflow_mcp/trainer/api/planning.pyreturnsErrorCode.SDK_ERRORfor invalid model IDs (e.g.,"random gibberish"). It should returnVALIDATION_ERRORinstead.AI agents interpret
SDK_ERRORas a transient backend failure and retry the same bad input, instead of fixing it.Other validations in the same function (
num_workers,batch_size,quantization) correctly useVALIDATION_ERROR.Fix
_get_model_info_from_hf()now tags errors caused by the model ID itself with an explicitkind, andestimate_resources()maps that to the error code instead of matching the message text:kind: "format") →VALIDATION_ERRORkind: "not_found") →VALIDATION_ERRORSDK_ERROR(unchanged)A 401 keeps
SDK_ERRORon purpose. The Hub returns it both for a missing repo requested anonymously and for a private repo, so the two cannot be told apart, and an access failure must not be reported as bad input.The existing
"did you mean"suggestion logic is preserved.Tests
Added regression tests:
test_estimate_resources_returns_validation_error_for_invalid_formattest_estimate_resources_returns_validation_error_for_confirmed_404test_estimate_resources_keeps_sdk_error_for_access_failures(401 and gated repo)test_estimate_resources_keeps_sdk_error_for_anonymous_401(live anonymous 401 response shape)test_estimate_resources_returns_sdk_error_for_api_failureAll 27 tests in
planning_test.pypass. Lint and format checks pass.Closes #257