Skip to content

Lowercase model names in ps output#831

Merged
doringeman merged 2 commits intodocker:mainfrom
tmchow:fix/ps-lowercase-model-names
Apr 6, 2026
Merged

Lowercase model names in ps output#831
doringeman merged 2 commits intodocker:mainfrom
tmchow:fix/ps-lowercase-model-names

Conversation

@tmchow
Copy link
Copy Markdown
Contributor

@tmchow tmchow commented Apr 4, 2026

The ps command displayed model names in whatever case was used during loading, while ls always showed lowercase names from the registry. This made the output inconsistent between the two commands.

Now ps lowercases model names after stripping defaults, matching ls behavior. The e2e test no longer needs the strings.ToLower workaround 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.

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.
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ericcurtin
Copy link
Copy Markdown
Contributor

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>
@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Apr 4, 2026

Good catch, fixed in 249bb42. Moved strings.ToLower inside the stripDefaultsFromModelName call so case-sensitive prefix/suffix matching works correctly on mixed-case input.

@doringeman doringeman merged commit cc7a83e into docker:main Apr 6, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants