Repository navigation
fix(workforce): one unaddressable hired row no longer bricks the reload (FIX-1536) - #2104
Conversation
…rejecting the boot (FIX-1536)
An app with no principal resolver runs as DEFAULT_ORG_ID, so a runtime
hire leaves a row in a cell whose id is not a legal address segment.
reloadHiredSeats built the seat address outside its per-row guard, so
seatAddress's throw escaped and rejected the whole reload -- every org's
team, not just the bad row. A seat id carrying the user-owned "~" marker
failed the same way.
Cause (the hypothesis that held): hiredSeatManifest throws for a bad org
or seat id by contract ("this deploy's mistake"), and reload.ts only
guarded hireWorkforce, not the manifest build. Now the manifest build is
guarded too and the throw becomes one named problem in the same
`organization "<org>", row "<key>" -- <reason>` shape the owning-org
mismatch already uses. The owning-org fence runs first inside
hiredSeatManifest and is unchanged: a row stamped for another org is
still refused, never re-bound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
…call sites main has been red since ffe2b6e. #2091 (FIX-1529) changed hiredSeatManifest to return `{ manifest } | RowProblem`; #2079 (seat-hire catalog tools), merged minutes later, added two call sites that read `.manifest` without narrowing, so @flow-state-dev/workforce no longer compiles. Both now handle the problem case the way roster/reload.ts already does: - manifest-sources: a row owned by another org is skipped when listing seats, alongside the unparseable-row skip on the line above. - seat-hire-capability: the hire refuses with the row's reason. Verified: the workforce build fails on main with exactly CI's four TS2339 errors and passes with this change; workforce 755/755; pnpm typecheck 70/70. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Zc4qjodAcrYK5kMfcrXS8
…oad with a goal Real path, no model: an app with no resolver hires through its HTTP action (the row lands under DEFAULT_ORG_ID), a signed-in org hires through the same action, and a restarted app reloads both orgs. The signed-in org's seat comes back, registers and answers; the dev row is one named problem; a row stamped for another org is still refused. Control: reverting reload.ts to ffe2b6e fails leg (c) only. Also names the address case in reload.ts's header and where hiredSeatManifest's throw is caught. 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
|
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.
Simplify / review (FIX-1536)
Verdict: approve. The reload change is the smallest fix that matches the documented contract (problems per skipped row; only cap/timeout/store read fail the boot). I do not think the PR over-built relative to the bug.
Did the approach go too far?
Mostly no. The production delta that matters is a per-row try around hiredSeatManifest plus two focused vitest cases. That is proportional to a dual-outcome API: org mismatch returns { problem }, bad address materialization throws from seatAddress (see rows.ts JSDoc and existing hire-plane.test.ts throw expectations).
The heavier surface is the new hire-plane goal (~272 lines). It overlaps roster.test.ts on reload semantics, but it is not redundant work: the goal adds HTTP hire → shared store → restart → register → answer, plus a source-revert control. That matches other goals/hire-plane/* runners (sibling goal is ~340 lines). I would not ask to delete the goal to “simplify” unless CI time becomes painful; trimming would mean extracting shared HTTP helpers in goals/lib, which is a cross-cutting refactor outside this bug.
The #2094 cherry-pick (manifest-sources / seat-hire-capability) adds scope noise but is explained in the PR body; the if ("problem" in record) continue in discover is a real guard (without it, record.manifest.id on a mismatch row is unsafe). It is not the reload fix.
Cleaner alternative (considered, not required here)
The structurally simpler long-term shape is one row-level outcome in rows.ts: map seatAddress failures to RowProblem (or export something like boundHiredSeatManifest that never throws), then every walker only checks "problem" in ….
Why staying with reload-local try/catch is defensible: interactive hire paths already call seatAddress first and treat throws as deploy-time mistakes; changing hiredSeatManifest to never throw is a public contract shift across kitchen-sink, tests, and hire tools. Your PR description already records that call. I agree with it for this bug route.
Follow-up (you already flagged): seatsSource still has no try around hiredSeatManifest, so an unaddressable row under the dev org can still break that org’s manifest listing even though reload is fixed. Worth a small ticket unless #2094 merge makes it moot.
Optional nit if more walkers appear: a tiny shared helper (parse + bind + normalize throws → reason) would dedupe reload and discover without pulling in hireWorkforce.
Performance
No concerns: per-row try/catch is negligible next to sequential org prefix reads and per-row hireWorkforce; goal polling is test-only.
Skipped (would need product / wider refactor)
- Making runtime hire on
DEFAULT_ORG_IDsucceed (this PR correctly fixes boot, not unauthenticated hire semantics). - Replacing the goal with workforce integration tests only (loses the HTTP anti-game path).
Nice diagnosis chain and control in goal.md. Ship when CI is green.
Sent by Cursor Automation: Review For Best Approach
There was a problem hiding this comment.
Code Snob. The reload fix can be smaller.
reloadHiredSeats already catches a per-row hireWorkforce refusal and records `${where} — ${messageOf(error)}`. The new try around hiredSeatManifest does that same record-and-skip, and the comment above it repeats the file header: an org or seat id that cannot be an address is one named problem, and it must not reject the boot.
Put hiredSeatManifest in the existing try, ahead of the owning-org problem check. A throw is still one problem. A row stamped for another org still returns problem and is not hired. The second catch, the let, and that comment go away.
Shape sketch: #2110 (roster.test.ts 22 passed, including the unaddressable row and the cross-org stamp; hire-plane.test.ts 8 passed). That PR does not merge.
Agent on this PR: fold the subtraction into this branch, and close the POC unmerged after this PR lands.
Sent by Cursor Automation: Code Snob
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 603dc88216
ℹ️ 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".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
…s skipping an unaddressable row (FIX-1536) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
|
from: epic-lifecycle Two lines in the description are now out of date:
The reload simplification from #2110 is folded in (ab86bb8), and #2110 can be closed once this merges. Generated by Claude Code |


The problem. An app with no authentication runs every request as the reserved development org. When it hires a seat at runtime, the stored row sits under an org id that can't be part of a seat address. At the next boot,
reloadHiredSeatsthrew on that one row and rejected the whole reload, so every other org's hired seats disappeared too, not just the bad row.What this does. The reload now treats an unaddressable row the same way it already treats a gone kind or a row stamped for another org: it skips it and reports it in
problemsasorganization "<org>", row "<key>" — <reason>. Every other row still reloads. The owning-org fence from #2091 runs first and is unchanged, so a row stamped for another org is still refused and never re-bound to a cell where it could be addressed. The same guard covers a stored seat id that starts with the user-owned~marker, which failed the same way.What's asked of you. Nothing new to decide. The product call is already recorded on the issue: the development org stays unaddressable, and a user's private team stays in the org it was built in. This fix doesn't remap, promote or repair the row.
Parts worth reviewing closely (for the code reviewer):
packages/workforce/src/roster/reload.ts: the manifest build moved inside a per-rowtry. The store read and the org-cap and timeout rejects sit outside the loop and still fail the boot, as they should.seatsSourceinmanifest-sources.tscallshiredSeatManifestwithout atry. Under the development org, listing the seats manifest still throws for that org. It doesn't affect other orgs, because that path is scoped to one org per request, and the issue scopes the fix to reload. It's listed as a follow-up below rather than fixed here.636542bc6isdb41f92from docs(process): point corrections at issue-implement 10.6's sweeps #2094, cherry-picked becausemaindoesn't compile@flow-state-dev/workforce(FIX-1529: pin hired seats to the org and user that hired them #2091 and Seat-hire catalog tools, and Discover lists the seats they mint #2079 collided: TS2339.manifest). It touchesmanifest-sources.tsandseat-hire-capability.tsonly, not the reload or rows code. It becomes a no-op once docs(process): point corrections at issue-implement 10.6's sweeps #2094 merges.Fixes FIX-1536 · bug, direct route (no spec) · goal:
pnpm tsx goals/hire-plane/reload-survives-an-unaddressable-row/run.mts→ PASS; control (reload.tsreverted toffe2b6e26) → FAIL on leg (c) onlyHow to review this
Diagnosis and engineering calls
Cause.
hiredSeatManifestthrows by contract when the org or seat id can't form an address (seatAddress→validateSegment).reloadHiredSeatsonly wrappedhireWorkforcein its per-rowtry, not the manifest build, so the throw escaped the loop and rejected the whole call.Engineering calls (no approval needed):
hiredSeatManifest. The other option was to makehiredSeatManifestreturn aRowProblemfor a bad address. That would change a contract that the live hire paths (seat-hire-capability, kitchen-sinkworkforce-admin) depend on to throw on this deploy's mistake. It would also turn theirrecord.manifestintoundefinedwherever a caller doesn't narrow. If this call is wrong, one more caller that walks stored rows needs its owntry. That's theseatsSourcefollow-up.~seat id in a legal org for free. The cost of a wrong call is only a noisierproblemslist for a dev org with many rows.apps/docs/docs/workforce/durable-hire.mdand the workforce README already sayproblemsholds one entry per row that didn't become a seat, and that only the org cap, the timeout and a failed store read reject. The fix makes the code match that contract. Only the internal file headers were touched.Follow-up (not filed):
seatsSource(manifest-sources.ts) still throws on an unaddressable row when listing a development-org session's seats manifest.Verification
Red, before the fix (
packages/workforce/test/roster.test.ts→ "skips a row it cannot address, and still serves every other org"):Green, after: both new tests pass; the full workforce suite is
48 files, 757 passed. Kitchen-sinkworkforce-admin.test.tsis 24/24. Turbotypecheckfor workforce and its dependents, plus kitchen-sink, is 27/27 (with the ported fix). Thegoalspackage passestsc --noEmitwith 0 errors.Blast radius for the fence test. The test "still refuses a row stamped for another org" was green before the fix, so I broke the property it claims instead: I disabled the owning-org mismatch check in
rows.tsand boundowningOrgIdto the cell. Exactly two tests went red: the new fence test and the existinghire-plane.test.ts→ "E5 a row claiming another org is a named problem and is not registered". The other 755 stayed green. I restoredrows.tsafterwards.Goal (real path, HTTP router, in-memory store, no model).
__fsd_default_org__. The reload over[__fsd_default_org__, acme]returned["acme.support.ada"]and 2 problems.acme.support.adaanswered an action after the restart. The dev row was named, and the row stamped forglobexwas refused (cannot be registered under "acme").reload.tsatffe2b6e26):FAIL — [c] reload rejected, so no org's seats came back: Organization id "__fsd_default_org__" must be .... Only leg (c) failed. Legs (a) and (b) completed, which confirms the dev hire really does write under the default org through the HTTP path.FSDEV_DEFAULT_MODELwas unset for local vitest runs. With it set, 73 unrelated tests fail withcreateModelResolver: FSDEV_DEFAULT_MODEL was set, but no intents are declared. That comes from this session's environment, not from this change.🤖 Generated with Claude Code
https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
Generated by Claude Code
Note
Medium Risk
Changes boot-time roster reload behavior for multi-org deployments; incorrect handling could still drop seats or admit bad rows, but scope is degrade-on-skip with existing owning-org fence and strong regression coverage.
Overview
Fixes FIX-1536: when
reloadHiredSeatshit a roster row whose org or seat id cannot form a seat address (e.g. hires underDEFAULT_ORG_IDfrom an unauthenticated app, or a seat id starting with~),hiredSeatManifestthrew and aborted the entire reload, so every other org lost their seats at boot.reloadHiredSeatsnow wraps manifest construction in a per-rowtry/catchand records those failures inproblemslike other bad rows, while valid rows still hire. The owning-org mismatch path is unchanged—rows stamped for another org still refuse withcannot be registered under.Related hardening:
manifest-sourcesskipsRowProblemmanifests when merging hired roster into discover;seat-hirethrows if manifest build would be a problem. New vitest cases cover unaddressable default-org / tilde seat ids and cross-org stamps; a hire-plane goal exercises HTTP hire + reload + post-restartanswerend-to-end.Reviewed by Cursor Bugbot for commit 603dc88. Configure here.