Skip to content

FIX-1690 (door): a person's message continues a coding run's session - #2544

Merged
jhoffner merged 10 commits into
mainfrom
fix/FIX-1690-door
Oct 1, 2026
Merged

jhoffner merged 10 commits into
mainfrom
fix/FIX-1690-door

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

The problem

A person can't talk to a coding run while it works. If they notice something mid-run, their only options are to wait for it to finish or to interrupt it. An interrupt throws away the conversation the run had built up.

What this does

This is the second of three PRs for FIX-1690. The harness manager now builds a message door: a public action a coding flow declares.

defineFlow({
  kind: "coder",
  internal: { actions: { resume: { block: board.drain } } },
  actions: { message: manager.messageDoor({ drain: "resume" }) },
  task: { actions: { work: { block: manager } } },
});

You send it { message } on the run's own session. What it does depends on the task's state:

The task is The door
Running Keeps the turn, stops the attempt (through #2538's ctx.session.stopRequest), parks the row for a turn, re-queues it, and dispatches the drain entry into the session that claimed the row. The next attempt runs in the run's own session again and resumes the same coding session with the message in its prompt. Answers continuing
Running, but it didn't stop within the wait, or the re-queue or drain failed after the park Keeps the turn; whatever runs the row next gets it. Answers kept, never a failure that would invite a resend
Claimed for its next attempt, whose run hasn't linked yet Keeps the turn for that attempt. Answers kept
Waiting on its own question, or between attempts Keeps the turn for the next attempt. Stops nothing, answers nothing. Answers kept
Never started here, finished, or on a harness that named no session Refuses. The request fails with TurnRefused, so only a delivered message ever completes. A refused message is withdrawn, so no later attempt takes it

A turn doesn't spend a retry. In orchestration, awaitReview(id, note, { forTurn: true }) marks the park. The claim after its unpark is counted in a new turnReentries field and discounted from maxAttempts, the same way an abandonment is.

The DevForce/App Lab wiring and the composers come next, in lab. This PR stops at the manager, the substrate and the conductor lab.

What's asked of you

Nothing new. This implements the approved spec's S3–S7, with both forks resolved to the recommended answers: stop-and-continue for every harness, and a fixture seat for the App Lab goal (in lab).

There is one place where the build departs from the plan's mechanism. It does not change the promise, so it is listed under engineering calls and is not asked here.

Parts worth reviewing closely

For the code reviewer.

  • Who parks the stopped attempt (packages/harness-manager/src/door.ts, continueRun). The plan expected the stopped attempt to park itself. It can't: a stopped request ends aborted, and its sequencer's rescue does not run. So the door parks the row instead:

    1. It waits, bounded at 60 s, until the stop reads finished. It polls at 100 ms, backing off to 1 s.
    2. It parks the row with a claim ticket minted from the attempt it stopped.
    3. The park is fenced. If that attempt settled the row first, or a new claim took it, the park declines and the door answers from what it found (BR-11).
  • A stop that finds the attempt already over reads the row as stored (storedStatus). The board this request resolved is a snapshot, so a row the attempt settled since still reads as running there. A no-op conditional update reads the committed row and writes nothing. A settled row is refused (BR-11); anything else is kept, which is what an Interrupt gets (BR-17).

  • A refusal after the keep withdraws the turn (turns.ts, withdrawTurn). It is a conditional write against takeTurns, so exactly one of them wins. If an attempt already took the turn, the door answers continuing instead of refusing. This closes a race the review surfaced: a second line whose door woke after the next attempt had already finished with it was refused finished-first.

  • The forTurn park runs only from in_progress (resource-backed.ts / sequencer-backed.ts, one call each). Without this fence, a row that re-pended in the race threw an illegal pending → parked transition instead of declining.

  • turns/** (packages/harness-manager/src/turns.ts). Each turn is a create-only row keyed by the request that kept it, and kept for attempts + 1. An attempt takes every undelivered, unwithdrawn turn up to its own number, oldest first, with a conditional deliveredTo write. A replay of the same attempt reads the same set.

  • My weak spot: the races are staged in the CI spec.

    • BR-11 settles the row in the store at the instant the stop lands, or holds the stop until the attempt settles on its own.
    • The BR-10 race holds the second door's stop write until the row reads completed.

    Each is how a loaded machine can order things, made certain. None is a race that happened on its own.

Engineering calls
  • messageDoor({ drain, flowKind? }) is a factory, not the bare property DOCS.md shows. drain names an internal entry that runs the board's drain. The door dispatches it into the row's claimedBy session, which is where the hand-off derives the run's session from. Draining in the door's own session (the first cut) put every next attempt one session deeper. flowKind is for a board drained by another flow, which is DevForce's case: the EM drains and hands off to the coder seat. If wrong: a rename, pre-1.0.
  • The door parks the row, not the attempt (above). The plan's "At implement time" note asked for this to be reported.
  • A delivered line is never refused. When the race above hands a second line to an attempt that then finishes, the door answers continuing, because the attempt acted on it. Refusing would tell the person it didn't arrive.
  • The fresh read is a no-op conditional update, because the substrate has no read-through and the request's board is a snapshot. It changes nothing, so it writes nothing; the BR-11 test pins the row's version.
  • The stop wait asks again rather than reading. Asking again re-runs the fenced write, which writes only while the request is in_progress, so a repeat is idempotent. Adding a read-only request read to the session handle would widen the stop PR's API. The poll backs off instead.
  • Turns are appended after the phase prompt, under "A person sent you this while you were working…". They do not replace the phase prompt, so the phase's own instructions still hold.
  • The row is the one whose run link names this session. With a shared session that holds several rows, the running one wins, else the latest. It is one pass over the board the substrate already loaded.
  • BR-6 is enforced by the engine before the door runs. The run session is bound to its person, so another user's call is refused as "belongs to another user". The door's own org owner check stays as a second line of defence.
  • BR-14's text ("This task hasn't started, so there's no session to write into.") answers any session no run is linked to. A never-started task has no run session to call the door in.
  • A message in the claim-to-link window is found by the run record. A claim clears the row's run link, so the door falls back to the run record whose childSessionId names this session. The record now writes that at the attempt's open, not only at the verdict, because a stopped attempt never reaches the verdict. That fallback lists the user's run records, and only runs when no row links the session.
  • A slow stop's lease lapse is still charged as an abandonment. The door answers kept after the 60 s wait, but the row stays in_progress until its lease lapses, and that recovery counts an abandonment. The fix needs a substrate mark the recovery claim reads, so it is filed as FIX-1705 rather than done here.
  • conductor's message now passes the tenant gate first, like every other conductor action.
  • The turn fields keep the use case's name (parkedForTurn, turnReentries, forTurn). The plan's S3 describes the concept the same way ("a park-for-turn reason", "re-entries after a turn"), and readTurnReentries says it mirrors abandonments. A rename to a generic parkReason is possible pre-1.0 if a second caller appears.
  • Docs were written straight from DOCS.md's reviewed draft, adjusted for the factory form. This run had no sub-agent dispatch, so docs-writer / docs-editor were not run.
Verification

V2, packages/orchestration/test/collection/turn-reentry.test.ts: 10/10 tests, 5 cases on each of the two backings.

  • Re-entry is not charged.
  • A failure at maxAttempts − 1 still retries after a turn.
  • A question park is still charged.
  • A recovery still counts as an abandonment.
  • A turn park declines on a re-pended or settled row.

Controls:

  • With the discount dropped, the maxAttempts − 1 case fails on both backings.
  • With the in_progress fence dropped, the decline case fails on both backings with IllegalTaskTransitionError: pending → parked.

V3, packages/harness-manager/test/message-door.spec.ts: 18/18 tests, all using the stub harness. Five were added in the second review round, and each was red on e39b696c3:

  • two messages to two attempts, one after the other: one stable session holds both lines (red: attempt 2 linked a different session)
  • a message between a claim and its run linking is kept (red: refused "hasn't started")
  • the re-queue throws after the park: kept, the row stays parked for a turn, and the next re-queue runs the line (red: the request failed)
  • the claiming session can't be reached: kept, the row is queued, and the next drain runs the line in the same session (control: ignoring the refusal answers continuing)
  • a stop that outlasts the wait: kept and completed (red: refused stop-timeout)

Controls for the round: draining in the door's own session fails the two-message case on the session id. A flow without the resume entry is refused by defineFlow, naming the entry. labs/conductor gains a foreign-tenant message test that is red without the gate. The earlier cases:

  • running → stop, park, re-queue; the next attempt's prompt holds the turn and resumes the previous session id; standing is unchanged (BR-7, BR-8, BR-9)
  • two turns, one stop, both delivered in order (BR-10)
  • a second line whose door wakes after the next attempt finished with it: answers continuing, not finished-first (BR-10)
  • BR-11: settled as the stop lands; settled before the stop (the stop finds the attempt over); re-pended. A refused line never reaches a later attempt
  • parked on its own question (BR-12)
  • pending with a link (BR-13)
  • no linked run (BR-14)
  • finished (BR-15)
  • a harness that names no session, the cli-remote shape (BR-16)
  • another user (BR-6)
  • an Interrupt and a turn together (BR-17)

Red before the fix:

  • On c36e842, the BR-10 race case refused with The task finished before your message reached it.
  • On c36e842, the BR-11 re-open put "too late" in attempt 2's prompt.
  • On 24e5b160b, the BR-11 settled-before-the-stop case completed for a finished task.

Controls:

  • Prompt never folds the turns: 5 tests fail.
  • Door never parks: 4 fail.
  • Door unparks a question-parked row: BR-12 fails.
  • A refusal never withdraws: the BR-10 race case and the BR-11 re-open both fail.
  • A withdrawn turn is still taken: the BR-11 re-open fails.
  • The withdraw ignores delivery: the BR-10 race case fails.
  • No fresh read on already-finished, or the snapshot read instead: the BR-11 settled-before-the-stop case fails.
  • An update that writes: that case fails on the row's version.

One mutation does not fail the suite: keeping the turn for attempts instead of attempts + 1 passes. The +1 guards a race the stub can't stage (a turn kept before attempt N's prompt step ran).

V4, real Claude Code (Agent SDK), goals/harness-manager/a-persons-turn-continues-its-session/: PASS, four runs. The latest is on the second review round, with a new signal 6: read after delivery, the row's run link names the session the turn was sent into. Its control drains in the run's own session, and it FAILS at signal 6 only. (The already-finished change is off V4's path, which goes through the stop wait.)

  • The door answered continuing.
  • The row completed after 2 claims and 1 turn re-entry, so retry standing is 1 under maxAttempts: 1.
  • Both attempts ran in one harness session (972ce899-… on the third run). The fourth was run without clearing the parent session's variables, so it reports the parent's id, as the caveat below says. Signal 3, the fact file, is the one that discriminates, and it passed.
  • The fact file holds the per-run fact, which attempt 2's prompt and the turn never contained.

Control: with the resume feed returning null, the goal FAILS at its named signals. The sessions differ, the fact file is not written, and the row errored.

Running this goal inside a Claude Code session needs the parent session's variables cleared, or the SDK reports the parent's session id. The goal's README says how.

Fast checks:

  • pnpm typecheck: passes.
  • pnpm knip:ci: clean.
  • pnpm lint: clean.
  • harness-manager: 192 passed.
  • conductor: 155 passed.
  • orchestration: 1577 passed.
Files
  • packages/orchestration/src/tasks/schema/task.ts: parkedForTurn and turnReentries.
  • packages/orchestration/src/tasks/collection/{internal,types,resource-backed,sequencer-backed}.ts, tasks/index.ts: AwaitReviewOptions.forTurn, the in_progress fence and the discount.
  • packages/harness-manager/src/{door,turns,manager}.ts: the door, the turns collection with withdrawal, and the prompt fold.
  • packages/harness-manager/src/{workspace,inbox}.ts: issuePhasePrefix and hashKeySegment, now shared by turns and the inbox; sleep exported for the stop wait.
  • labs/conductor/src/flow.ts: message, behind the tenant gate, and an internal resume drain.
  • packages/harness-manager/src/run-record.ts: childSessionId written at the open; findRunRowBySession.
  • goals/harness-manager/a-persons-turn-continues-its-session/: V4.
  • Tests: the V2 and V3 specs above, plus fences.spec.ts, which now sweeps the new goal's spawns.
  • Docs: the harness-manager README and apps/docs/docs/orchestration/harness-manager.md ("Talking to a run", plus a Limits bullet).
  • .changeset/harness-manager-message-door.md: orchestration and harness-manager, minor.

Part of FIX-1690 (S3–S7) · spec: specs/issues/FIX-1690/ · spec PR #2525 · previous: #2538 (stop, merged) · next: lab. Based on main; it carries only door.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq

claude added 2 commits October 1, 2026 01:27
The harness manager builds a message door, `manager.messageDoor(board)`: a
public action that takes `{ message }` on a run's own session. It keeps the
turn, stops a running attempt through `ctx.session.stopRequest`, parks the
row for a turn (fenced to the stopped attempt's claim), and re-queues it.
The next attempt resumes the same coding session with the turn in its
prompt. A row waiting on a question or between attempts keeps the turn for
its next attempt; a never-started or finished task, or a harness that named
no session, is refused with a failed request.

Orchestration: `awaitReview({ forTurn: true })` parks only an in_progress
row and marks it; the claim after its unpark counts in `turnReentries` and
is not charged against `maxAttempts`.

Real-model goal goals/harness-manager/a-persons-turn-continues-its-session.

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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@vercel

vercel Bot commented Oct 1, 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 Oct 1, 2026 12:18pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 1, 2026 12:18pm UTC
flow-state-dev-ui Ignored Ignored Preview Oct 1, 2026 12:18pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 1, 2026

Copy link
Copy Markdown

FIX-1690

@cursor

cursor Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_5217831f-e2e1-4b96-a7c4-840d1ca70253)

jhoffner commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

Second look + architecture review (read-only, no edits made)

Overall the approach is sound: decide from server state only, keep the turn before the stop, fence the park to the stopped attempt's claim ticket, and share parkPatch/unparkPatch between both collection backends. I looked for a leaner shape and didn't find one that keeps those properties. Findings below, most important first.

Worth fixing in this PR

  1. A refused message can still be delivered later (packages/harness-manager/src/door.ts, deliverTurn). keepTurn runs before the TurnRefused("no-run") branch (first === "not-in-this-session"). The composer then shows a refusal, but the kept turn is for attempts + 1 and any later attempt on that row will fold it into its prompt. The same holds for a finished-first refusal if the row is later re-opened. The stop-timeout text says the turn is kept, which is accurate. The other two refusals say nothing, yet behave the same. Either delete the kept turn on those two paths, or move the not-in-this-session check ahead of keepTurn if the order allows it. Add a test asserting no turn survives a no-run refusal.

  2. Misplaced doc comment (packages/orchestration/src/tasks/collection/types.ts). AwaitReviewOptions was inserted between TaskTransitionOptions and its docblock. The old docblock ("...while the worker was still running") now sits above the new AwaitReviewOptions docblock, and TaskTransitionOptions has none. Move the new interface above that docblock (or after the interface it extends).

  3. Duplicate terminal-status set (door.ts:116). const TERMINAL = new Set([...]) re-declares what isTerminalStatus from @flow-state-dev/orchestration/tasks already exports and the substrate uses everywhere. The repo's convention is a shared helper, not a local copy. Use isTerminalStatus(row.status) and drop the set. (labs/conductor/src/flow.ts has its own TERMINAL_TASK_STATUSES too; that predates this PR, so I'm only flagging it.)

Architecture notes (take as part of this PR only if cheap)

  1. Casts hide a typing gap. door.ts uses board.unparkAndDrain.connectInput(...) as never and manager.ts uses managerCapability as unknown as DefinedCapability. as never turns off the check on the tapIf step entirely. Typing MessageDoorBoard so connectInput returns a block tapIf accepts removes it. It is the only way a wrong input shape on the re-queue step could slip through unnoticed. The DefinedCapability cast is pre-existing in spirit; leave it.

  2. A generic substrate now carries a harness-manager concept. parkedForTurn, turnReentries, and forTurn put "a person's turn" into the generic task schema and awaitReview options. The exemption from maxAttempts is a legitimate substrate need, and keeping the fields top-level for BP-031 is correct. But the names bind orchestration to one caller's vocabulary. Consider naming the capability rather than the use case, e.g. parkReason: "turn" | "question" plus a generic "re-entry not charged" counter. This is a naming/shape call for the author, not a blocker. If it stays as is, readTurnReentries is worth a one-line comment saying it intentionally mirrors abandonments.

  3. Polling stop loop. The while (stopRequest === "stopped") loop uses stopRequest as a read, which re-issues the stop each tick. It works because a finished request answers already-finished without writing, but the comment is the only thing carrying that contract. If the session API has (or can cheaply get) a read-only request status, prefer it. If not, a test pinning "repeated stopRequest on a still-running request writes nothing new" would protect the assumption.

  4. Two awaitReview branches in each backend. The forTurn branch in resource-backed.ts and sequencer-backed.ts duplicates the transitionRef/transitionTo call with only ifAllowed and the "in_progress" expected-from differing. A single call with the options built conditionally is shorter, and keeps the two backends from drifting. Optional.

Checked and fine

  • Door decisions use only the session's own run link, the stored run owner, and the confirmed session id (BP-031).
  • The shouldRetryOnFail discount uses ?? 0 on the new fields, so old rows read correctly (BP-030). Both fields are optional in the schema.
  • turns is reserved in RESERVED_ACCESSORS and the error text is updated.
  • Changeset, README and docs page are present. Changeset is minor on both packages, consistent with pre-1.0.

I did not run the tests; this is a diff read only.


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 (parallel read-only pass)

Verdict: The three-way split (door.ts delivery + stop/park, turns.ts durable inbox, orchestration forTurn / turnReentries) is mostly earned, not an over-built design. The spec constraints (cross-session resume, refused vs kept lines, retry budget without burning maxAttempts, keep-before-stop crash safety) explain why “just append to session history” or “reuse the question inbox” would be thinner but wrong. The substrate changes mirror abandonments + shouldRetryOnFail discount — a good reuse of an existing pattern rather than a new mechanism.

I would not recommend collapsing this into a single manager.ts blob or folding turns into inbox; that trades file count for mixed lifecycles.

Where complexity could still shrink (non-blocking)

Area Suggestion Confidence
door.ts already-finished branch After line 180, row.status is non-terminal on the snapshot, so TERMINAL.has(row.status) at the fast path is unreachable — either re-read the row (or use parked.status from a later transition) or delete the branch and document that kept is intentional when the harness request ended first. High (logic)
Stop wait loop Reuse harness-manager sleep(ms, signal) from workspace.ts instead of ad-hoc setTimeout; consider backoff or read-only request polling after the first stopRequest arm (v1 bounded poll is acceptable). Medium
DRY Unify turnsRef / inboxRef / collectionRef resolvers; shared issuePhase prefix + 16-char hash helper with inbox; isTerminalStatus from orchestration instead of local TERMINAL set; harnessTaskInputSchema instead of local rowPayloadSchema. Medium
Tests No coverage for stopRequest → already-finished or concurrent row settlement; takeTurns CAS/replay could use a small resource fake like inbox-fake. Medium
linkedRow Full tasks.list() scan per message — fine for typical boards; if this becomes hot, index by run.sessionId or store taskId on the run row (orchestration run-link work is the natural home). Low until scale

Performance (v1)

  • Up to ~600 stopRequest store touches per door message (100ms × 60s) is the main hot-path cost; acceptable for correctness if documented; not a reason to reject the approach.
  • Resource-backed getOrCreateTaskCollection + reconcile list() per door delivery is inherited board cost, amplified but not introduced solely by this PR.

Alternative approaches considered

  1. Session-only continuation — fails retention, cross-session attempt, and refused-door semantics (turns.ts header is convincing).
  2. Inbox channel for person messages — manager already separates failure / Q&A / person turn; conflating would complicate prompts and parks.
  3. Stop + unpark without turnReentries — would spend retry budget; goal explicitly needs attempt 2 under maxAttempts: 1.
  4. Third-party retry/poll libraries — would fight CAS/resource model; not recommended.

Approval stance

No architectural blocker from this simplify lens. I'd like the already-finished / finished-first dead branch cleaned up or covered by a test before merge (small fix). Everything else reads as follow-up DRY and scale hardening.

(Automation: simplify review — no code changes pushed from this run.)

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

Comment thread packages/harness-manager/src/door.ts Resolved
Comment thread packages/harness-manager/src/door.ts Resolved
Comment thread packages/harness-manager/src/door.ts Resolved
Comment thread packages/harness-manager/src/door.ts Resolved
Comment thread packages/harness-manager/src/turns.ts Resolved

@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. A smaller shape exists. Do not treat this as a behavior review.

Fold these three subtractions into this branch, then close #2545 unmerged after this PR lands. That POC does not merge.

  1. Delete *-message-result in packages/harness-manager/src/door.ts. It only drops requeue. .map(({ outcome, taskId }) => ({ outcome, taskId })) does the same thing, and messageDoorOutputSchema still validates the public { outcome, taskId }.
  2. In both awaitReview implementations, make one transition call. forTurn still forces ifAllowed and from: in_progress. Every other park still passes its options through. A helper shared across the two backings is longer than the two ternaries.
  3. Delete the finished-first check in the already-finished branch. That row is the snapshot from before the stop, and a terminal snapshot already threw task-finished. A finish during the stop is still refused when the fenced park declines.

Left alone on purpose: parkPatch / unparkPatch (the shared write), the turns collection (a different lifecycle from the inbox), and workspace.ts's private sleep (exporting it to wrap one setTimeout adds a surface, and abort-during-sleep would change the wait).

Same contract on the checks I ran: message-door 10 passed; fences 4 passed; turn-reentry 10 passed on both backings. The two-turn case also fails on this head (c36e84272) in that environment, same finished-first, so it does not distinguish the POC.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

@jhoffner jhoffner changed the title DO NOT MERGE until #2538 merges: FIX-1690 (door): a person's message continues a coding run's session FIX-1690 (door): a person's message continues a coding run's session Oct 1, 2026
@jhoffner
jhoffner changed the base branch from fix/FIX-1690-stop to main October 1, 2026 02:11
claude added 2 commits October 1, 2026 02:12
…r refused

A second line whose door woke after the next attempt had already finished
with it was refused as finished-first, though that attempt acted on it.
And a door that refused after keeping its turn left the turn for a later
attempt. Both are one fix: a refusal after the keep withdraws the turn
with a conditional write against takeTurns; a turn an attempt already
took answers continuing instead.

Reproduced deterministically by holding the second door's stop until
the row reads completed (red: finished-first), and by re-opening a row
after a finished-first refusal (red: the later prompt carried the line).
Controls: never withdraw, take withdrawn turns, withdraw ignoring
delivery each fail.

Review folds: POC #2545's single awaitReview call per backing and .map
result; already-finished answers kept; isTerminalStatus over a local
set; the stop wait backs off (100 ms to 1 s) on workspace's sleep; the
re-queue step is typed without a cast; turns and the inbox share
issuePhasePrefix and hashKeySegment; AwaitReviewOptions moved off
TaskTransitionOptions' docblock; the unwired stopWaitMs is gone.

V4 rerun on real Claude Code: PASS.

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

jhoffner commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

Response to the second look (all in 24e5b16, which also merges main now that #2538 has landed; one correction in 829c2c2, marked below):

  1. A refused message can still be delivered later: fixed, and it was worse than a re-open.
    • A refusal after the keep now withdraws the turn. The withdrawal is a conditional write against takeTurns, so exactly one wins.
    • If an attempt already took the turn, the door answers continuing instead of refusing.
    • That second half fixes the race POC POC: drop the door result handler and the copied turn-park branch #2545 hit. A second door that woke after the next attempt had already finished with its line refused finished-first. The spec now stages it deterministically by holding door 2's stop write until the row reads completed.
    • Red on c36e842: The task finished before your message reached it. A second test re-opens a row after a finished-first refusal. Red: the later prompt carried the line.
    • Controls: never withdraw (both fail); take withdrawn turns (re-open fails); withdraw ignoring delivery (race case fails).
    • The no-run path after the keep goes through the same catch. I couldn't stage it in the spec: it needs the run's request to vanish from the session between the row read and the stop. So its evidence is the shared mechanism, not its own test.
  2. Misplaced docblock: fixed. AwaitReviewOptions now sits after TaskTransitionOptions, which has its docblock back.
  3. TERMINAL: replaced with isTerminalStatus.
  4. as never: gone. The re-queue step typechecks without it. The DefinedCapability cast is left, as you suggested.
  5. Substrate naming: kept. The plan's S3 describes the concept as a park-for-turn and re-entries after a turn. readTurnReentries already says it mirrors abandonments. A generic parkReason is a cheap pre-1.0 rename if a second caller appears. It's noted in the PR's engineering calls.
  6. Polling: backed off from 100 ms to a 1 s cap, on workspace.ts's abort-aware sleep. I didn't add a read-only request read. The session handle has none, and FIX-1690 (stop): a block can stop another request in its own session #2538's API was under review. A repeated ask is idempotent: the fenced write applies only while the request is in_progress, and abort.test.ts already pins that a finished request answers already-finished without a write.
  7. Two awaitReview branches: folded to one call per backing (POC POC: drop the door result handler and the copied turn-park branch #2545's shape). The POC's .map result step is in too. So is its already-finished → kept. [Edit, 829c2c2: "always kept" broke BR-11. An attempt that settled its row between the door's read and its stop got a kept turn and a completed request. The door now reads the row as stored, with a no-op conditional update that writes nothing (pinned by the row's version). A settled row is refused finished-first; anything else stays kept, including an Interrupt (BR-17). It was red first; the controls are no fresh check, reading the snapshot, and an update that writes.]

Rerun: harness-manager 187/187, orchestration 1577/1577, typecheck, knip and lint clean. V4 on real Claude Code passes again after these changes (same session on both attempts, fact file written).


Generated by Claude Code

…stored (BR-11)

When the attempt finished on its own between the door's read and its
stop, the door answered kept for a task that had already completed, so
the person saw delivered and nothing would act on the line. The board
this request resolved is a snapshot; a no-op conditional update reads
the committed row and writes nothing. A settled row is refused
finished-first (and the turn withdrawn); anything else stays kept,
which is also what an Interrupt gets (BR-17).

Red first: staged by holding the door's stop until the attempt settled.
Controls: no fresh check, the snapshot instead, and an update that
writes each fail.

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

cursor Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_0fa15de6-7245-494f-92b1-0927f59db543)

…ort (FIX-1690)

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

jhoffner commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review this

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

… never not-delivered

- The door re-queues the row and dispatches the board's drain (an internal
  entry the flow declares, `messageDoor({ drain })`) into the session that
  claimed the row, so every message no longer moves the run one session deeper.
- A message between a claim and its run linking is kept for that attempt,
  found by the run record's session (now written at the open).
- A failed re-queue or drain after the park, and a stop that outlasts the wait,
  answer `kept` instead of failing the request. The lapse after a slow stop is
  FIX-1705.
- conductor's `message` passes the tenant gate first, like every other action.

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

cursor Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_75f37ad0-6475-4b46-8c29-cfa56924b7b9)

claude added 2 commits October 1, 2026 11:51
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
@jhoffner
jhoffner merged commit d79ee24 into main Oct 1, 2026
13 checks passed
jhoffner pushed a commit that referenced this pull request Oct 1, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
jhoffner pushed a commit that referenced this pull request Oct 1, 2026
Post-merge amendment of the retained closure spec (original review #2426):
- names, paths and commands follow the Shift Manager rename (#2588)
- leg c sweeps the promised set: message, reasoning, tool, code block and
  ask cards, plus the devtool page (#2532)
- a4 targets eng.coder's running task session (FIX-1690: #2538/#2544/#2565)
- Part 4's Inbox reply is graded on FIX-1690's test seat (#2525)
- a2 runs without --devtool; Shift Manager serves its own (#2531)

Recorded in DECISIONS -> How it got here, and a new EVOLUTION.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
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