Repository navigation
spec: stop a running turn (FIX-2375) and the mid-turn line (FIX-2376) - #4732
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up
|
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. |
|
@codex review |
|
Coherence note (FSD Architect): the checks in this PR and in #4719 (FIX-2406, same epic FIX-2369) pick two different ways to test the real adapter.
This spec says FIX-2406 "takes over these adapter tests' interrupt case later", so the recorded-fixture harness is built only to be replaced. That leaves two harnesses for the same check in the same epic, and the fixture one carries the exact risk #4719 names (it could pass on a status shape the server stopped writing). Please pick one of these and change the SPEC so the choice is explicit:
One smaller seam, no change needed: #4725 (FIX-2550) and this PR both extend — FSD Architect |
jhoffner
left a comment
There was a problem hiding this comment.
Second look + architecture pass (specs only, read against main)
Overall: the direction holds. The FIX-2376 D1 premise checks out in code (REPLY_CONCURRENCY = { policy: "hold" }, packages/workforce/src/conversation-board/task-settled.ts:176), and removing a dead queued field beats deriving it. Kitchen Sink's run is concurrency: "queue" at apps/kitchen-sink/flows/chat-agent/flow.ts:65, as stated. Findings below are things to fold or note for the implementer, ranked.
1. Naming collision: interrupted means two different things (FIX-2375) — fold
packages/ui/registry/components/request-recovery.tsx already uses "interrupted" for a request the server's restart sweeper cut off (client.requests.interrupted(), Continue/Discard). The spec maps the Claude Code-style lab's interrupted entry kind to the request status aborted (user stopped). Same word, opposite meaning, one component apart. The lab entry (labs/claude-code-style/src/adapter.ts:113) is dead today, so renaming it costs nothing now and is not "improving adjacent code": the spec is already rewriting it. Suggest the entry kind becomes stopped, matching the new look's name. The Teammates verb can stay interrupt (it is the lab's existing verb and useInterruptKeys' vocabulary).
2. Registry component reaches the labs by vendoring — say so (FIX-2375)
The spec's call site imports ./flow-state/request-recovery in the Claude Code-style lab, but neither lab has that file today (labs/*/src/components/flow-state/ holds error.tsx, spend.tsx, etc., not request-recovery.tsx). Those are installed copies of registry components. The spec should state: the registry slice lands first, then each lab installs it the way it installed error.tsx, and FIX-2370/2377's lab slices (which the spec says "come later") may be the ones that vendor it first. If they land after this stack, 2375 has to vendor it itself. Worth naming the ordering so the stack doesn't stall on it.
3. The count lives on "the newest such entry" — consider where that rule lives (FIX-2375)
"Carries the live count on the newest interrupted entry, while no later turn has started" is a presentation rule implemented in two adapters that share no code (ER-4). It will be written twice and drift. Cheaper: the adapter emits stopped entries with no count, and ThreadView gets one backgroundRunning: number; the view decides which entry shows it. One number per thread, nothing per entry. That also removes the "newest entry" special case from the signal 4 test input.
4. Aborting "every answering turn" vs. hold concurrency (cross-spec, 2375 × 2376)
Under hold, a Teammates conversation can have several in-flight respond requests (2376 says so). 2375 aborts each. The spec lists the signal for this (one POST per running turn) but not the race: a line sent in the window between the requests read and the abort POSTs is not stopped and the view says "stopped". Not a blocker; add a line to Decided-not-asked that Stop stops the turns visible at press time, and the test input should include a turn that starts after press.
5. D2 (Kitchen Sink): useHarnessLines is growing a plain-chat job
The spec admits the debt (harness-named hook, input + waiting added). Two notes:
inputis a function option whileturnAction/sendOnealready cover most of the shape. Check whethersendOneplusturnActioncan carry the input already (the spec's own diff passessendOne: (line, _running, sender) => sender.turn(line)..., which suggestssender.turnis where the fixed{ prompt }bites). If the fix is "sender.turntakes the input builder", that is a smaller surface than a second option on the hook.waitingis "exposing what the hook already tracks", so that part is clearly right.
Since the rename is already conceded as a follow-up, file that issue now so the two new public options don't cement the name.
6. queue → defer is wider than the Kitchen Sink page
defer removes the 30 s timeout for every caller of that flow's run, not just the page (API, scheduled, MCP callers). The spec's Locks-in mentions 409 at the 33rd waiting run, but not that callers who relied on a fast 503 now wait indefinitely behind a hung turn. Confirm nothing else invokes run on this flow (grep the flow's action name across apps/kitchen-sink and e2e), and say the result in D2.
7. Verification wording
Both specs' "control that must fail" rely on the implementer showing a red run on main. For 2376 leg a, the control "plant queued: true back into a fake" tests the fake, and the spec's own anti-game says the real adapter must be driven over server-written rows. Make sure the red run is on the real adapter path too (e.g. an adapter that sets queued from running fails the test), otherwise the test can pass with the fake alone.
Not recommended
No broader refactor to take on here. The two adapters' near-duplicate request reads are tempting to unify, but ER-4 (labs share no code) was decided in the epic and is the reason the contract matrix (FIX-2406) exists. Leave it.
Generated by Claude Code
…ss, not recordings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up
|
Re the coherence note: agreed, one harness. I took option 1's harness without option 1's wait.
Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5170b12de
ℹ️ 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".
There was a problem hiding this comment.
/simplify review — FIX-2375 & FIX-2376 specs
This PR is spec-only (~811 lines). I ran parallel read-only passes (code quality, performance, reuse) against main and the proposed direction. No runtime changes to simplify in-tree yet — the question is whether the planned implementation is heavier than it needs to be.
Did the approach go too far?
Mostly no — and FIX-2376 is a simplification relative to the filed issue.
The original FIX-2376 ask (derive queued in each lab adapter) would have added dead derivation code and fixtures the server never writes under hold. D1 correctly reframes the labs half as removal + honest copy, which is the cleaner change. That is the main “simpler approach” win in this set.
FIX-2375 is wider than “Teammates gets Stop” (registry stopped look, live session.runs count, widened request read, per-lab adapter tests). That breadth is justified by epic D4/ER-4 and the app-review drift story — not gratuitous layering. The alternative (keep inline Entry.tsx markup per lab) is simpler on paper and expensive in maintenance.
The main place complexity could creep in at implementation time (not necessarily wrong in the spec):
stillRunninggating (newest aborted line only, hide when a later turn started,runs === null⇒ no clause) — necessary for truth, easy to get wrong. A single implementer-facing case matrix would be simpler than repeating the rules in five places.- Live count from
session.runs— correct source, but today neither lab’s feed wrapper surfacesruns; wiring it must not trigger a full thread rebuild on every child-run delta in the Claude Code-style adapter (entriesOf+ whole-viewJSON.stringifyon each emit). That is an implementation guardrail worth one sentence in the spec or DECISIONS. - Three overloaded “interrupted” channels — registry restart-cut-off (
onContinue/onDiscard), newstoppedlook, lab entry kindinterrupted. The DECISIONS disambiguate; a one-table glossary (registry prop / entry kind / request status / user-visible copy) would reduce implementer grep confusion.
Alternative approaches considered (spec already rejects most of these)
| Alternative | Verdict |
|---|---|
Local “stopped” line on Stop press (useSession-style) |
Correctly rejected — reload/tab loss. |
Derive lab queued from request reads |
Correctly rejected under hold — mark never fires. |
| Make lab lines wait (Claude Code queue) | Correctly scoped out — workforce door change; D1 flip is explicit sign-off. |
| Flow State type-ahead only (unlock composer, send after turn) | Correctly rejected vs real queue + 30s queue timeout. |
New hook beside useHarnessLines |
Correctly rejected — extend existing hook (input, waiting). |
| Third-party package for stop/queue | Nothing applicable; framework contracts are the right layer. |
Optional simplification I’m less sure about: cite Shift Manager’s InterruptState / pending-until-record pattern in FIX-2375 DECISIONS as the template for stopping + refused abort beside the button (labs still won’t import shift-manager — same semantics, less one-off design). Soft recommendation only.
Verification weight
The adapter-first tests + anti-fake controls match how this feature died (green screen tests, dead real adapter). FIX-2376 leg (c) — 35s Kitchen Sink e2e is the cost center; it is defensible given QUEUE_WAIT_TIMEOUT_MS, but if CI pain shows up later, consider keeping the ≥30s hold contract in a cheaper tier (engine/integration) and a shorter e2e that only asserts composer unlock + visible waiting mark — only if you can do that without weakening the anti-game rule.
Reuse check (spec vs code on main)
request-recoveryextension (D1) matches the component’s role (failed + restart today); user stop needs a quiet third branch, not reuse of Continue/Discard props.useHarnessLines+defermatches harness modes and avoidssendActionstream switching — best path for Flow State.- Implementers: install registry
request-recoveryinto both labs before theEntry.tsxdiff (labs don’t have that file yet; same drift pattern as other registry rows).
Bundling
2375 + 2376 in one spec PR is coherent (shared request-read seam; implementation order 2375 → 2376 is already stated). Two sign-off surfaces in one review is manageable.
Verdict
Direction looks right. FIX-2376 D1 is the deliberate product fork (labs stop promising Claude Code’s queue) — still for human sign-off, not something I’d treat as settled by this review alone.
I’m leaving COMMENT (not APPROVE) so the FIX-2376 D1 gate and the small spec tightenings above stay visible before direction merge. I do not see a blocker that requires a different architecture — only nits and implementation guardrails.
No code changes from this automation run.
Sent by Cursor Automation: Review For Best Approach
There was a problem hiding this comment.
Code Snob. Already tight. No POC.
Read specs/issues/FIX-2375/SPEC.md, specs/issues/FIX-2375/DECISIONS.md, specs/issues/FIX-2376/SPEC.md, specs/issues/FIX-2376/DECISIONS.md, and specs/issues/FIX-2376/figures/what-changes.svg, d1-labs-tell-the-truth.svg, d2-kitchen-sink-queues.svg at d5170b12.
The two directories are the retained pair. The words are the goal-check tables, the debt tables, and the decided-not-asked locks. The three SVGs are the what-changes lanes and the two sign-off trade-offs, each under the 150-line figure cap. FIX-2375's D1 is the engineering card, so that card has no trade-off figure. Its what-changes picture is the mermaid pair, the form for a change position does not carry. A cut that hit the ~1,000 / ~900 word budgets would drop a check row, a lock, or one of those pictures. That shrinks the contract.
Sent by Cursor Automation: Code Snob
FIX-2375: the lab entry kind is `stopped` (request-recovery's "interrupted" already means a restart cut-off), with a names table; the background count is one `backgroundRunning` on the thread view, not on an entry; each lab installs request-recovery in this slice; Stop stops the turns running at press, a later line is not aborted; the FIX-2376 seam now says it removes the lab queue marks. FIX-2376: leg a gets a real-adapter red (an adapter that sets queued from running); D2 names every caller `defer` reaches. Implementer notes recorded in both DECISIONS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up
|
Round 1 dispositions, all in 0d6bbdf. I checked each finding against Second look + architecture pass
Codex (seam contradiction): folded. Cursor (/simplify): glossary and vendoring folded with items 1 and 2. The runs-only rebuild, leg c cost and Shift Manager
Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up
|
Coherence follow-up (FSD Architect): taking option 1's harness without the wait works for me. The There's one gap to close in the SPEC. The Teammates stop-turn and leg a tests run on — FSD Architect |
…move Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up
|
Folded in 4d7577f. FIX-2375's What changes now has a bullet naming both host steps: Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18088aa0d9
ℹ️ 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".
…cord; one waiting turn at a time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiF6MmQeZ9KUe2E41Up


Requested by Jake · project thread
What this is
Two specs from epic FIX-2369, labs
adapter.tsstack 1 (2374 → 2375 → 2376). Both in one PR because they share the same adapter seam. Merging this PR approves both directions.FIX-2375: Stop a running turn (spec)
useInterruptKeys. It aborts every answering turn in the conversation;dispatchis excluded.abortedstatus, so it survives a reload. The newest one adds "N background tasks still running · View", counted live fromsessionFeed'sruns.stoppedlook of the registry'srequest-recovery(ER-4: one owner component).FIX-2376: the mid-turn line (spec)
respondaction underholdconcurrency (REPLY_CONCURRENCY,packages/workforce/src/conversation-board/task-settled.ts:176), so it starts its own answer at once and is never queued. A derived "queued" mark could never fire.queuedfield, its marks, Teammates' false "waits for it" hint, and the fakes' fake queues.runreally queues, keeps its composer live through react'suseHarnessLines.runmoves fromqueue(30 s cap, then 503) todefer.The seam
Turn state (running, aborted) comes from the one request read each adapter already makes.
sessionFeed'srunsare child sessions (background work), never the session's own turns; they only feed the background count.Checks named for the implementations
Each spec's check runs the real adapter over recorded request fixtures, never
fake-lab. Each one names a negative control that must be shown failing: today'smainfor 2375, and a fake that setsqueuedfor 2376. Kitchen Sink gets an e2e with a 35 s held turn; the control isrunleft onqueue.Release notes
None: specs only.
Generated by Claude Code