Lowercase model names in ps output#831
Conversation
The ps command now lowercases model names after stripping defaults, matching the casing behavior of the ls command. Previously, ps would display names in the original case used during model loading, while ls always showed lowercase names from the registry. Also removes the ToLower workaround in the e2e test that was compensating for this inconsistency.
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- To avoid future divergence between
psandls, consider extracting a shared model-name normalization helper (including default stripping and lowercasing) and reusing it in both commands instead of inlining the logic here. - If SHA-based model identifiers also need consistent treatment, consider whether
strings.ToLowershould apply in both branches of theif strings.HasPrefix(modelName, "sha256:")check, or explicitly document why hashes are exempt.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- To avoid future divergence between `ps` and `ls`, consider extracting a shared model-name normalization helper (including default stripping and lowercasing) and reusing it in both commands instead of inlining the logic here.
- If SHA-based model identifiers also need consistent treatment, consider whether `strings.ToLower` should apply in both branches of the `if strings.HasPrefix(modelName, "sha256:")` check, or explicitly document why hashes are exempt.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request updates the ps command to lowercase model names for consistency with the ls command and updates the corresponding E2E tests. A correctness issue was identified in cmd/cli/commands/ps.go where strings.ToLower is applied after stripDefaultsFromModelName. Since the stripping logic is case-sensitive, it should be applied to the lowercased string to ensure defaults like :latest are correctly removed from mixed-case inputs.
|
I think the bot comment is worth addressing |
Apply strings.ToLower before stripDefaultsFromModelName so that case-sensitive prefix/suffix matching (e.g. "ai/", ":latest") works correctly on mixed-case backend responses like "AI/Gemma:Latest". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Good catch, fixed in 249bb42. Moved |
The
pscommand displayed model names in whatever case was used during loading, whilelsalways showed lowercase names from the registry. This made the output inconsistent between the two commands.Now
pslowercases model names after stripping defaults, matchinglsbehavior. The e2e test no longer needs thestrings.ToLowerworkaround that was compensating for this.Resolves the TODO at
e2e/cli_test.go:48.Note: This PR was authored by a human with AI coding assistance.