Skip to content

FIX-1660: keep a row action's refusal when its request wrote nothing - #2414

Merged
jhoffner merged 3 commits into
mainfrom
fix/fix-1660
Sep 30, 2026
Merged

jhoffner merged 3 commits into
mainfrom
fix/fix-1660

Conversation

@jhoffner

@jhoffner jhoffner commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

The problem

In the DevTool's Tasks tab, some row actions refuse without changing the task, for example when the task can't be claimed. Such a refusal writes nothing to the store. The row shows the refusal at first, but once you run a second action (or anything else takes the live stream), the first row changes to "this request left no trace". A refusal should never end up looking like silence (FIX-1629, BR-15).

What this does

The panel already keeps what each request's stream delivered after the stream moves on, and uses it for requests whose stored log has items. A request whose stored log is empty went down a different path that never looked at that saved stream data. Now that path merges the saved stream data into the stored log the same way, so the refusal stays on the row.

This PR also rewrites the summary in .changeset/task-tool-actions.md (still unreleased, same packages and bump levels) as one sentence naming FIX-1629, as AGENTS.md requires. This fix belongs to that unreleased change, so it gets no changeset of its own.

What's asked of you

Nothing here is yours to decide. This is a bug fix on the direct route, and this PR is the only gate.

Parts worth reviewing closely

The rest of this is for whoever reviews the code.

  • DevToolPanel.tsx, the non-settled rawItems branch. The saved stream data is now merged into the stored log, with the stored entry winning for any item both have, instead of being skipped. I changed this branch rather than snapshotSupersedesLive because the empty-log rule there still holds for rendered items. Should a finished request with an empty stored log count as settled instead? If it should, the fix belongs in the helper. The trade-off is that its rendered items would then read [] rather than the live cache.
  • Second path: an in-flight request with a partial stored log and a stream we moved off now also gets the stream-only items appended. Before, it showed only the stored log. I think that is correct because it has strictly more trace, but it is a behaviour change.

Linear: FIX-1660 · reported on #2347 (review thread 4128539571) · merges when approved

How to review this — bug fix on the direct route

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.

Everything else — verification

New test in packages/devtool/test/devtool-panel-session-reset.test.tsx, "keeps a refusal that persisted nothing, after the stream moved on". Request A's stream sees only a transient root trace with { ok: false }. Request B then takes the stream slot. The store has A as completed with items: [].

  • Without the fix it fails: A's rawItems is [], where the refusal trace was expected.
  • With the fix it passes. The whole devtool suite passes, and so do pnpm --filter @flow-state-dev/devtool typecheck and node scripts/validate-changeset-refs.mjs.

🤖 Generated with Claude Code

https://claude.ai/code/session_014LohgYyHsXCYQd6kABH11N


Generated by Claude Code


Note

Low Risk
DevTool UI-only reconciliation of request logs; no runtime, auth, or persistence changes.

Overview
Fixes a DevTool Tasks tab bug where a row action that refuses without writing anything to the store (e.g. “task is not claimable”) showed the refusal while its stream was active, then looked like “this request left no trace” after another action took the single live stream slot (FIX-1660 / BR-15).

For requests that are not treated as settled, DevToolPanel now builds rawItems with mergeRawItems(polled log, cached stream log)—the same merge used for finished requests—so stream-only transient refusal traces from streamRawItems are kept even when items is [].

Adds a regression test in devtool-panel-session-reset.test.tsx and tightens the unreleased .changeset/task-tool-actions.md blurb (no new bump).

Reviewed by Cursor Bugbot for commit 1e3a268. Configure here.

…ing (FIX-1660)

A transient row action refused without changing the task persists no
items, so its polled log is empty and it never counts as settled. The
fallback that read its raw log then ignored the retained per-request
stream cache, and once a second request took the stream slot the
refusal's root trace was gone: the row fell back to "this request left
no trace" (FIX-1629 BR-15). The fallback now merges the retained stream
cache into the polled log, as the settled path does.

Also rewrites the task-tool-actions changeset summary as one sentence.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014LohgYyHsXCYQd6kABH11N

