Repository navigation
[None][fix] catch KeyError when parsing --server_role into ServerRole - #17730
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe server command now catches ChangesServer role validation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to Invalid --server_role values now return the intended validation message rather than a traceback. No concrete current-head risk remains identified for this focused error-handling correction. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ServerRole[name] is an Enum name lookup, which raises KeyError for an unknown name, but the handler caught ValueError. An invalid --server_role therefore surfaced as a raw KeyError traceback instead of the intended 'Invalid server role: ... Must be one of: ...' message. Signed-off-by: lonexreb <[email protected]>
272b103 to
7cac376
Compare
mikeiovine
left a comment
There was a problem hiding this comment.
Stamp on behalf of runtime devs
|
/bot run |
|
PR_Github #70807 [ run ] triggered by Bot. Commit: |
|
PR_Github #70807 [ run ] completed with state
|
|
/bot run |
|
PR_Github #72201 [ run ] triggered by Bot. Commit: |
|
PR_Github #72201 [ run ] completed with state
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
/bot run |
|
PR_Github #72317 [ run ] triggered by Bot. Commit: |
|
PR_Github #72317 [ run ] completed with state
|
|
/bot run |
|
PR_Github #72522 [ run ] triggered by Bot. Commit: |
|
PR_Github #72522 [ run ] completed with state |
Description
ServerRole[server_role.upper()]is an Enum name lookup, which raisesKeyErrorfor an unknown name — but the handler caughtValueError. Since--server_roleis a free-form string option, an invalid value (e.g.--server_role context_server) surfaced as a rawKeyErrortraceback instead of the intendedInvalid server role: ... Must be one of: ...message.Change the handler to catch
KeyError, matching the existingCpTypeparsing in the same file.Test Plan
python -c "from enum import IntEnum"-level semantics:Enum[name]raisesKeyError, verified.trtllm-serve <model> --server_role bogus --metadata_server_config_file cfg.yamlnow reports the friendly error.Dev Engineer Review
--server_rolevalidation to catchKeyErrorfromServerRole[name].QA Engineer Review
No test changes.