Repository navigation
Conversation
… keys Devin now rejects the raw-key GetUserStatus form for session tokens saved as api_key credentials (401 'invalid api key'), leaving quota unknown. Usage now mirrors chat auth: CLI session-token metadata first, one raw-key retry only after 401 when the encoding differs, so legacy Windsurf keys (can1357#12958) keep working. collectUnreportedAccounts no longer lists an OAuth account with no identity at all as missing when its provider returned reports; Devin browser logins store no email, account or org, and their report carries an org.
| const ids = [account.email, account.accountId, account.projectId] | ||
| .filter((value): value is string => typeof value === "string" && value.length > 0) | ||
| .map(value => value.toLowerCase()); | ||
| if (!accountOrg && ids.length === 0) return false; |
There was a problem hiding this comment.
🟡 Missing OAuth usage hidden by sibling report
When one identity-less OAuth account fails and a sibling reports usage, collectUnreportedAccounts treats both as covered. Neither /usage nor omp usage --json shows the failed account as missing.
Learn more
Usage reports are fetched for each stored credential by UsageService, but this helper receives only reports and identity slices of credentials. Devin browser logins can supply no stored email, account ID, project, or org. The early return therefore cannot distinguish a successful identity-less account from a failed sibling when one report exists for the provider. Previously an org-attributed sibling did not cover an org-less account, so this change hides that failed account's missing-usage row.
Example: Two Devin browser logins store tokens A and B without identity fields. A returns a report with an org ID, while B's usage request fails. The provider has one report, so both accounts pass the early return; the dashboard shows A's report without B's missing-usage row.
Recommended fix: Carry a stable credential-to-report association through the usage fetch and account collection paths, then suppress a missing row only for the credential that yielded a report. Do not infer coverage from provider presence when multiple identity-less credentials exist.
Was this helpful? React with 👍 or 👎 to provide feedback.
What
omp reads Devin usage again for session tokens saved as API keys, by trying the CLI login format first and falling back to the raw key only after a 401, the same order chat already uses. Separately,
/usageandomp usage --jsonno longer list a Devin browser login as "no usage data" next to its own working report.packages/ai/src/usage/devin.ts:GetUserStatussendsdevinCliMetadatafirst for every credential type, with one retry usingdevinWireMetadataonly on HTTP 401 when the encoded key differs. Legacy Windsurf keys (devin: legacy Windsurf Enterprise seats can't authenticate in omp (login 401, chat/usage send prefixed session token) can1357/oh-my-pi#12958) keep working through that retry, which replaces the test that pinned raw keys forapi_keycredentials.packages/coding-agent/src/slash-commands/helpers/usage-accounts.ts:collectUnreportedAccountsdoes not claim an account is missing when it has no email, account, project or org identity at all and its provider returned reports. Identified accounts keep the existing org-gated attribution.Why
Since about Oct 19-20, Devin answers
401 {"code":"unauthenticated","message":"invalid api key"}to the raw-key form for a session token stored asapi_key, so the usage report was null and quota showed as unknown. Devin browser logins store only the token (its JWT carries justsession_id), while the usage report carries anorgId, so the org gate flagged the account as unreported.Testing
reports API-key usage when only the CLI session-token form is accepted,falls back to the raw key once only after HTTP 401 with a different encodinganddoes not list identity-less OAuth accounts as missing beside an org-attributed reportfail on the parent commit (0 pass, 3 fail) and pass with the fix.bun test packages/ai/test/devin-account-usage.test.ts packages/coding-agent/test/usage-cli.test.ts: 114 pass, 0 fail.bun check: passes.bun checkpasses