Skip to content

Seed a tenant from its own connected model, not only a hub-owned key - #287

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-provision-own-model
Aug 22, 2026
Merged

Seed a tenant from its own connected model, not only a hub-owned key#287
TheGreatAxios merged 2 commits into
mainfrom
cl-provision-own-model

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • A tenant that connects its own inference provider through Settings → Connections (never through onboarding) never gets seeded: the credential and catalog are stored, but nothing triggers the workflow-deploy drain, so /api/onboarding/provisioning-status polls 200 forever and Myra never appears. Reproduced end to end on a fresh account connecting only Ollama.
  • packages/connections/src/routes.ts's /:connectorId/complete now checks hasUsableModel (@corbits/inference-settings, the same resolved-catalog read launch itself uses) after a credential is durably stored, and — only when the tenant now actually has a usable model, never merely because a credential row exists — fires a new onInferenceCredentialUsable hook.
  • apps/hub/src/index.ts wires that hook to the same pendingSeedStore + benchProvisioner drain the onboarding credential step already feeds (idempotent, restart-safe, unchanged) — a Settings-connected provider now converges on Myra + the default workflow set exactly like an onboarding-connected one.
  • Threaded a baseURLOverride through the pending-seed row end to end (pending-seed.ts, bench-provisioning.ts) so a url-kind connector (Ollama) deploys against the instance a person actually pointed at rather than a curated default — this gap already existed in onboarding's own credential-step trigger; fixed there too.

Why this trigger point

Connect-time is the only point in the system that already holds the plaintext credential (credential rows are write-only after storage) — the provisioning-status poll and sign-in reconcile paths can't build a ModelSource themselves. Routing through the existing drain rather than seeding inline keeps the connect response fast (CL-6457) and reuses proven convergence logic instead of adding a second one.

Note for review

packages/inference-settings/src/usable-model.ts is duplicated verbatim from #280 (cl-no-model-honest, still open) rather than stacking on it, to keep this independently mergeable. Expect a trivial same-content conflict on that one file whichever merges second — take either side.

Linear: CL-6578

Test plan

  • bun run typecheck in packages/connections, packages/onboarding, packages/inference-settings, apps/hub
  • bun test in packages/connections (40/40), packages/inference-settings (39/39), packages/onboarding non-DB suites (83/83)
  • bun run check:browser-safe-subpaths, check:licenses
  • eslint + prettier --write on every changed file
  • Real-browser repro (fresh account, connect Ollama, confirm Myra + default workflows deploy without any CLI step) — not run in this sandbox; see PR description's repro steps

Connecting an Ollama/OpenAI/etc. key through Settings never re-triggers
provisioning: a tenant whose only credential is one it connected itself
sits with zero deployed workflows forever, because seeding has only ever
run off a hub-owned ANTHROPIC_API_KEY. These tests cover the fix ahead
of it: the connect route firing a seed-eligible hook once the tenant's
resolved catalog is actually usable (never merely because a credential
row exists), the pending-seed store round-tripping the connected
instance's own base URL, and the existing-provider/no-usable-model/
non-inference-connector cases that must NOT fire it.
A hub-owned ANTHROPIC_API_KEY has never been the only valid seed
source in spirit — it was just the only one anything ever triggered
from. Connecting a provider through Settings (packages/connections)
persisted the credential and seeded its catalog, but nothing ever told
the durable pending-seed drain (bench-provisioning.ts) about it, so a
self-serve tenant whose only provider is one it connected itself never
got Myra or the default workflow set, and /api/onboarding/
provisioning-status polled 200 forever with no way to converge.

The connect route now asks the same resolved-catalog question launch
itself asks (hasUsableModel, @corbits/inference-settings, PR #280) once
a credential is durably stored, and — only when that tenant now has a
model with a real offering, never merely because a credential row
exists — hands the connecting provider's own key to the same
pendingSeedStore + benchProvisioner the onboarding credential step
already feeds. That drain is idempotent and restart-safe already, so
routing a Settings connect through it needed no new seeding logic, only
a new trigger.

Also threads a `baseURLOverride` through the pending-seed row end to
end (pending-seed.ts, bench-provisioning.ts) so a url-kind connector
(Ollama) deploys against the instance a person actually pointed at
rather than falling back to a curated default — fixing the same latent
gap in onboarding's own credential-step trigger along the way.
@TheGreatAxios
TheGreatAxios force-pushed the cl-provision-own-model branch from 90fc4d6 to 608be95 Compare August 22, 2026 02:26
@TheGreatAxios
TheGreatAxios merged commit f0c7874 into main Aug 22, 2026
5 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.

1 participant