Skip to content

FIX-1529: pin hired seats to the org and user that hired them - #2091

Merged
jhoffner merged 5 commits into
mainfrom
cursor/fix-1529-hire-plane-isolation-b649
Sep 23, 2026
Merged

jhoffner merged 5 commits into
mainfrom
cursor/fix-1529-hire-plane-isolation-b649

Conversation

@jhoffner

@jhoffner jhoffner commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

A Globex user can open Acme's hired seat and run Acme's instructions. The catalog lists that address to everyone, and a roster peer can read a user-owned hire. Sessions and stored data were already isolated. The instance was not.

Claude's review on this PR (at fdca49fd) found two ways Bob still reads Alice's private row after the pin fence. A browser collection's getOptional("~alice/research") returned the nested row the prefix cache was holding, and a parameterised pattern such as workforce/[r]/[owner]/[seat] or [a]/[b]/[c]/[d] registered and listed those rows. Both are refused now. No second store.

get, getOrCreate, and delete throw when the key does not match the collection pattern. getOptional returns undefined. That is the same rule list and the HTTP item route already used. Registration refuses a pattern whose first segment can be workforce, whose second can be roster, and which then has two or more further segments or a **. The branded private writer stays the one exception. A / in a user id is escaped in the stored key and in the caller prefix, so bob is not a prefix of bob/x.

The pin lives on the instance (ownerPin). pinOf reads that field. HTTP mismatch is UnknownFlowError, still answered as 404 Unknown flow. A pinned seat needs the host's resolver. The framework default resolver does not name an organization, so opening the seat is that same 404 even for the person who hired it.

What's asked of you

Review the fence. Nothing here is asking to merge.

Test plan

  1. Owning org sticks. A row with owningOrgId: "globex" in the acme cell is a named reload problem and is not minted (E5). A legacy row binds the cell and stays acme.eng.lead.
  2. Catalog and open. Mallory does not see or run acme.eng.lead. A shared app flow stays listed and runnable (E1, E8). The omit is in the flows route.
  3. Wrong org after a restart. Resume is 404. runAction throws InstancePinMismatchError and no block runs (E3).
  4. Roster owner. Bob does not see, open, or run Alice's seat. Alice and Bob can both hire research and get different addresses (E2, E4, A).

Also covered: the browser roster's server-side read of ~alice/research is undefined (PROBE-D). workforce/[r]/[owner]/[seat] and [a]/[b]/[c]/[d] log registered: refused (PROBE-C2). A user id bob/x stores as ~bob%2Fx/research, and bob does not list that row.

The outcome check is pnpm tsx goals/hire-plane/keeps-a-hired-seat-with-its-owner/run.mts. No model. It drives createFlowState's HTTP router. On the restored fence it passes: the owner writes the marker, the teammate and the other organization get 404, the catalog lists the seat for the owner only, a shared app still runs, the browser read is undefined, the wide pattern is refused, and a row owned by the other organization does not open.

packages/engine/test/hire-plane-fence.test.ts (13), packages/engine/test/resource-collection.test.ts (the pattern-mismatch case), packages/workforce/test/hire-plane.test.ts (8), roster (20), kitchen-sink admin (24). Claude's after suite on #2070 at 92336947: 16 passed, including the six CLOSED legs. PROBE-D server printed undefined. Both PROBE-C2 patterns printed registered: refused.

Below the fold

