Skip to content

feat(auth): list and disconnect omp's stored provider accounts - #222

Merged
kahme247 merged 83 commits into
kahme247:mainfrom
andrebrait:feat/197-provider-accounts
Oct 8, 2026
Merged

kahme247 merged 83 commits into
kahme247:mainfrom
andrebrait:feat/197-provider-accounts

Conversation

@andrebrait

@andrebrait andrebrait commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #197.

Summary

Settings → API Keys & Providers → a subscription provider now lists every account omp stores for it, using omp's new get_logout_accounts / logout RPC commands (can1357/oh-my-pi#14588):

  • Each account shows its label (email, plus the org when omp reports one), the plan from omp usage when that email identifies exactly one account, and an API key marker for stored keys.
  • Disconnect on a row removes that one credential after a confirmation. The other accounts stay connected, and omp keeps choosing and rotating between them.
  • The sign-in button of a connected provider now reads Add account. The status line explains that signing in with another account adds it, while signing in with a connected account refreshes it.

omp stays responsible for credentials, selection and rotation. omp-web never touches agent.db. omp's per-account active flag is not shown: omp computes it against the settings utility process's throwaway session, so it does not say which account any chat uses.

Compatibility

This needs omp 18.7.0 or later, the first release with can1357/oh-my-pi#14588. With older omp, GET /api/auth/accounts/[provider] returns supported: false, so the panel keeps the read-only list from omp usage and explains how to disconnect from a terminal. DELETE returns 501 logout_unsupported.

Changes

  • New app/api/auth/accounts/[provider]/route.ts: GET lists accounts, re-projecting only the known fields. DELETE ?credentialId= removes one account and invalidates the models cache.
  • Removed the app/api/auth/logout/[provider] 501 stub and the provider-wide Disconnect button.
  • components/ProviderAccounts.tsx renders the RPC list, falling back to the usage list on older omp. planForStoredAccount in lib/provider-accounts.ts joins usage plans to stored accounts.
  • en / ja / zh-CN strings, CHANGELOG, AGENTS.md.

Verification

  • tsc --noEmit, npm run lint (no new warnings), full npm test locally (0 failures), CI green on ubuntu and windows. New tests:
    • lib/auth-accounts-route.test.mjs: field allowlist, old-omp fallback, exact credential removal, unsafe id rejection, and error mapping.
    • lib/provider-accounts.test.mjs: a plan is matched only when one account has that email.
  • Live smoke in headless Chromium against omp built from can1357/oh-my-pi main, using a disposable copy of the agent database with a second Anthropic account added: both accounts listed, and Disconnect on the second removed only that credential. The real database was untouched.
  • Live smoke against released omp 18.6.2: read-only usage list plus the update/terminal hint; DELETE returns 501.
  • One condensed adversarial review round, then Codex and CodeRabbit on the review companion ([companion] feat(auth): list and disconnect omp's stored provider accounts andrebrait/ompweb#82). All findings are fixed in follow-up commits, except mapping omp's "not stored" error to 404, which stays a 500 because the UI drops a removed row immediately and never requests it again.

andrebrait and others added 30 commits October 3, 2026 12:54
The pruning that bounds the job store deletes a `gone` tombstone with no
client-visible signal, so a browser that adopted another browser's recording
could get a 404 and raise an error toast for a job that had in fact been
delivered elsewhere. Only the browser that recorded (or retried) a job holds
the audio to fall back on, so only it may report it as a failure; a follower
that is locked out of the transcript is standing down by design.

The attached-messages toast also blamed the agent for a rule that has nothing
to do with it: `sendQueued` refuses attachments whether or not a run is
active, and `followUp` is dispatched immediately when the agent is idle. The
rule and its explanation are now one predicate, `queueAllowsAttachments`, used
by both `sendQueued` and the dictation branch, so they cannot drift apart.
Stop withdrew queued messages one by one from this client's queue snapshot
before aborting. A steer missing from that snapshot (promoted after the last
queue_update) or claimed by the run but not yet recorded was never withdrawn,
and omp drained it into a new turn right after the abort: the user pressed
Stop and the steer ran anyway.

Stop now sends abort_and_restore_queue, omp's Esc in one step (clearQueue
forInterrupt, then abort), and restores the returned texts to the draft. omp
without the command falls back to the per-entry withdrawal.
Review of the atomic Stop:
- Capture the run fence at the click; a failed request is retried once and
  only while that run is current, so it can never abort a newer run.
- Fall back to per-entry withdrawal only on "Unknown command" (omp without
  abort_and_restore_queue); any other failure retries the same command, and
  warns (new localized queueRestoreUncertain) when nothing came back.
- Narrow the try to the request; drop an image-only "[Image]" label.
- Tests: retry restores, lost response warns, no retry into a newer run,
  overlapping Stops share one request; tidy the server abort branch.
