Repository navigation
Conversation
Document that ItemsRenderer puts its items array in scope for nested useSessionItems consumers, and that SessionItemsProvider is only for cards rendered outside that helper. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
Drop the receipt/reload and matching-item sentences. State that useSessionItems reads the list ItemsRenderer already scopes. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
Container renderers call useSessionItems() and render nothing under the documented FlowProvider + ItemsRenderer stack. FlowProvider has no item list; ItemsRenderer already does, so it mounts the provider. The registry session-items-context re-exports the react context so copied cards share it. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 41c50ff. Configure here.
The drift check requires installed flow-state components to stay byte-identical with the registry source. Copy the re-exported session-items context and the Approval comment that matches it. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
ItemsRenderer was replacing any outer SessionItemsProvider with its own items. RequestGroup passes a list that already dropped task-owned items, so TaskPlan expansions read that subset and rendered empty. Mount the provider only when none is already in scope. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
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-1498)
Verdict: approve. The diagnosis is right (registry-local createContext ≠ provider on the react tree), and the fix is about as small as it can be without changing every container renderer API.
Did this go too far?
I looked for a materially simpler path:
| Alternative | Why it doesn’t beat this PR |
|---|---|
Document “always wrap SessionItemsProvider” |
Fixes the guide, not the default FlowProvider + ItemsRenderer stack; easy to miss. |
Mount on FlowProvider |
No item list there without coupling to useSession; wider API. |
Pass items into Debate / EventedActors / RoutedSpecialists |
Large registry churn; TaskPlan already has an escape hatch; hooks are the established pattern. |
Always nest a provider inside ItemsRenderer |
Breaks RequestGroup → filtered ItemsRenderer + full-list TaskPlan (your second regression test). |
The extra moving part (SessionItemsGate + null sentinel) is not accidental complexity—it is the minimum way to auto-wire the common case and preserve an ancestor superset. That directly answers the earlier “filtered list hides task-owned items” concern: gate skips nesting when a provider is already mounted.
Canonical context in @flow-state-dev/react + registry/kitchen-sink re-export is the right boundary (same story as SuspensionResolver, but with a copied hub file because siblings import ./session-items-context). No new third-party package buys anything here.
Optional cleanups (non-blocking)
These are polish, not merge gates:
SessionItemsGateis exported but only used byItemsRendererand not re-exported from the package entry—consider making it module-private so it stays an implementation detail.- JSDoc overlap between the module header,
SessionItemsProvider,useSessionItems,SessionItemsGate, andItemsRendererrepeats the same composition story; could mirrorSuspensionResolver.ts(one narrative block, short per-symbol lines). useSessionItems()fallback?? []allocates a fresh empty array when no provider is mounted; a module-levelEMPTY_ITEMSconstant would stabilize referential identity for misconfigured trees/tests (minor).- Story wrappers that wrap both
SessionItemsProviderandItemsRendererwith the same full list are now redundant in many cases; trimming them later would reduce noise (keep stories that model ancestor-full + filtered-child). - Confirm ui registry build runs in CI so
public/rpicks up the re-export (source is correct; built artifacts are easy to drift).
Performance (skipped as merge blocker)
Putting session.items in context means every useSessionItems() consumer re-renders when useSession replaces the sorted array reference—same model kitchen-sink already used with a page-level provider. Worth knowing for long sessions + many container cards; selectors or getOwnedItems-style context would be a follow-up, not this bugfix.
What landed well
- Regression test encodes both the empty-card bug and the ancestor-superset invariant.
props.items(unfiltered) on the gate whilebuildItemRenderStreamfilters for display is the correct split for suspensions + owned snapshots.- Static ui test guarding against reintroducing a second
createContextis a cheap, worthwhile guardrail.
No changeset concern from this review; the react patch fragment matches the public surface change.
Sent by Cursor Automation: Review For Best Approach
| * Used by {@link ItemsRenderer}. A filtered `items` prop must not hide a | ||
| * fuller list an ancestor already provided. | ||
| */ | ||
| export function SessionItemsGate(props: { |
There was a problem hiding this comment.
Simplify (optional): SessionItemsGate looks like an ItemsRenderer implementation detail. It is not on index.ts, but export function still invites deep imports. Dropping export (or colocating the gate next to ItemsRenderer) would keep the public API to SessionItemsProvider / useSessionItems only.
| * Reads the nearest session item list, or `[]` when no provider is mounted. | ||
| */ | ||
| export function useSessionItems(): OutputItem[] { | ||
| return useContext(SessionItemsContext) ?? []; |
There was a problem hiding this comment.
Simplify (optional): ?? [] creates a new array on every call when no provider is mounted. A shared const EMPTY_ITEMS: OutputItem[] = [] (used only for the missing-provider case) avoids surprising memo deps in misconfigured trees. Not an issue on the happy path where ItemsRenderer or an ancestor provider is present.
| return createElement(ItemRenderer, { item, key: item.id }); | ||
| }); | ||
|
|
||
| return createElement(SessionItemsGate, { value: props.items }, nodes); |
There was a problem hiding this comment.
Using props.items here (not the filtered stream) is the right call—container/HITL hooks need owned snapshots and suspension pairing from the same array you pass in, while SessionItemsGate ensures you do not replace a fuller ancestor list. Worth keeping that invariant obvious in code review because it is easy to “simplify” incorrectly to stream items.
| * when rendering stream-aware cards outside `ItemsRenderer`. | ||
| */ | ||
| export { | ||
| SessionItemsProvider, |
There was a problem hiding this comment.
Re-export-only file is the right fix for duplicate context identity. If you want one more simplify pass later: stories that wrap the same full list in both SessionItemsProvider and ItemsRenderer can drop the outer provider now that the gate exists—except stories that intentionally model ancestor-full + filtered-child (RequestGroup / TaskPlan).
There was a problem hiding this comment.
Code Snob — too small to shrink. No POC.
I read packages/react/src/context/SessionItemsContext.ts, packages/react/src/components/ItemsRenderer.ts, packages/react/src/context/SuspensionResolver.ts (the sibling provider), packages/react/test/items-renderer-session-items.test.ts, packages/ui/registry/components/session-items-context.tsx, packages/ui/test/session-items-context.test.ts, and the README / docs edits that correct the old “wrap it yourself” instructions.
The contract is: ItemsRenderer supplies props.items only when nothing is mounted, an explicit SessionItemsProvider can still set a list, useSessionItems() is [] when absent, and the registry file re-exports that one context.
SessionItemsGate is the extra piece past SuspensionResolverProvider, and it has to stay a separate check. The null sentinel is not the same as [] (an empty list is a real mounted value), and putting the check inside SessionItemsProvider would make a nested provider a no-op. Inlining the gate into ItemsRenderer only moves those lines into the function that already groups the stream and matches suspension resumes.
The registry file is a re-export. The kitchen-sink copy is the byte-identical twin the drift check requires. The source-text test is the pin that the re-export does not grow a second createContext.
Sent by Cursor Automation: Code Snob
…provider-flow-15a6 Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d98c4b023
ℹ️ 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".
| const mounted = useContext(SessionItemsContext) !== null; | ||
| if (mounted) return props.children ?? null; |
There was a problem hiding this comment.
Let nested renderers establish their own session scope
When a child or background session's <ItemsRenderer items={child.items}> is nested beneath a provider for the parent session, this presence-only gate keeps the parent's list. Stream-aware renderers in the child then cannot find child-owned container snapshots or suspension-resume items, producing empty or unresolved cards. This is a normal composition for the child-session detail documented in packages/react/README.md; preserve an ancestor only when it represents the same stream, or provide an override for the nested renderer.
Useful? React with 👍 / 👎.
| export function useSessionItems(): OutputItem[] { | ||
| return useContext(SessionItemsContext) ?? []; |
There was a problem hiding this comment.
Reuse a stable empty items array
When useSessionItems() is called without a provider, this expression allocates a new array on every render. A consumer that treats the returned list as a dependency—for example, an effect that updates derived state—will observe a change on every render and can enter a render/effect loop even though the item list remains empty; memoized derivations also recompute unnecessarily. Return a shared empty constant or use a stable context default.
Useful? React with 👍 / 👎.
Discover and seat hire read .manifest on a result that may be a RowProblem, which fails the workforce build. Skip a roster row owned by another org, and surface that reason when a hire cannot mint. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
jhoffner
left a comment
There was a problem hiding this comment.
Architect call — #2080
Verdict: change-request. FIX-1498 approach is coherent with the locked mount (ItemsRenderer + gate + registry re-export); ancestor-superset regression is the right guard. Blocker: this branch also ships workforce hire/manifest cross-org skips unrelated to the PR title/body — strip or split those before merge. Nested child-session under a parent provider remains a known gate limit (non-blocking follow-up).
Not owner approval / not the merge gate.
— FSD Architect
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Architect: not approving yet. The branch has merge conflicts with main, and two current Codex P2 threads are unanswered: |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Closing per Jake. This has gone stale (merge conflicts), and Codex's P2 on nested child sessions was never fixed. The bug is still open and is now tracked in FIX-1498, refreshed with the chosen direction, the same-session check for nested renderers, and a stable empty array. — FSD Architect |



An adopter who copies FlowProvider + Conversation + ItemsRenderer and drops in EventedActors, Debate, or RoutedSpecialists gets a blank card. Those renderers read
useSessionItems(), which is[]unless a provider is mounted, and FlowProvider never mounts one.ItemsRenderernow mountsSessionItemsProviderwith the list it is already rendering. The documented stack is unchanged. Copied registrysession-items-contextre-exports the same context from@flow-state-dev/react. TaskPlan'sitemsprop stays as the out-of-stream escape hatch.What's asked of you
Nothing here is yours to decide. The mount point (ItemsRenderer, not a second provider on every app) was the locked direction. This PR is the review gate.
Parts worth reviewing closely
This is for the code reviewer. The weak spot is the copied file: an adopter who already has a local
session-items-context.tsxstill has a different context until they re-add that component. Kitchen-sink copies were left alone (FIX-1455).Links: Fixes FIX-1498 · Closes #2020
How to review this — altitude, what's in scope, what's deliberately unsettled
How to review this. This is a bug fix on the direct route: there is no spec and no spec PR, because the hard part was the diagnosis and it happened in code. This PR is the only gate, so unlike a spec-backed change, the approach is in scope — nothing here was signed off upstream.
Most valuable here: the diagnosis chain — does the repro actually reproduce the reported failure, is the named cause the real one, does the fix address that cause rather than the symptom, and does the regression test fail without the fix? Then the second path (the legacy shape, the null boundary, the concurrent case, the cancel path).
In scope to challenge: where the guard was placed, any behaviour change a user could notice, and whether this should have been a spec'd feature instead of a fix.
Engineering calls — decided along the way, no product sign-off needed
ItemsRenderer, notFlowProvider. FlowProvider has no item list;useSessionlives below it. Wrong call costs a second items prop on every app or a session subscription inside FlowProvider.createContext. A second context would leave copied cards reading[]even after the mount.itemsprop on EventedActors / Debate / RoutedSpecialists. TaskPlan keeps its existing escape hatch.ItemsRendererreturn type is nowReactNode(one provider root) instead ofReactNode[].Verification
Regression
packages/react/test/items-renderer-session-items.test.tsfailed without the provider wire (Unable to find [data-testid="container-probe"], empty body) and passed afterItemsRendererwrapped withSessionItemsProvider value={props.items}.pnpm --filter @flow-state-dev/react test— 26 files, 220 passed.pnpm --filter @flow-state-dev/react typecheck— exit 0.pnpm --filter @flow-state-dev/ui test— 9 files, 61 passed.pnpm --filter @flow-state-dev/ui typecheck— exit 0.fix-1498-regression-red-green.log
No changeset needed for
@flow-state-dev/ui(private). Patch changeset on@flow-state-dev/reactfor the new exports and the ItemsRenderer behavior.To show artifacts inline, enable in settings.