Copy link
Copy Markdown
Collaborator Author

@codex review


Generated by Claude Code

@vercel

vercel Bot commented Sep 29, 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 29, 2026 10:46pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Sep 29, 2026 10:46pm UTC
flow-state-dev-ui Ignored Ignored Preview Sep 29, 2026 10:46pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 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-29T22:46:38.912421Z 1e3a268 Manual request
ℹ️ 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.

@linear-code

linear-code Bot commented Sep 29, 2026

Copy link
Copy Markdown

FIX-1660

Copy link
Copy Markdown
Collaborator Author

Second-look + architecture review (read-only, for the follow-up agent)

Verdict: the fix is right and minimal. No blocking findings. Placing it in the non-settled rawItems branch, rather than changing snapshotSupersedesLive, is correct: the helper's empty-log rule still protects rendered items from being replaced by [].

Is there a better approach?

Not for the fix itself. The alternative (treat a finished request with an empty log as settled) would blank the rendered items for a refusal. That is worse than what this PR does.

Refactor opportunity worth taking in this PR (optional, small)

DevToolPanel.tsx ~L435-444: the two rawItems branches now compute nearly the same thing with different precedence:

  • settled: mergeRawItems(req.items!, live ?? stream ?? cached)
  • not settled: live ?? stream ?? mergeRawItems(req.items ?? [], cached)

The rule is now "polled log + whatever a stream saw", and only the choice of which stream source counts differs. Consider one small named helper, e.g. rawItemsFor(req, settled, …) in lib/request-status.ts next to mergeRawItems. It would make the precedence unit-testable without rendering the panel. The current inline conditional plus the growing comment block is getting hard to read. This is only worth doing if it stays a few lines; leaving it as-is is acceptable.

Second-path notes

  1. Stale cache on a resumed request (nit): streamRawItems is a per-request cache of an earlier stream. If a request goes suspended → resumed, the non-settled branch now appends any cached ids the polled log lacks. Order follows polled-then-stream-only, which matches the settled branch, so it is coherent. I did not find a case that duplicates ids (the merge dedupes by id).
  2. Test coverage: the new test covers only the empty-log refusal. The PR body names a second behaviour change (in-flight request with a partial log plus a departed stream now gets stream-only items appended). It has no test. Adding one would pin that intent (BP-035, test the changed path, not just the reported one).
  3. Rendered items still lack the refusal for this case (liveItems.get(req.id) ?? req.items ?? []). That is fine if the row renders from rawItems only for outcome. Worth confirming the row does not also read items for the "no trace" decision.

Changeset

Rewrite of .changeset/task-tool-actions.md is fine and consistent with the existing packages/bump levels. FIX-1629 in a changeset fragment is permitted per the repo's rules.


Generated by Claude Code

Process guards fails on main since #2359 put spec/_projects on it; #2392
removes it. Same deletion here, a no-op once #2392 merges.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014LohgYyHsXCYQd6kABH11N

jhoffner commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Process guards is red on this PR, and the failure isn't this PR's. validate-spec-folder rejects spec/_projects/public-launch/ on main, and main fails the same check.

I briefly ported #2392's deletion of that folder here, then reverted it in 8ad6cf4. The folder is staying on main, and the spec-folder check is being retired instead (tracked under FIX-1635). This check will stay red here until that lands.


Generated by Claude Code

@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.

Simplify review (FIX-1660)

Verdict: The functional fix is small, localized, and reuses the right primitive (mergeRawItems). I’m approving — nothing here looks like an over-built framework change. Below is where complexity comes from and what a cleaner shape might look like if you want a follow-up.

What went wrong (and why the panel is the right layer)

completed + empty polled items is intentional for a transient refusal (nothing persisted). snapshotSupersedesLive(..., [], false) correctly stays false, so the row stays on the unsettled rawItems arm. After the stream slot moves to another request, the old fallback was req.items ?? [], which dropped the only trace living in streamRawItems. Engine/store is not the place to fix this without a new “include transients on read” API — devtool reconciliation is appropriate.

Is this the simplest fix?

For the refusal case alone, extending the ?? chain would work:

