Skip to content

Read the Ollama Cloud key omp keeps in its agent.db - #16508

Open
ivanvan08 wants to merge 1 commit into
omacom:quattrofrom
ivanvan08:ollama-omp-db-key
Open

ivanvan08 wants to merge 1 commit into
omacom:quattrofrom
ivanvan08:ollama-omp-db-key

Conversation

@ivanvan08

Copy link
Copy Markdown

omp keeps the keys it signs in with in ~/.omp/agent/agent.db (auth_credentials, credential_type = 'api_key'), not in an auth.json, so the collector never found an omp user's Ollama Cloud key and showed "Waiting for auth" for an account that is signed in.

It is read from there now:

  • read-only, the way every store a collector reads is opened;
  • passing over a key omp disabled (disabled_cause set), newest first;
  • under PI_CODING_AGENT_DIR when that variable moves omp's tree, as it already does for pi's auth.json — omp reads only the moved tree then, so the moved database replaces the default rather than sitting beside it;
  • with the older ~/.omp/agent/auth.json kept as the last fallback.

The rest of the order is unchanged: OLLAMA_API_KEY, then apiKey in ~/.config/omarchy/agents/ollama.json, then pi's auth.json.

Carried over from #16085, which was written against #14040's branch and auto-closed when that branch was merged and deleted. The credit-plan balance that PR also carried is already here through the base's /api/balance reading, so this is only the key lookup now.

Tests: agent-usage-ollama-scanner-test.sh gains two cases — the key from agent.db with a disabled row and another provider's row passed over (found ahead of an auth.json key), and the database under PI_CODING_AGENT_DIR. Both fail with omp_database_key() taken out; with it, all 47 cases pass.

The same ~/.omp/agent/auth.json lookup is in the DeepSeek, MiniMax, OpenCode, OpenRouter and Z.ai collectors, so an omp user's key for those isn't found either. Kept to Ollama here; a shared reader in collectors.py would cover all six if you'd rather fix it once.

omp keeps the keys it signed in with in ~/.omp/agent/agent.db, not in an
auth.json, so the collector never found an omp user's key and showed
"Waiting for auth" for an account that is signed in. It is read there now,
read-only, passing over a key omp disabled, and under PI_CODING_AGENT_DIR
when that moves omp's tree, as pi's already is. The older auth.json stays
as the last fallback.
@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The Ollama Cloud collector now reads omp’s saved API key from agent.db.

  • Ollama Cloud uses omp's saved database key for account limits.

Static review and whitespace checks found no actionable issues. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Find Ollama Cloud key] --> B{Environment key?}
  B -- Yes --> K[Use key]
  B -- No --> C{Omarchy config key?}
  C -- Yes --> K
  C -- No --> D{Literal pi key?}
  D -- Yes --> K
  D -- No --> E{Enabled omp database key?}
  E -- Yes --> K
  E -- No --> F{Literal legacy omp key?}
  F -- Yes --> K
  F -- No --> G[Show sign-in help]
Loading

Reviews (1) · Last reviewed commit: "Read the Ollama Cloud key omp keeps in i..." · Reviewed by Greptile

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.

1 participant