Skip to content

feat(claude-code-style): dismiss a failed thread so it stops waiting on you (FIX-2579) - #4820

Merged
jhoffner merged 8 commits into
mainfrom
claude/project-thread-auxztt
Nov 10, 2026
Merged

jhoffner merged 8 commits into
mainfrom
claude/project-thread-auxztt

Conversation

@jhoffner

@jhoffner jhoffner commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

Part of FIX-2579 (problems 2 and 3 of the widened issue). The label fix (problem 4) shipped in #4813. Problem 1, a finished run marked Failed, waits on the error text from Jake's run and gets its own PR.

Problem

A failed thread lands under Waiting on you (columnOf: errored → waiting), and its view offers only Retry. A failure you've already read, or one whose work landed anyway (Jake's "Align task info to flyout popup", which opened #4798), stays in your list, and in the session's "N waiting on you" count, indefinitely.

Change

This builds the option recommended on Jake's decision card in the thread. If he picks another option, this PR changes or closes.

  • A failed thread's view offers Dismiss beside Retry. A dismissed failure moves to Resolved (still drawn with ✕ and its reason, and still retryable), and the session stops counting it.
  • Dismissals are your user state, like pins, in a new dismissals flow (workforce/flows/dismissals.mts). Each one is keyed by task id and attempt (dismissalKey), so a retry that fails again waits on you again.
  • User state is one record per user shared by every flow that declares it, so pins and dismissals now declare one schema (workforce/flows/user-marks.mts). With two separate schemas the server warned at startup that "Flows pins and dismissals declare structurally compatible but non-identical user.stateSchema schemas".
  • listTasks rows keep attempts, which the adapter used to drop. The sessions list also listens on your user topic, so a dismissal updates the count without a reload.

Decided, not asked: Dismiss has no undo. A dismissed failure is still in Resolved, and Retry still works from its view.

Verification

  • Red first: with only the tests applied, 5 fail (columnOf and waitingOnYou dismissal cases, the threads-screen Dismiss flow, and two watchSessions cases). With the change, the lab suite passes: 32 files, 224 tests. tsc and eslint are clean.
  • A real server (fsdev serve on this config, stub harness): dismiss {key:"t1#1"} completes, listDismissed reads ["t1#1"], pins in the same user state read back unchanged (["t9"]), and the schema warning is gone.

No changeset: private lab. The lab README rows for the board's columns and the adapter table now cover dismissals.


Generated by Claude Code

…on you

A failed thread sat under Waiting on you with only Retry, so a failure
you'd already read stayed in your list and the session's count forever.
Its view now offers Dismiss: the failed attempt moves to Resolved and the
session stops counting it. Kept per task attempt in your user state, like
pins (a new dismissals flow over one shared user-marks schema), so a
retry that fails again waits on you again. Part of FIX-2579.

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

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
flow-state-dev-build-site Ready Ready Preview Nov 8, 2026 11:38pm UTC
flow-state-dev-docs Ready Ready Preview Nov 8, 2026 11:38pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
flow-state-dev-ui Ignored Ignored Preview Nov 8, 2026 11:38pm UTC

Request Review

@linear-code

linear-code Bot commented Nov 6, 2026

Copy link
Copy Markdown

FIX-2579

@jhoffner jhoffner assigned Copilot and jhoffner and unassigned Copilot Nov 6, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 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-11-06T14:11:43.593214Z 6855c99 New commits
ℹ️ 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 commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Second look + architecture review

Overall: the approach is sound. Dismissal as user state keyed by task+attempt is the lean shape, and it keeps the board's task status untouched. The tests encode the intent: a retry that fails again waits again, and an in-progress task is never resolved by a dismissal. The items below are ordered by importance.

1. Read the dismissals once per relist, not once per session (efficiency, worth fixing here)

waitingCountFor (adapter.ts, ~L783) now calls readDismissed() for every session on every relist. Each call is a flow read, plus ownSession("dismissals"). The data is one per-user list, identical for all sessions. With N sessions that's N identical reads each time a user-topic state notice fires, and this PR makes that notice a relist trigger. Read it once per relist/pump and pass the set into the per-session count.

2. A failed dismissals read blanks every session count (resilience)

readDismissed rejecting makes waitingCountFor return undefined (the catch), so a flaky read on the new flow hides counts that pins and tasks alone could produce. Consider falling back to an empty set for the dismissals read only, with a console.warn. A stale "N waiting" is better than none, and it matches how the count already degrades.

3. Two flows sharing one schema is a smell (architecture, optional)

pins now declares a dismissed field it never reads or writes, and dismissals declares pinned. user-marks.mts exists purely to dodge the startup warning. That is correct as a fix, but the underlying fact is that these are one piece of user state with one owner. The deeper option is a single marks flow (pin, unpin, dismiss, listMarks) and delete the schema-sharing file. That would mean one ownSession, one read, one subscription and one watch, and it would remove item 1 for free. The cost is renaming pins across the adapter, fake lab and tests. Since you're already editing pins.mts, the adapter and the fake, this is the natural moment to do it. If you'd rather keep pins stable, then at least note in user-marks.mts that adding a third mark means touching both flows' schemas.