liveRawItems ?? streamFor()?.rawItems ?? streamRawItems.get(id) ?? req.items ?? []

That mirrors the tail of the settled merge input and avoids mergeRawItems + the mid-expression comment.

Why mergeRawItems is still defensible (and maybe better): on the unsettled path, snapshotSupersedesLive is also false for non-terminal rows with a non-empty poll. If streamRawItems ever holds stream-only ids while req.items still has polled rows (handoff / partial poll), a plain ?? prefers the whole cache and can drop polled-only ids. merge matches what the settled branch already does. I’m not sure that scenario is common in practice — if you’ve ruled it out, the chain-only one-liner is simpler; if not, keep merge.

Where the approach feels “heavier” than the bug

The real awkwardness is structural, not this three-line tail:

  1. Terminal + empty poll uses the “unsettled” branch for rawItems while the “finished + streamed-only trace” story is already documented on the settled merge path (see the test at ~606). FIX-1660 is another special case of the same BR-15 rule, discovered because settled is false when the poll is empty.

  2. Duplicated waterfall — liveRawItems.get(id) ?? streamFor(id)?.rawItems ?? streamRawItems.get(id) appears in the settled merge and split across the unsettled arm.

Cleaner follow-ups (optional, not blockers):

  • Extract a local streamedRaw = … (or a tiny resolveRowRawItems({ settled, polled, … }) next to mergeRawItems in request-status.ts) so settled vs unsettled is “take live wholesale vs merge(polled, streamedRaw)” in one place. That documents BR-15 once instead of a new inline comment.
  • Alternative root fix: without changing items: behavior, treat “store terminal + empty poll” as settled for rawItems only (so you always hit the existing settled mergeRawItems path). That removes the unsettled special case but needs a careful predicate so you don’t resurrect stale partial live caches for suspended/interrupted rows.

Scope / tests / nit

  • The new test is valuable; it’s very close to “keeps a finished request’s streamed-only traces…” — sharing setup would shorten the file but isn’t required.
  • The test asserts rawItems only; canonical items stays [] for this row (pre-existing split). Fine if Tasks reads outcomes from raw traces; worth a one-line comment in the test if that’s intentional.
  • .changeset/task-tool-actions.md wording change looks unrelated to FIX-1660 — consider dropping from this PR to keep the diff single-purpose.

Performance

No concerns at devtool scale. Background rows may re-run mergeRawItems on stream RAF ticks; same class as settled rows already. Only worth profiling if someone opens a session with many historical rows and long traces.


Summary: Good minimal fix for the refusal regression. If you want maximum simplicity in this PR, consider the ?? streamRawItems chain only if you’re confident about the unsettled + non-empty poll case; otherwise keep merge and maybe extract the waterfall in a tiny follow-up.

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

Comment thread .changeset/task-tool-actions.md Resolved
…ired instead

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014LohgYyHsXCYQd6kABH11N
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 1e3a2682ac

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

@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 — already tight. No POC.

I read packages/devtool/src/react/DevToolPanel.tsx (the rawItems branches), packages/devtool/src/react/lib/request-status.ts (mergeRawItems, snapshotSupersedesLive), the new test in packages/devtool/test/devtool-panel-session-reset.test.tsx, and .changeset/task-tool-actions.md.

The fix is one fallback. An unsettled request now runs its poll through the existing mergeRawItems instead of req.items ?? []. The settled branch already merged, with a different source order, and those orders are the contract: a live log replaces a stale poll until the snapshot supersedes, and a settled poll wins on id and only gains stream-only traces. Folding both into liveRaw !== undefined && !settled ? liveRaw : mergeRawItems(...) is the same decisions, with the empty-log case hidden in the condition. A rawItemsFor helper would add a function and a unit test for a two-branch expression.

The new test repeats its sibling's dispatch and displace setup because an empty poll takes the other branch of snapshotSupersedesLive. A shared harness would be more code than the assertion, and folding it into the sibling would drop the settled-path check.

Nothing to subtract that still meets this contract.

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

@jhoffner
jhoffner merged commit 34afe6e into main Sep 30, 2026
12 of 13 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.

2 participants