Prepare ompweb for publisher-default Auto effort in can1357/oh-my-pi#14114. Persist the choice through native config, preserve provider settings, and show the control and search result only when Reasoning is auto.
…in browser code

Older browsers lack these APIs: Settings crashed on open, session catch-up stalled, and transcription polling failed. Use AbortController timers and plain promises, keeping the same timeouts and cancellation. Fixes kahme247#196.
Reuse the workspace refresh control and success checkmark. Bypass the server usage cache only for manual refreshes while retaining the existing five-minute automatic polling schedule.
Keep background polling silent, preserve refresh queries on older browsers, and ensure manual refresh is not satisfied by a concurrent background fetch. Cover persisted caching and hook behavior with regression checks.
A manual refresh must attempt cache invalidation even when the automatic fetch it waited behind rejects. Extend the CLI-backed regression to cover this failure path.
The reasoning trigger shows the terminal status line's level glyph instead
of the level name (chevron hidden in narrow toolbars), so the model name
keeps the room on phones. The menu pairs each glyph with its name.

Slow was wired only for saved sessions, so a new session never showed it
even after Fast had spawned omp. Offer it in new sessions too, and refresh
live state after a new-session model change so support follows the model.
Without live omp state (new or idle session), predict omp's slowModeTarget
from the catalog: /api/models marks supportsSlowMode by provider and
reports providers.anthropic.slowMode, read fresh outside the models cache.
Claude shows the shared setting (global scope); flex starts off (session).
Live get_state wins as soon as omp runs, and clicking the toggle spawns
omp like Fast does.
…t code

Older mobile browsers lack these APIs, so calling them crashed the whole
tree into the unexpected-error screen. Use browser-safe helpers.

Fixes kahme247#196

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
… again

Handle the session-persistence notice: re-read identity, keep the run
state, re-key the registry (old id stays as an alias) and reuse a live
wrapper that already reports the requested session file.

Fixes kahme247#202

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
- auto-name asks omp (generate_title, else /rename) and only falls back to
  the derived title when omp cannot (Fixes kahme247#203)
- provider detail lists the accounts omp reports for the provider (Refs kahme247#197)
- tests and AGENTS.md notes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
fix(queue): take the queue back on Stop through omp's atomic Esc
feat: add a Slow toggle and provider-neutral usage-limit badge
…urce

feat(settings): add Auto thinking source selector
…efresh

feat(usage): add manual provider usage refresh
…-compatibility

fix(client): avoid AbortSignal.timeout/any and Promise.withResolvers
Take main's kahme247#199 client fix instead of the duplicate abort-signal helper.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RZdyVoycH4WVVDWJNctDR
…edes-297gxo

Support omp session moves and native title generation
Show the branch below the workspace name, keep the activity indicator beside the name, and preserve space for rename and branch controls.
Use OMP live resolution instead of duplicating discovery.
Keep the native notice preference and never resume stopped sessions for
inspection.
Add an icon-only dismiss button that hides the current report until its diagnostics change, and shorten the disable action to "Turn this off" so the notice text keeps its width on phones.
claude and others added 12 commits October 5, 2026 14:19
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	components/AppShell.tsx
#	components/ChatInput.tsx
#	components/SessionSidebar.tsx
# Conflicts:
#	README.md
#	hooks/useAgentSession.ts
…247#197)

Use omp's get_logout_accounts/logout RPC to list every stored credential
for a subscription provider, mark the active one, and remove a single
account. omp without those commands keeps the read-only usage-based list.
Rename the connected provider's sign-in button to Add account.
Drop a disconnected row immediately, report listing failures instead of
claiming an old omp, reject unsafe credential ids, and cover the route.
omp computes 'active' against the settings utility process's throwaway
session, so it does not say which account any chat uses.
One email can hold accounts in several orgs; the bare-email usage row
cannot tell them apart.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 7, 2026
…r accounts

Squashed from origin/feat/197-provider-accounts (711ad9e) onto upstream/main.

@kahme247 kahme247 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Review — approve (SHIP)

Verified by independent review with live route-handler probes against fake credentials.

Provider accounts (#222). No credential leak: a fixture with fake keys in every plausible omp field returns only allow-listed {credentialId, label, detail, type}. Disconnect is real server-side revocation (omp's shared logoutCredential helper — authStorage.credentials.removeById — plus invalidateModelsCache()), not UI hiding. Hostile provider strings inert (JSON-over-stdio, no shell/file sink). Old-omp degradation graceful (supported:false/501 with usage-list fallback, test-covered). Both redaction and validation mutations killed. Two optional non-blocking notes: redact key-like patterns from 500 passthroughs, and surface remainingSource when env-var auth keeps a provider connected.

@kahme247
kahme247 force-pushed the main branch 2 times, most recently from 3f1dbea to 42b3c29 Compare October 8, 2026 13:30
@kahme247
kahme247 merged commit f33f418 into kahme247:main Oct 8, 2026
3 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.

[Feature] Expose omp’s multiple-account support in subscription settings

6 participants