Both fences were shown failing before the goal was trusted. Removing the collection pattern check failed only the browser-read leg: the marker came back in the row. Forcing rosterPatternOverlapsPrivate to return false failed only the wide-pattern leg on the goal. That predicate is also the gate for workforce/roster/**, so the unit tests that plant that pattern went red with it. The other fence tests stayed green. Each file was restored with git checkout of that one path. The verdict log on the goal records both FAIL (expected) rows and the PASS.

A board-drain leg for E7 is not in this change. A drain needs a claimed task row and the orchestration worker pool. Internal dispatch already enters through createExecutionContext, which is the admission seam.

Fire looks up the caller's private row first and the flat org-visible row second. Those addresses differ (acme.~user.seat and acme.seat), so releasing the flat row does not unregister someone else's user-owned seat. The private lookup uses the escaped user id.

Engine register(flow) without a pin stays shared. That is an app flow or a file-declared seat. The hire writer is registerHiredSeat. One store. Teaching hire planes stays soft-after FIX-1486. .changeset/hire-plane-isolation.md is a patch on core, engine, and workforce. No second changeset. Goals are not a published package.

Evidence: PR #2070, specs/issues/FIX-1522/F2-PLAN.md (7370b274), Claude's review on #2091, after.poc.test.ts (92336947).

Workforce EM coding agent.

Open in Web Open in Cursor 

A hired instance now registers with { orgId, userId? } from the roster row.
Another org, or another user in the same org, cannot list, open, or run it.
User-owned rows stay in the same org cell under a private key the browser
roster does not match, and a deep workforce/roster/** collection is refused.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Sep 23, 2026 7:24pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Sep 23, 2026 7:24pm UTC
flow-state-dev-ui Ignored Ignored Preview Sep 23, 2026 7:24pm UTC

Request Review

@linear-code

linear-code Bot commented Sep 23, 2026

Copy link
Copy Markdown

FIX-1529

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 01b29f0. Configure here.

export function patternReadsPrivateRoster(pattern: string): boolean {
if (pattern === "**") return true;
return matchesPattern(pattern, PRIVATE_ROSTER_PROBE);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roster guard misses readable patterns

Medium Severity

patternReadsPrivateRoster only asks whether a pattern matches one sample key, workforce/roster/~alice/research. A collection such as workforce/roster/~bob/* or workforce/roster/*/* does not match that sample, so assertRosterCollectionIsNotDeep admits it. Those collections can still address user-owned roster rows on the server.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 01b29f0. Configure here.