4. Key stability across recreate (correctness, low)

dismissalKey is id#attempts. task-entry.ts (~L49) notes that a recreate resets attempts. If a task id is recreated and fails at the same attempt number, an old dismissal would silently swallow it. Probably rare, and arguably the id doesn't get reused. Worth confirming. If recreate can reuse ids, key on createdAt or the incarnation too.

5. Smaller items

  • dismissed only grows. Entries for tasks that no longer exist are never pruned. Fine for a lab, but say so in the flow header or accept it explicitly.
  • ThreadsBoard: isDismissed does an array includes per task per render. Trivial at this size. A Set would match what waitingOnYou already takes.
  • attempts ?? 0 in dismissalKey means a row without attempts always keys as #0. If a task shows up with an unknown attempt count, this will collide across attempts. Probably unreachable now that the adapter forwards attempts, but the fallback hides a missing field.
  • The fsdev.config.mts header comment line is over-long after the edit. Re-wrap.

No blockers. I'd fix 1 and 2 in this PR, and decide on 3 before merge, since it is cheapest now.


Generated by Claude Code

Comment thread labs/claude-code-style/src/adapter.ts Resolved

@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: c777aede78

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

…ounded dismiss

Review on #4820: each session row read the dismissals itself, and any
user-state notice (a pin too) re-read every row. The sessions list now
reads them once per pass and counts the rows again only when they
changed. dismiss returns its key alone (BP-042) and keeps one key per
task, so the list never grows past one entry per task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFNPRahqdbL4B28RkR
Review on #4820: a literal patch of the dismissed list can lose one of two
dismissals made at once. The updater form recomputes against the stored
list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFNPRahqdbL4B28RkR
Co-authored-by: jhoffner <579835+jhoffner@users.noreply.github.com>
…dapter

main's task-time test renders ThreadsBoard with an adapter that only had
watchPins; the board now also watches dismissals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFNPRahqdbL4B28RkR
Co-authored-by: jhoffner <579835+jhoffner@users.noreply.github.com>
@jhoffner
jhoffner added this pull request to the merge queue Nov 6, 2026
@jhoffner
jhoffner removed this pull request from the merge queue due to a manual request Nov 6, 2026
@jhoffner

jhoffner commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

I'm marking not ready because this one and #4713 both rely on using flows just as a form of CRUD controller and I want to pause and think through how we can better solve this. It feels like a workaround.

Some options we could consider:

  • Make resources have their own client API, which allows certain fields to be edited directly by the client, effectively providing a built-in CRUD API for resources. Client would interact with them directly, not through a flow.
  • Provide this capability on the flow that its relevant on, which means a plugin/extension/capability type way of applying common functionality to multiple flows.

Co-authored-by: jhoffner <579835+jhoffner@users.noreply.github.com>
@gitar-bot

gitar-bot Bot commented Nov 8, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 closed / 2 findings

🟡 Medium risk · Persisting per-attempt dismissals moves failed threads out of Waiting on you, so a mistaken dismissal could hide work needing attention.

Adds a Dismiss action to failed threads so they move to Resolved and stop counting toward "waiting on you," with dismissals stored in a new user-state flow sharing one schema with pins. Resolved this session: dismissals are now re-read once per session instead of on every user-state notice, and dismiss no longer returns and stores an ever-growing list. No open issues found.

✅ 2 closed
✅ Performance: Dismissals are re-read once per session, and every user-state notice relists all

📄 labs/claude-code-style/src/adapter.ts:781-784 📄 labs/claude-code-style/src/adapter.ts:1010-1016
waitingCountFor now calls readDismissed() for each session row. A relist of N sessions therefore makes N identical listDismissed reads, each one a server read. watchSessions also sets relist = true on every state notice on your user topic. Pins share that topic, so pinning or unpinning any thread re-reads every session row in full (sessions.get, running turns, listTasks, and dismissals again), even though pins never change the waiting count. Fix: read dismissals once per pump and pass the set into waitingCountFor. Then, on a user-state notice, recompute the counts only when the dismissed set has actually changed.

✅ Quality: dismiss returns and stores an ever-growing list (BP-042)

📄 labs/claude-code-style/workforce/flows/dismissals.mts:36-49
Each dismissal adds a task#attempt key to your user state, and nothing ever removes one, even after the task is retried, resolved or deleted. The dismiss action also returns the whole dismissed array, and an action's return is recorded on its request. Every Dismiss therefore stores a payload that grows with every failure you have ever dismissed, which breaks BP-042 (no unbounded payloads in recorded returns). The screen never uses this return: adapter.dismiss ignores it and re-reads through listDismissed. Fix: return just { key } or { ok: true }, and consider dropping the task's older keys from the list when you add a new one.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@jhoffner
jhoffner added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 43249d3 Nov 10, 2026
8 checks passed
@jhoffner
jhoffner deleted the claude/project-thread-auxztt branch November 10, 2026 01:25

This branch was successfully deployed

1 active deployment
Preview – flow-state-dev-docs — ccfd87c9 Deployed Nov 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants