Skip to content

CL-6556: dev seeder fails loudly; picker no longer dead-ends on setup-agent race - #268

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-seed-race-fix
Aug 22, 2026
Merged

CL-6556: dev seeder fails loudly; picker no longer dead-ends on setup-agent race#268
TheGreatAxios merged 4 commits into
mainfrom
cl-seed-race-fix

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • scripts/dev.ts's account seeding used to poll for hub readiness, then silently proceed even on timeout, and swallow every subsequent failure behind one console.error line. This is exactly what left the seeded alice@example.com account created but with none of her default agents ever deployed (0 rows in workflow_definition), with nothing visible pointing at why. It now fails the whole dev bootstrap loudly on either a readiness timeout or a real seeding failure.
  • Added a regression test proving provisionPersonalTenantIfNeeded's existing sign-in reconcile path recovers a tenant with zero workflow-definition rows into a live assistant deployment — verified via the same read findMyraDefinition and the /provisioning-status route depend on, not just "seedTenant was called".
  • The template picker (new-workbench-picker.tsx) threw the raw, system-vocabulary WorkbenchPreconditionError message ("No default setup agent found for this workbench.") straight into a toast the moment a person clicked a template on a bench whose default agents hadn't finished deploying yet. WorkbenchPreconditionError now carries a kind discriminant so the picker can check fetchAgentReadiness() before treating that specific precondition as a dead end, showing a retryable "Still setting up your workbench" state instead.

Root cause

Live data showed tenant tnt_b780a4d8050c8d679f107642809ab7ab ("alice's team") with 0 rows in workflow_definition versus 11 for a tenant that completed real onboarding. provisionPersonalTenantIfNeeded already reconciles missing DEFAULT_WORKFLOWS on every sign-in when a hub-owned seed model is configured — the gap is (a) the dev seeder's own race left the account created without ever reaching that reconcile path cleanly, and (b) nothing gated the create-UI on readiness, so the failure mode a person actually saw was a raw internal error rather than an honest wait state.

A follow-up ticket (CL-6556) covers the harder product question: in the self-serve shape with no hub-owned seed model, a brand-new tenant genuinely can't have a deployed assistant until the person supplies their own inference credential — this PR makes that wait honest, not instant, since a workflow cannot deploy without a model.

Test plan

  • bun test in packages/onboarding (166 tests, includes the new regression test)
  • bun test in apps/web for the touched files (instant-agent-create.test.ts, new-workbench-picker.test.ts, test/new-workbench-picker.test.tsx)
  • bun run typecheck in both apps/web and packages/onboarding
  • bun run check:structural at the repo root
  • bunx eslint + bunx prettier --check on all changed files

https://linear.app/abklabs/issue/CL-6556/onboarding-first-sign-in-can-hit-no-default-setup-agent-found-with-no

Reproduces the live bug verbatim (a personal bench with a real
membership and 0 rows in workflow_definition) and asserts on the same
read findMyraDefinition and the /provisioning-status route depend on
(an "assistant" asset with a live deployment) after
provisionPersonalTenantIfNeeded runs with a seed model — not just that
seedTenant was invoked.
The dev bootstrap's readiness wait for the hub could time out and fall
straight into the sign-in/sign-up attempt anyway, and every failure
past that point only logged one line and returned — the exact shape
that left alice@example.com created but with none of her default
agents ever deployed, and nothing on screen to say so. A timed-out
wait or a real seeding failure now exits the whole dev bootstrap
loudly, matching every other prerequisite check in this script.
…error

Clicking a template before this bench's default agents finish
deploying threw "No default setup agent found for this workbench." —
system vocabulary describing an internal precondition, shown at the
exact moment someone first tries to do anything. The picker now
checks agent readiness before treating that precondition as a dead
end, and shows a retryable "still setting up" message instead of a
toast with the raw error. WorkbenchPreconditionError gains a `kind`
discriminant so this only applies to the missing-setup-agent case, not
a genuinely unavailable template.
stubFailingCreate served an empty definitions list, so every "failed
create" test was actually hitting the missing-setup-agent precondition
before any create request was sent — CL-6510's retry-panel change
correctly stopped that path from toasting, which is what broke this
suite. The stub now serves a deployed assistant definition so the flow
reaches the real create request and that 500s instead, restoring the
suite's actual purpose: proving exactly one toast fires on a genuine
create failure. Also pins the new contract directly: a missing setup
agent shows the retry panel and fires no toast at all.
@TheGreatAxios
TheGreatAxios merged commit c40d837 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