Repository navigation
fix(kitchen-sink): hired seats answer the admin credential that hired them (FIX-1548) - #2148
Conversation
… them (FIX-1548) A seat hired over workforce-admin is pinned to the org and user the admin token resolved, but the seat itself carried no resolver. Every request to it fell to the framework default, which names the default org, so the pin refused even the operator who had just hired it. The roster door (workforceRegistrar.registerFromRoster) now installs the admin flow's own resolver on each seat instance it admits, covering the admin hire, the boot reload, and seat-tool hires. The pin and fences are unchanged: another org's token is still refused (404), and no token gets 401. Adds an HTTP-level regression test through createFlowState's router: hire, then open/run the seat with the same token, including after a restart reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_e074fadf-9377-4927-a8fc-eca16d4c2ea6) |
…he host A hired seat checks every request against the principal that hired it, and that principal comes from the seat's own authentication or the host's. The page told readers to put the resolver on the host, which applies it to every flow the host serves. It now says to put it on the seat where the app registers it, and the registerSeat example does so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
The durable-hire page now states the limit of putting the hiring resolver on the seat, names the default-organization mismatch that produces the 404, and stops promising every member access to an org-visible seat when the example registers it with the admin resolver. The calling example sends the admin token. The kitchen-sink README's address example names the seat its hire and call examples use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
…1 (FIX-1548) The README promises 401 with no token. Pin that instead of accepting 401 or 404. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a082bb3958
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… app (FIX-1548) The route-auth section told readers to install the hire flow's resolver at the host. In a mixed app whose other flows stay on the development default that breaks them: the engine recognises the development default by the resolver that runs, so a host resolver delegating to the default refuses tokenless callers on actions, management routes and listings. The section now says to install it at the host when every flow authenticates, or on the seat instance otherwise, and states the listing consequence of the latter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a082bb3958
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…1548) Every configured token for an organization resolves to the same admin principal, so the pin cannot tell them apart. Say so rather than imply the seat is bound to the hiring token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
Resolve the kitchen-sink README: keep PR-B's pinned-token paragraph and fold in #2148's hired-seat paragraph re-keyed to kitchen-sink (kitchen-sink.~workforce-admin.support.bo; no token gets 401; the other-organization 404 no longer applies because such tokens are refused at boot). Move #2148's hired-seat-auth.test.ts off acme/bravo to the pinned organization; its other-org case becomes a token refused at boot, answered 401 at the seat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ANuyMVi3YS653fcghb9gtB
The problem
In the kitchen-sink, an operator who hires a seat at runtime (through
workforce-admin'shire, with their admin token) can't use it. Opening a session with the seat, or sending it an action, comes back404 Unknown floweven with the same token that hired it. The seat is pinned to the operator's organization, but it heard every request as the framework's default organization, so its own pin turned the operator away. The reference app's runtime-hire story stopped at "hired" and never reached "used".What this does
Every seat the app admits from a roster row now resolves its callers with the same admin credential the
workforce-adminflow uses. A request carrying the hiring token resolves to the hiring organization and user, which is exactly what the seat is pinned to, so it's served. The pin itself is unchanged. Another organization's token still gets the404an unknown address gets, and a request with no token now gets401. It was refused before too.This applies to seats hired by the admin action, seats brought back by the boot reload, and seats hired by another seat's
hiretool. All three go through the same door. The app's open flows and the file-declared seats are untouched.What's asked of you
Nothing here is yours to decide. This is a bug fix and this PR is where it gets reviewed.
Parts worth reviewing closely
apps/kitchen-sink/lib/workforce-registrar.ts→registerFromRoster: the one-line change that wraps each admitted seat. Check it is the only admission path for pinned seats.hire, the boot reload infsdev.config.ts, andkitchenSinkSeatHireOptions.registerall go through it.apps/kitchen-sink/lib/workforce-admin-auth.ts→withAdminAuthentication: it copies theFlowInstancewith anauthentication.resolvePrincipaladded. Instances are plain objects (core'screateFlowInstancereturns a literal), but review whether anything downstream depends on the object the hire minted being the same one the registry holds. Nothing I found does:fireandkindAtgo by address.userIdandorgIdin the body and are still refused.Links: Linear FIX-1548 · follow-on to FIX-1529 (#2091, the pin this respects) · framework follow-up FIX-1552 · Bug route, no spec · merges after review.
How to review this
fix/<ISSUE-ID>, merges)Engineering calls
resolvePrincipaloncreateFlowStatewould govern every flow that has no resolver of its own. In this app that includeschat-agent,rich-text-component, the channels and the file-declared seats, all of which the browser reaches asdevuserwith no token. Putting the admin token in front of them would break the demo. A host resolver that falls back to the default for tokenless callers doesn't work either (next point). A resolver on the kind has the same problem for the file-declared seats of that kind. The seat instance is the one place that covers exactly the pinned seats. It uses core's existing instance-levelauthenticationoverride, so there is no new mechanism.defaultBodyUserIdPrincipalResolver). A probe oncreateFlowStatewith chat-agent showed it breaks every tokenless open flow, because the engine recognises the development default by the resolver's brand (isDefaultBodyUserIdPrincipalResolver), and a wrapper that delegates to the default carries no brand:host.resolvetreats the composite as a configured resolver, finds no verified org, and answers 401 "Request requires a verified organization".route-authturns enforcement on, calls the resolver with no body, the default branch returns null, andrequireUseranswers 401. Creating a chat-agent session asdevusergoes from 201 to 401.GET /sessionsgoes from 200 to 401 by the same path, which is the disabled-composer failuremanagement-routes-reachable.test.tsguards.docs/architecture/authentication.md(route-auth section) said to install the hire flow's resolver at the host. It now says: at the host when every flow authenticates, or on the seat instance in a mixed app. It also says why a delegating host resolver fails, and that the seat then stays out of the catalog and host listings.kindsmap passed tohireWorkforceandreloadHiredSeats, so the resolver goes in at mint time through the factory's instance options. That needs a wrapped callable that copies the kind's blueprint metadata, in two places, and it misses the seat-tool path. The door already exists because all three paths have to agree (it holds the provenance markfirerelies on).undefinedand the seat is left alone. The pin then refuses everyone, so it fails closed.FlowInstance.authentication,registerHiredSeat). A Lab or another host does the same in its ownregisterSeat. A first-classauthenticationoption onhireWorkforce/reloadHiredSeatswould be the framework-level version. That is out of scope here (kitchen-sink wiring only), and noted below.Everything else
Verification (all with
FSDEV_DEFAULT_MODELandFSDEV_INTENT_*unset)New test
apps/kitchen-sink/test/hired-seat-auth.test.tsdrives the real router fromcreateFlowState. It installs the registrar over the FlowState's own door asfsdev.config.tsdoes, hiressupport.bo(adesk-clerk) over HTTP with acme's admin bearer token, then:404 Unknown flow201answeron the seat, acme token404 Unknown flow202→completedanswer, acme token404 Unknown flow202→completed404404(unchanged)401(asserted exactly)mainthe three positive cases fail with404 Unknown flow "acme.~workforce-admin.support.bo"and the two refusal cases pass.withAdminAuthentication(...)call inregisterFromRosterreverted toimpl.register(seat, { pin }), exactly the three positive cases go red (3 failed / 2 passed). Restored, 5/5 pass.apps/kitchen-sinksuite: 20 files, 147 tests passing (including the existingworkforce-adminandmanager-seatsuites, which exercise the same registrar).pnpm turbo run typecheck --filter=@flow-state-dev/kitchen-sink: passes.Second paths (BP-035)
undefined, so seats are left as they were. A reloaded seat whose org has no admin token is still pinned and still refuses. Fail-closed, as before.manager-seat.test.ts'sdesk-lead) are still refused for the admin token by the pin's user half.GET /sessionslistings. That's tighter than before, not looser.Left alone: framework follow-up FIX-1552
GET /api/flowswith the acme token listsworkforce-adminbut not the hired seat; a throwaway probe confirmed it. The catalog (flowsForCallerinpackages/engine/src/routes/http-handlers.ts) and the host listings resolve the caller with the host resolver only, which is the default here. FIX-1552 is the framework follow-up: either the catalog and listings honour per-instance resolvers, or the engine offers a supported fallback combinator for host resolvers so a mixed app can set one without breaking its open flows. Opening and running the seat, which is what this bug is about, work now.hireWorkforce/reloadHiredSeatstake noauthenticationoption, so a host can't set a seat's resolver at mint time without wrapping kinds. Not needed for this fix.Docs changed
docs/architecture/authentication.md: one sentence in the route-auth section, as above.apps/docs/docs/workforce/durable-hire.md: install the hiring resolver on the hired seat (registerSeat) rather than host-wide. The page says who the seat then answers, and the calling example sends the admin token. Awaiting a docs-editor pass.apps/kitchen-sink/README.md: a curl showing the hired seat answering the hiring token, the refusals, and the user-owned address form (acme.~workforce-admin.support.bo).Changeset: none. The kitchen-sink is private and no published package changed (BP-022).
Files
apps/kitchen-sink/lib/workforce-admin-auth.ts:withAdminAuthentication(seat, resolver)apps/kitchen-sink/lib/workforce-registrar.ts: module-scopehiredSeatResolver;registerFromRosterwraps the seatapps/kitchen-sink/test/hired-seat-auth.test.ts: new, HTTP-levelapps/kitchen-sink/README.md: runtime-hire sectionapps/docs/docs/workforce/durable-hire.md: resolver on the seatdocs/architecture/authentication.md: where a hired seat's resolver goes🤖 Generated with Claude Code
https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D