chore(desktop,host-service): drop the Models provider chain; local naming uses the agent CLI

Merged
SA
2mo ago
+313-10414

Why

The Models settings page asked users to sign in to Anthropic and OpenAI so that a small model could name new workspaces and branches. That design sends the user's prompt to an API we picked on their behalf. For privacy-sensitive users that is not acceptable: the prompt is the most sensitive thing they type, and consenting to run an agent is not consent to hand the same text to a second service.

Local naming now runs on the agent CLI the workspace already launches, using the credentials the user signed that CLI in with. When there is no agent context, or the CLI cannot run, names are derived from the prompt text on this machine. Nothing leaves the machine that the user has not already signed that agent in to. The small model and its provider sign-in go away entirely.

What was removed

  • packages/provider-auth — the whole package: Anthropic/OpenAI OAuth and API-key storage, the chat service, small-model resolution, title generation.
  • host-service — ChatService in app.ts and types.ts, the runtime.auth handle, the whole host.auth.* router, and its integration test.
  • desktop main — the chatService tRPC router and its registration.
  • desktop renderer — components/ProviderAuth/ (OAuth dialogs, hooks, IPC client), the Models settings page, its sidebar entry, command-palette command, settings-search items, and the "models" settings section.
  • onboarding — the provider connect step and its Claude Code / Codex rows. The flow still completes: step one is now the language row plus the GitHub CLI row, and Continue still advances to the project step. Connecting an agent during onboarding is not coming back, so the step's subtitle no longer promises it.
  • shared — src/shared/ai/provider-status.ts, whose only consumer was the Models page.
  • Dependencies that existed only for this chain: @superset/provider-auth, @mastra/core, and mastracode from the desktop and host-service manifests.

Naming after this change

Two tiers, both local:

  1. The launch agent's own headless CLI (claude --model haiku -p style), 20-second cap. Unchanged, and now the first attempt rather than a fallback.
  2. Names derived from the prompt: deriveWorkspaceTitleFromPrompt for the title, the 30-character branch slug for the branch.

The desktop v1 paths (ai-name.ts, ai-branch-name.ts) and the host-service generateBranchNameFromPrompt lose their model call and derive directly; they had no agent context to work with. Because the derived name is now the normal outcome rather than a degradation, the "model naming was unavailable" warning is gone, and the auto-name toast no longer offers to open a settings page that no longer exists. The toast still fires for the case that remains genuinely unnameable.

workspaces.aiRename has no UI caller and now derives rather than calling a model. Cloud workspace naming on the API is out of scope and untouched.

Persisted state

No schema change, and nothing needed a sweep. The settings-section store is not persisted. The renderer does restore its route history from localStorage, so a user who quit on /settings/models comes back to Not Found inside settings rather than the page. That is a deliberate call: it is rare, it does not crash, and a prefix list of dead routes is not worth maintaining to turn one Not Found into a different route. DEAD_KEYS is untouched because this feature persisted no keys of its own.

Verification

CheckResult
bun run lint:fixclean, no fixes on the second pass
sherifno issues across 37 packages
host-service typecheckpasses
desktop typecheckpasses
host-service tests1503 pass, 0 fail, 8 todo
desktop tests3451 pass, 1 fail
bun run check:i18n4931 messages, 0 missing in all 16 locales

The one desktop failure is LeaderboardRank, which this branch does not touch. It passes in isolation and fails only in the full run: packages/shared/src/constants.ts reads NEXT_PUBLIC_MARKETING_URL at module load, the repo root .env sets it to http://localhost:9522, and the test asserts the production URL. That is a pre-existing cross-file environment leak, not a regression here.

lingui extract --clean removed 35 orphaned message ids across every locale (the provider OAuth dialogs, the API-key rows, and the Models page copy). Catalogs are regenerated and committed.

Notes for review

  • plans/host-service-chat-architecture.md and the shipped plans under apps/desktop/plans/done/ still describe this chain. They are historical records, so I left them; say the word if you want the live architecture doc updated.
  • scripts/sandbox/image.ts keeps a runtimeResolutionOnly list that existed because the provider credential store pulled in mastra's storage stack. It is probably trimmable now, but that needs checking against a fresh bundle, so I only corrected the comment.

Do not merge yet: the replacement settings UI lives on a separate branch.

https://claude.ai/code/session_01TzD4tqeanYqTMxpWRJGpwZ


Summary by cubic

Workspace and branch naming previously sent prompts through Superset's Anthropic/OpenAI provider chain; names now come from the workspace's launch-agent CLI first, otherwise derived locally. The Models settings page and provider sign-in are gone, so prompts only reach services the user already connected their agent to. Cloud naming remains unchanged.

  • The CLI has a 20-second limit; local derivation stays offline and branch names deduplicate against existing branches.
  • Removes provider authentication, chat routes, the Models settings page, the onboarding provider step (onboarding now only covers language and GitHub CLI), and the @superset/provider-auth package.
  • Naming warnings now appear only when naming is skipped, and the fallback toast no longer links to removed settings.
  • Removes the Mastra/DuckDB/tokenizer/ONNX/libsql native-module packaging paths; build checks now validate the remaining @ast-grep/napi binding.
  • Persisted /settings/models history is not rewritten, so users with that saved route can still land on Not Found.

Summary by CodeRabbit

  • Removed Features

    • Removed the Models settings section and Anthropic/OpenAI account connection flows, including OAuth and API-key management.
    • Onboarding now focuses exclusively on GitHub CLI setup.
    • Workspace auto-naming no longer relies on hosted model calls or model-auth settings.
  • Bug Fixes

    • Workspace branch names are generated locally and automatically deduplicated.
    • Auto-rename warnings now appear only when renaming is skipped or fails, avoiding misleading prompts.