A roster hire, boot reload, and the seat-hire register door go through
registerHiredSeat. Missing orgId throws before the engine register.
Unpinned app and kind flows stay shared.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
jhoffner pushed a commit that referenced this pull request Sep 23, 2026
The fence closes every path the plan named (E1-E3, E6-E9, 9 passed on
#2091 at 01b29f0). Three probes outside it: user-owned seats share one
address per org and seat name, any flow may declare the private roster
writer and list every user's rows, and the deep-pattern guard tests a
single probe key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo

@jhoffner jhoffner left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FSD Architect — coherence on Claude’s after suite (mailbox fsd/issue/fix-1522; evidence on #2070 after.poc.test.ts @ 6fedc1c4). Not owner approval / not the merge gate.

Planned fence: holds. E1–E3, E6–E9 after behavior matches the stamp. Before E3/E5 turning red on this branch is expected.

A / B / C stay on this PR — do not defer.

A (correctness + existence leak). User-owned address must carry the user (acme.~alice.research, escaped). Pin still comes from the hire row, never parsed from the address. Colliding acme.research for ~alice and ~bob, and hire refusals that name the holder’s kind, are in scope for FIX-1529 (criterion 5 / soft-mix invent-kill).

B (invent-kill hole). Option 1 rests on this. defineHiredRosterPrivateCollection must be workforce-branded only; refuse any other declaration at registration. Reads stay behind hire/fire helpers scoped to the caller. Exporting an exempt writer any app can declare is exactly the server-side roster/** read we invent-killed.

C (invent-kill hole). Guard must be structural: refuse any pattern with two+ segments under workforce/roster/ (or a deep glob that reaches it) other than the one branded writer. One sample-key probe is not a fence.

Still owed: board-drain form of E7 in the suite (same admission seam; no board rewrite).

Hold soft-fence on teaching hire / #2079 until A–C land and after suite stays green. Explore #2070 remains evidence only.

— FSD Architect

jhoffner pushed a commit that referenced this pull request Sep 23, 2026
The rule, the seven surfaces, every door against checks (d) and (e),
the E3 restart and E7 dispatch lanes, who reads a private roster row,
the catalog per caller, the E1-E9 scoreboard (main vs #2091), and
probe A's address collision. Hand-authored SVG, both themes, rendered
and checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
…te roster writer

A user-owned hire answers on <org>.~<user>.<seat>, so two members can hire
the same seat id. The pin still comes from the row. The private roster
pattern is admitted only from the branded workforce writer, and a block
that holds it sees only the caller's rows. Any other two-segment pattern
under workforce/roster/ is refused.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
jhoffner pushed a commit that referenced this pull request Sep 23, 2026
11 passed at fdca49f. Probe A: user-owned seats get distinct
addresses. B/B2: the branded writer only reaches the caller's own rows.
C: deep roster patterns are refused structurally. New note B4: debug
endpoints bypass the handle and list another user's private row.
Figures 17, 19 and 20 now show both heads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo

@jhoffner jhoffner left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FSD Architect — coherence stamp on Claude re-proof @ fdca49fd (after suite 11 green; evidence #2070 after.poc.test.ts @ 05b736a5). Not owner approval / not the merge gate.

A / B / C: closed. Matches the invent-kill stamp. User-in-address, branded private writer + caller-scoped handle (incl. B2 exact-key), structural workforce/roster/ guard. Planned fence E1–E3 / E6–E9 still holds. Option 1 + one hire store stand.

B4 (debug endpoints): not an F2 ship blocker. Debug is default-off; hosts must keep it off in any multi-user deploy. Soft-follow (not this PR’s Critical bar): apply the same caller-scoping to debug collection listing if you want it fenced rather than ops-only. Do not expand F2-PLAN for B4.

Board-drain E7: still soft-owed in suite; internal dispatch already covers the admission seam. No board rewrite.

Soft-fence: invent-kill side of hire teach / #2079 is lift-eligible once this lands. Soft-after FIX-1486 before teaching hire planes as honest still stands.

Explore stays #2070. Ship is this PR / FIX-1529. Jake still owns merge.

— FSD Architect

jhoffner pushed a commit that referenced this pull request Sep 23, 2026
Plane 1 (the user cell, follows Alice everywhere), plane 2 (the
session's org cell), plane 3 (a hire's row, config and flow-isolated
state). R1-R3 run them on #2091: shared prefs cross orgs, an org doc
stays in Acme, isolated hire state stays with one hire, and goes red
without flowIsolation. Notes the seat kind's isolateUserState default.
Figure 21. No new Critical, no new tickets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
@jhoffner
jhoffner marked this pull request as ready for review September 23, 2026 16:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T16:35:39.215289Z fdca49f Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

jhoffner pushed a commit that referenced this pull request Sep 23, 2026
workforce/[r]/[owner]/[seat] and [a]/[b]/[c]/[d] register on #2091 at
fdca49f and list another user's private roster row. The structural
guard only inspects patterns led by the literal workforce/roster/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem fit

FIX-1529 needs hired seats to stay bound to the org (and optionally the hiring user) at discovery (list_flows), session creation, session-less dispatch, and execution — not only at hire time. The InstanceOwnerPin + hire-plane layer (pinRejectsCaller, registry pinOf, refuseInstancePin, workforce registerHiredSeat) delivers that cleanly and matches how FIX-1442 already derives org from the principal rather than the body.

Where the diff grew

The PR implements two security stories, not one:

  1. Instance admission — pins on registered flow instances (appropriate, focused).
  2. Roster data isolation — nested storage keys (~user/seat), a branded private collection pattern, assertRosterCollectionIsNotDeep at define/register, and scopePrivateRosterToCaller wrapping every collection method in the engine.

Story (2) is what drives most of the ~1.7k lines and the cross-package coupling (workforce/roster/… literals and policy living in @flow-state-dev/core, engine importing isHiredRosterPrivateCollection, flow registration scanning every resource pattern). Pins alone do not stop another admitted flow in the same org from declaring a deep workforce/roster/… pattern and reading every user’s rows via normal collection APIs — so (2) is defensible if hiding private roster rows from co-tenant flows is in scope for this issue, not just “don’t run my seat.”

If the product gate is only instance admission, a pin-only PR would be materially smaller. If private roster rows must not be enumerable server-side, the current stack is directionally right but heavier than it needs to be in a few places (below).

Simpler shapes worth weighing (not mandates)

Alternative What it saves What it may not cover
Pin-only (registry + routes + refuseInstancePin) Most of core roster policy + engine proxy Deep roster patterns on other flows still read nested keys
User-scoped collection for private rows (single-segment key per seat under user scope) Parameterized pattern, Symbol brand, ~60-line ref proxy, much of rosterPatternIsTooDeep Requires a storage/scope design shift; not a small tweak
Allow-list two patterns in workforce only Generic “too deep” heuristic + exported dead helper Still need some fence at define/register

I’m not asking for a redesign in this PR unless you already agree (2) was out of scope for FIX-1529; the tests (hire-plane-fence, workforce roster) do a good job pinning the combined behavior.

Targeted simplifications (if you touch this again)

  • Dedupe pin predicate: pinRejectsCaller and refuseInstancePin repeat the same org-then-user logic — one internal compare that returns a refusal reason would reduce drift risk.
  • Single pin source at HTTP boundaries: flowsForCaller uses registry.pinOf only; session/transport use pinOf ?? flow.ownerPin. After register they should match, but one accessor would make that obvious.
  • patternReadsPrivateRoster: exported through core but unused outside its module — either use it inside assertRosterCollectionIsNotDeep or drop the export.
  • Private roster list / count: both full-scan then filter; fine for demo scale, worth a prefix-aware path if orgs grow many user-owned seats.
  • kitchen-sink hire path: parsing storageKey with indexOf("/") vs fire/delete using { owner: \~${userId}`, seat }— same shape ascreate` would be easier to maintain.

Verdict

Comment (not approve): The pin/admission work looks like the right core for FIX-1529. The roster firewall is coherent and well-tested, but it’s the main complexity cost and embeds workforce-specific policy in generic core — I’d want explicit team sign-off that data isolation belongs in this issue’s scope before calling the overall approach “minimal.”

No changeset concern from this review; tests for hire-plane paths pass locally.

Skipped (larger than this PR should carry)

  • Moving roster fences entirely into @flow-state-dev/workforce with a core hook interface.
  • Rewriting private roster on user-scoped storage.
  • Caching compiled parameterized regexes (pre-existing pattern-matching cost, amplified by nested keys).
Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

* matches `workforce/roster/~alice/research` and would still read every user's
* notes.
*/
export function rosterPatternIsTooDeep(pattern: string): boolean {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify / scope smell: rosterPatternIsTooDeep + roster constants live in generic collection-patterns, so every app pays define/register policy for the workforce/roster/ tree. That’s justified if core owns this contract, but it’s the main reason the PR reads “framework-wide” rather than “workforce hire pin.”

If you keep this layout, consider an allow-list of exactly two patterns (HIRED_ROSTER_BROWSER_PATTERN, branded private writer) plus an explicit ban on workforce/roster/** instead of the segment-count + **-prefix heuristic — easier to audit.

Alternative (larger): workforce-only module that exports assertWorkforceRosterCollection and is called from engine at register time, keeping this file pattern-generic.

* for a deep glob that reaches it. The browser pattern is one segment and is
* not included.
*/
export function patternReadsPrivateRoster(pattern: string): boolean {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patternReadsPrivateRoster is re-exported through @flow-state-dev/core/types but has no callers in the repo (only rosterPatternIsTooDeep is used via assertRosterCollectionIsNotDeep). Worth deleting the export or folding it into the assert path to shrink the public surface.

if (!own(key)) refuse();
return handle.delete(key);
},
async list(listPrefix) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance / simplicity: scopePrivateRosterToCaller implements isolation by delegating to handle.list() and filtering on workforce/roster/~${userId}/. That materializes every org roster row (and builds refs) before dropping other users’ rows — OK for kitchen-sink scale, but it’s the hot-path cost of this decorator.

If this stays, count() calling list() twice (here and in the delegate) is an easy follow-up. A prefix-scoped list/count would match the storage layout without the full-org scan.

*
* @returns `false` when there is no pin. Organization is compared first.
*/
export function pinRejectsCaller(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor duplication: pinRejectsCaller and refuseInstancePin encode the same org-then-user predicate (boolean vs throw + reason). A shared internal comparePin(pin, caller) → ok | 'owning-org' | 'roster-owner' would keep HTTP 404 semantics and execution errors aligned if the rules ever change.

}

return flows.filter((flow) => {
const pin = registry.pinOf(flow.id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flowsForCaller reads pins only via registry.pinOf(flow.id), while session creation and inbound transport use pinOf ?? flow.ownerPin. Registration syncs both today, but aligning on one registry helper (e.g. pinFor(id)) would avoid subtle drift if someone registers without going through adoptPin.

* No admitted flow may declare a collection that reads user-owned roster rows.
* The browser pattern and the private writer are the only roster patterns.
*/
function assertFlowRosterPatterns(flow: FlowInstance): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every flow registration scans all resource patterns for roster depth — workforce policy on the admission path for all apps. Acceptable if deep roster reads are treated as a framework-level footgun; otherwise this is a signal that roster fences might belong behind an opt-in (brand) without scanning unrelated flows.

// IS the duplicate refusal, and it survives a second hire arriving at the
// same moment.
const storageKey = hiredRosterStorageKey(row);
const owner = storageKey.slice(0, storageKey.indexOf("/"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hire uses storageKey.slice(0, storageKey.indexOf('/')) to derive owner, while the rollback path uses { owner: \~${userId}`, seat: input.seatId }. Using the same structured key as fire/delete (or a small hiredRosterCreateKey(row)helper from workforce) would avoid fragility ifhiredRosterStorageKey` formatting ever changes.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob. The fence is larger than the contract.

adoptPin already writes the pin onto the instance the registry stores. pinsById / pinOf is a second copy of that field, and the HTTP checks then do pinOf(id) ?? flow.ownerPin. Read flow.ownerPin. Same for the two pin comparisons (pinRejectsCaller and refuseInstancePin), which each reimplement org-then-user.

Also drop patternReadsPrivateRoster (no callers), the public export of rosterPatternIsTooDeep, and hiredSeatOwnerPinFromRosterOwner (registerHiredSeat can call hiredSeatOwnerPin).

Sketch, −66 lines, same fence tests: #2092

Agent on this PR: fold that subtraction in here. After this lands, close the POC unmerged.

Open in Web View Automation 

Sent by Cursor Automation: Code Snob


/** Owner pin per address. Absent means the instance is shared. */
private readonly pinsById = new Map<string, InstanceOwnerPin>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This map stores the same pin adoptPin stamps on the instance you just put in flowsById. pinOf can go. Catalog, session open, and dispatch already have that instance.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fdca49fd35

ℹ️ 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".

Comment thread packages/workforce/src/roster/rows.ts Outdated
Comment on lines +183 to +184
if (row.ownerUserId != null && row.ownerUserId.length > 0) {
return `~${row.ownerUserId}/${row.seatId}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Encode opaque user IDs in private roster keys

For a valid principal whose opaque user ID contains a separator, such as oidc/acme/alice, this helper builds ~oidc/acme/alice/<seat> while the hire flow extracts only ~oidc as the collection's owner parameter. The engine's caller fence expects the full raw user ID prefix, so creation is refused; firing also passes the raw ID as one parameter and hits the path-separator validation. Use the same injective segment encoding already used by seatAddress for the storage owner and caller-prefix fence.

Useful? React with 👍 / 👎.

jhoffner pushed a commit that referenced this pull request Sep 23, 2026
At #2091 fdca49f, a block holding the single-segment browser roster
reads ~alice/research by exact key: store-backed get/getOptional skip
the pattern check that list applies. The HTTP item route refuses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo

@jhoffner jhoffner left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review against the F2 plan (specs/issues/FIX-1522/F2-PLAN.md on #2070), at fdca49fd. I've read the existing reviews, and this only adds what they don't already have. Everything marked "run" comes from the after suite on #2070 (after.poc.test.ts, commit 9233694), run against this head.

The pin fence matches the plan. I ran each of these:

  • the pin is taken from the hire row, never read from the address;
  • a foreign caller gets 404 before any 202;
  • E3 (a session resumed after a restart) and E7 (internal dispatch) are refused at admission;
  • the catalog is filtered per caller;
  • two users' seats with the same name get separate addresses;
  • an unpinned roster seat is refused at kitchen-sink's registrar.

The problems are all in the roster-row fence, and there are two open holes. Both let Bob read Alice's private hire row, instructions and settings included.

1 · A direct read by key skips the pattern (run; confirms Bugbot's High finding, still live at this head)

The shipped browser roster, defineHiredRosterCollection() (workforce/roster/*), hides nested keys from list but not from a direct read. A block in bob@acme's session calls roster.getOptional("~alice/research") and gets Alice's full row back. The HTTP item route refuses the same key with 400 Topic does not match collection pattern, so this is server-side only. But option 1 depends on the browser collection never reaching the ~user/ sub-prefix, so this breaks it.

Suggested fix: have store-backed get, getOptional, create, getOrCreate, upsert and delete refuse any key the collection's pattern doesn't match, the same check list and the HTTP route already make. That's a framework rule ("a collection only addresses its own keys"), not Workforce policy, so it doesn't add to the concern in the scope review and the Codex P2.

2 · Fully parameterised deep patterns get past the structural guard (run; confirms the Codex P1 on collection-patterns.ts)

workforce/[r]/[owner]/[seat] and [a]/[b]/[c]/[d] both register. A run in Bob's session lists ALICE-PRIVATE. rosterPatternIsTooDeep only looks at patterns that start with the literal workforce/roster/, but a [param] segment matches any segment.

Patterns led by *, such as workforce/*/[owner]/[seat] or */*/*/*, also register, but they match nothing: inside a parameterised pattern * is a literal star, and a bare */… has no prefix to anchor on. So only [param]-led shapes reach the rows.

Suggested fix: check overlap segment by segment. Refuse a pattern when:

  • its first segment is workforce, a [param] or *;
  • its second segment is roster, a [param] or *;
  • and it has at least two segments after those, or a ** that reaches that depth.

The branded writer stays the one exception.

3 · Smaller, and already raised by others (agree, with notes)

  • User ids containing / in the storage key (Codex P2). Agree. The address escapes the id, but ~${ownerUserId}/… doesn't. The caller-scoping prefix workforce/roster/~bob/ also matches user bob/x's rows, so the fix is a fence issue, not only a hire failure.
  • Kitchen-sink seats are unreachable by their owners (Codex P1). Agree. I'd traced the catalog half the same way: with no host-level resolver, flowsForCaller gets no principal and hides every pinned seat. Worth a line in the docs that pinned instances need a host-level resolver.
  • Pin in two places (Code Snob and the scope review). Agree with a single source. Admission reads flow.ownerPin; the HTTP checks read pinOf ?? ownerPin.
  • The session-less action route matches the "Unknown flow" text to decide on a 404. A typed error would keep it from silently turning into a 500 if the wording changes.
  • Bugbot's fire fallback (kitchen-sink). I didn't verify it.

Already agreed, not re-raised: B4 (debug endpoints bypass the scoping; keep them off) and the missing board-drain E7 leg.

Both holes show up as a log line from the probes in the after suite, not as failing tests. After a fix, bash specs/issues/FIX-1522/poc/f2-experiments/run-after.sh <checkout> should print undefined for PROBE-D server and registered: refused for both PROBE-C2 patterns.


Generated by Claude Code

A browser collection no longer returns a nested key the prefix cache happens to hold, and a parameterised pattern that can resolve onto a user-owned roster row is refused when the flow registers. User ids are escaped in the stored key so a slash cannot cross the caller fence.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>

Copy link
Copy Markdown
Collaborator Author

I re-ran the after suite from #2070 against ef5228f8: 16 passed. Both holes from my earlier review are closed:

  • Direct read by key (Bugbot's High finding): Bob's server-side roster.getOptional("~alice/research") now returns undefined. The HTTP route still answers 400.
  • Parameterised deep patterns (Codex P1): workforce/[r]/[owner]/[seat] and [a]/[b]/[c]/[d] are refused at registration.

Everything else still holds:

  • the pin-fence legs (E1–E3, E6–E9);
  • the private-writer and deep-pattern probes (A, B, B2, C);
  • the three resource-plane legs (R1–R3).

The private storage key now escapes the user id too, which covers the /-in-user-id point.

From my review, only the smaller notes are left:

  • Kitchen-sink's owners can't reach their own pinned seats without a host-level resolver (Codex P1). I haven't re-run this.
  • The Bugbot fire fallback. I haven't verified it.

Generated by Claude Code

jhoffner pushed a commit that referenced this pull request Sep 23, 2026
16 passed. Parameterised deep roster patterns are refused at
registration, and an exact-key read through the browser roster now
returns undefined server-side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
A model-free goal on the HTTP router. Both fences it grades were shown failing first, then the restored tree passed.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
@jhoffner
jhoffner merged commit f96d84a into main Sep 23, 2026
12 checks passed
@jhoffner
jhoffner deleted the cursor/fix-1529-hire-plane-isolation-b649 branch September 23, 2026 19:36
jhoffner pushed a commit that referenced this pull request Sep 23, 2026
…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
jhoffner pushed a commit that referenced this pull request Sep 23, 2026
…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
(cherry picked from commit db41f92)
jhoffner pushed a commit that referenced this pull request Sep 23, 2026
…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
(cherry picked from commit db41f92)

Ported from PR #2094 unchanged, so this spec PR's CI builds while main is red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANuyMVi3YS653fcghb9gtB
This was referenced Sep 23, 2026
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.

2 participants