Skip to content

Ollama: an unreadable /api/me response drops the plan badge without a warning #1231

Description

@tduarte

Follow-up to #1173, requested by @robinebers in this review comment:

Could you send a small follow-up PR for unreadable plan responses? If /api/me returns 200 OK with malformed data, the plan badge currently disappears without a user-visible warning. Keep the usage meters working, but show the same gentle warning used for failed plan requests.

Current behavior OllamaProvider warns when the /api/me request fails (transport error or non-2xx). But when it returns 200 OK with a body OpenUsage can't read — not a JSON object, or a plan field that has been renamed or is no longer a string — plan resolution just yields nil. The badge vanishes with no warning and no log line: the same silent disappearance the existing warning was added to prevent.

Proposed fix. Have plan resolution report three outcomes rather than an optional string:

  • a usable plan name → show the badge,
  • an explicitly empty plan → an account that has no plan; show no badge and stay quiet, since that is ordinary,
  • anything unreadable → show no badge and carry the same warning a failed request already produces.

The middle case is worth keeping separate: warning on it would nag every user whose account legitimately reports no plan.

Regression test included for the 200 OK + unreadable body case, which the existing tests miss (they cover HTTP 500 only).

Implemented and ready to open as a PR. Could you add the approved label and assign it to me so the PR-policy workflow accepts it? (#1066 is closed now that #1173 merged, so it can no longer serve as the linked issue.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

approvedMaintainer-approved issue or PR scope

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions