Skip to content

refactor(FIX-2151): the suspension reasons say user - #4093

Merged
jhoffner merged 6 commits into
mainfrom
claude/project-thread-3po1h4
Oct 28, 2026
Merged

jhoffner merged 6 commits into
mainfrom
claude/project-thread-3po1h4

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

The problem

The framework calls the person on the other end a user everywhere it can be seen (userId, waitForUser, keptOpenBy: "user"), but the two suspension reasons that wait for that person still say human: "human_approval" and "human_input".

What this does

Renames them to "user_approval" and "user_input", with no alias and no second spelling read (FIX-2071 D1; stores are reset). One committed codemod does it (scripts/codemod/rename-human-reasons.ts, ER-2), and both old strings join RETIRED in the vocabulary sweep (ER-3).

The sweep row matters more than usual here. SuspensionReason keeps an open string & {} arm, so a missed call site still compiles and silently becomes a custom reason: not a user's stop, no Inbox item, and an old human_input would default to approve/reject instead of submit. The sweep is the guard the type checker can't be.

What's asked of you

Nothing to decide. Review, and merge when you're happy.

Parts worth reviewing closely

  • Commit 1 is the codemod's unedited output (357 lines in 151 files). Re-run it on main to check it: pnpm tsx scripts/codemod/rename-human-reasons.ts. It leaves history alone: CHANGELOG.md files, blog posts, docs/internal/, goals' dated verdict rows, and its own release note.
  • The rest is by hand: the human-reasons row in goals/vocabulary/one-word-per-thing/rules.mjs, two KEEP entries (goals' dated verdict rows; the release note that has to name the old strings), the changeset, the codemod README entry, and scripts/codemod/*.ts as a fallow entry (codemods run by path, so the dead-code check read this one as an unused file).
  • The changeset marks contracts, core, engine, client and react minor, as the issue asks, and tells consumers what a leftover old string now does.

Fixes FIX-2151 · contract: specs/epics/FIX-2071/renames.md · epic spec #3985

How to review this

How to review this. This implements an approved spec — the approach and the numbered decisions in its DECISIONS.md are already signed off by a human, so please review the code against that direction, not the direction itself. The canonical set is retained at specs/epics/FIX-2071/ on main; Linear links to it and the original merged spec PR, which keeps review history. Follow-up amendment PRs explain later direction changes. Current architecture docs remain the authority for shipped behavior (BP-037).

Most valuable here: correctness on the second path (the legacy shape, the null boundary, the concurrent case, the cancel path), anything deriving an auth or routing decision from caller-controllable input, and a behaviour the tests assert around rather than on.

Already settled upstream: the approach and every decision in the spec's DECISIONS.md (human-approved — if one is wrong, say so as a spec finding and it gets folded back; don't re-argue it inline), and the conventions in docs/contributing/best-practices.md.

Engineering calls
  • A plain word-bounded replace, not a type-aware codemod: both strings are unique, so the type checker adds nothing, and it can't see the open arm anyway.
  • The sweep row reads goals and .changeset too (PENDING_NOTES), since a goal driving a stop with an old reason would also go quietly wrong.
  • Prose "human-in-the-loop" and "human-approval gate" are left alone: they are not the reason values. Kitchen-sink's human-input.ts keeps its name: renaming it only moved three long-unused exports into the dead-code check's "new" list.
  • FIX-2230 (one public route to stop for a user) is in Backlog, not in flight, so nothing to wait for.
Verification
  • CI green on 678555d.
  • pnpm typecheck: pass.
  • Vocabulary sweep: OPEN 0, --control caught. Red state: putting "human_approval" : "human_input" back in core/src/types/wait-for-user.ts makes the sweep FAIL with one open human-reasons hit at that line.
  • scripts/check-retired-terms.mjs: pass. fallow:new-dead-code origin/main: no issues.
  • git grep -w 'human_approval\|human_input' outside history: only the codemod, its README and the changeset.
  • pnpm test locally (with FSDEV_DEFAULT_MODEL unset): green apart from this container's flakes, each re-run: engine's get-items-hot-path timing test (passes alone), workforce's V5 "50 open" timeout (fails on main too) and three workforce timing tests that pass alone, and Shift Manager's command.test.ts, which needs built pages this checkout lacks.
  • Model-free goals touched by the rename, run on this branch and on main in the same container:
Goal Branch main
continue-interrupted-run (both) PASS —
devforce-lab/it-waits-for-a-person-before-it-files PASS —
vocabulary/one-word-per-thing PASS —
oversized-output/stays-out-of-the-record PASS PASS
durable-by-default/a-local-stop-is-held-and-answered PASS FAIL (server never ready, load)
task-board/holds-a-task-waiting-on-a-person FAIL a:message-while-waiting same
task-board/settles-when-its-work-is-over FAIL c:settles-first, c:outside-the-task, d:keeps-its-claim same
client/does-every-job-with-one-client FAIL c:census (an old-client reference in orchestration) same
devtool-workforce-visibility, design-system skins FAIL (Chromium launch) same
shift-manager/it-sends-a-turn-into-a-seat-session FAIL (command never served) same

No goal is worse on this branch than on main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NczDiCnsFNBm2yppev9xda

Output of scripts/codemod/rename-human-reasons.ts, unedited:
"human_approval" -> "user_approval", "human_input" -> "user_input".

FIX-2151

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiCnsFNBm2yppev9xda
Adds the human-reasons row to RETIRED (FIX-2071 ER-3), keeps goals' dated
verdict rows and the release note, renames kitchen-sink's human-input.ts
to user-input.ts, documents the codemod, and adds the changeset.

FIX-2151

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiCnsFNBm2yppev9xda
@jhoffner jhoffner self-assigned this Oct 28, 2026
@vercel

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

Request Review

@linear-code

linear-code Bot commented Oct 28, 2026

Copy link
Copy Markdown

FIX-2151

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-10-28T21:44:17.276810Z cb462e4 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.

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

@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-2151 suspension reasons

Verdict: The mechanical sweep is large (156 files) but not over-engineered. For FIX-2071/FIX-2151 the right shape is exactly what landed: update the contract once (USER_REASONS / isUserSuspension), run a committed string codemod, and add a vocabulary RETIRED rule so missed call sites cannot silently compile as custom reasons. Engine production code is untouched; React/engine diffs are literal and comment updates. No new runtime abstraction, no performance change.

Did the approach go too far?

The feel of complexity is mostly audit surface (tests + docs + goals), not extra logic. The main fork is hard cutover vs dual-read:

Approach Pros Cons
This PR (rename everywhere + vocab lint, no store migration) Matches FIX-2071 D1; one spelling; enforcer in sweep.mjs Pending stored human_* rows stop behaving as user stops (changeset documents this)
Smaller runtime change (keep new literals, add legacy membership only in isUserSuspension / waitForUserKindOf) Safer for in-flight DB rows; tiny diff Violates epic D1; two spellings live forever unless you add a migration later
ts-morph codemod (like sequencer then→step) Type-aware Overkill — tokens are unique string literals with no collision

Given the signed epic line (no aliases, reset not migrate), this PR is the cleaner change, not a simpler alternative that was skipped.

What I’d still tighten (optional, not blocking)

  1. Executable drift in specs/** POCs — retained spec prose keeping human_* is fine; runnable *.poc.test.ts / check.mts files still suspend with old reasons (outside codemod ROOTS). Copy-paste from those teaches the retired API. Consider sweeping POC code only, or retired-name-refusal markers on deliberate history lines.
  2. Codemod header vs scope — comment says the sweep must be "total" but ROOTS omits specs/ (and vocabulary ROOTS is narrower than codemod docs/). Worth one line in the script header so reviewers know what "total" means.
  3. waitForUserKindOf — after the rename, the binary ternary on user_approval vs everything else is still correct for two reasons but fragile if a third user reason appears without always setting kind. A small map or exhaustive switch would match TS conventions elsewhere.
  4. README framing — scripts/codemod/README.md opens with "type-aware (ts-morph)"; the human-reasons script is intentionally textual. One clarifying sentence avoids wrong expectations.
  5. Regression test (nice-to-have) — expect(isUserSuspension({ reason: "human_approval" })).toBe(false) documents the intentional no-dual-read policy next to the predicate tests.

Skipped recommendations (need product/epic re-gate, not simplify nits)

  • Store migration or dual-read for persisted suspension reason — explicitly out of scope per changeset and FIX-2071 D1.
  • Extracting shared scripts/codemod/lib/ — reasonable when a third string-rename lands (ER-2), not worth blocking this child.

Approve — direction and implementation match the epic; optional items above are follow-ups if you want less long-term drift.

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

Comment thread scripts/codemod/rename-human-reasons.ts Resolved

Copy link
Copy Markdown
Collaborator Author

Second look + architecture pass

Verdict: the approach is right and I found no blockers. A word-bounded codemod plus a sweep row is the leanest way to do this. A type-aware codemod would add nothing, and the sweep covers the open string & {} arm.

What I checked (on head 182d5bd)

  • git grep -nIE "human_(approval|input)|human-input|humanInput|humanApproval" outside history (CHANGELOGs, docs/internal, blog, specs/, goal verdict rows, the codemod and the changeset) returns nothing.
  • No dynamically built spellings (`human_${…}`, "human_" prefixes, regexes) exist in packages, apps, goals or scripts.
  • isUserSuspension and waitForUserKindOf in contracts/src/types/suspension.ts key on USER_REASONS and fall back to "input" for a non-approval user reason. Nothing is left reading the old strings.
  • The human-reasons rule uses \b…\b, so the underscore spelling is matched, and its two KEEP entries are scoped narrowly.

Findings (none blocking; for the implementing agent to weigh)

  1. Loud failure on retired values (BP-030: "reject removed keys loudly"). This PR makes a leftover human_* reason compile and then silently become a custom reason: no Inbox item, and an old human_input defaults to approve/reject. The sweep only protects this repo. External consumers get a changeset note and nothing at runtime. The smallest fix is one check at the engine's ctx.suspend entry that throws on the two retired strings, with a message naming the replacement. That is not an alias or a second spelling read, so it stays within FIX-2071 D1. It would also make the sweep row a secondary guard instead of the only one. If you'd rather keep the PR a pure rename, I'd file a follow-up and say so in the PR body. Either way the changeset's wording ("compiles but is treated as a custom reason") is accurate for this PR as written.

  2. Reason literals are spread across call sites. contracts has USER_REASONS, but flows, docs and goal fixtures all spell the reason as a bare string. This rename touched 151 files for that reason. A shared USER_APPROVAL_REASON / USER_INPUT_REASON constant would not have prevented that. Docs and consumer flows will keep writing literals, and the open arm means the compiler can't help. I don't think this PR should introduce constants. It is a note that the sweep row is the right long-term guard, which is another argument for finding 1.

  3. Refactor opportunity: none worth taking here. The human-input.ts → user-input.ts rename in kitchen-sink is the only structural change and it is correct. I'd leave the rest alone.

  4. Minor. The PR body says the remaining goal comparisons against main are "to follow". Please post them before merge, since continue-interrupted-run and devforce-lab are the two that exercise both reasons end to end.


Generated by Claude Code

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

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

Comment thread scripts/codemod/rename-human-reasons.ts Resolved
A re-run rewrote .changeset/user-suspension-reasons.md, which names the
old values on purpose. Also says the codemod is total under ROOTS and
textual rather than type-aware.

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

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

Head 182d5bd6bd707eb37fd6511415c75bd317db542b.

Read scripts/codemod/rename-human-reasons.ts, scripts/codemod/README.md (against rename-sequencer-then-to-step.ts), goals/vocabulary/one-word-per-thing/rules.mjs, .changeset/user-suspension-reasons.md, packages/contracts/src/types/suspension.ts, packages/core/src/errors/suspension-error.ts, packages/core/src/types/wait-for-user.ts, packages/react/src/hooks/useSuspensionForm.ts, apps/kitchen-sink/flows/chat-agent/flow.ts, and the FIX-2151 row in specs/epics/FIX-2071/renames.md. The other files are that codemod's unedited replace.

  • The codemod is the replace ER-2 asks a reviewer to re-run: two unique strings, a word boundary, skip CHANGELOG.md / blog posts / docs/internal/, and skip a goal's dated verdict row inside a file that still has live hits. The line loop is that skip. No other FIX-2071 codemod has landed, so there is no renameIdentifiers helper to call. Adding one is a new file this child does not need.
  • The sweep row matches post-to-mailbox: one pattern, the same code-or-published-plus-pending-notes files. The two KEEP entries are two reasons (a verdict row is history; the changeset has to name the old strings). One combined KEEP would put the wrong reason on one of them.
  • The README block is the re-run line the sequencer codemod already has. The changeset paragraph is the consumer migration. Kitchen-sink's human-input.ts → user-input.ts is one import; the codemod does not git mv.
  • USER_REASONS, waitForUserKindOf, and resolveAllowedActions are the same two-reason predicates with the new literals. A map or an exhaustive switch adds lines.

Moving the codemod header into the README only relocates the exclusion list. It does not shrink the contract.

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

…le name

Fallow's new-dead-code check read the codemod as an unused file and the
renamed user-input.ts's long-unused exports as new. Codemods run by path,
so scripts/codemod/*.ts joins entry; the file rename is reverted, since it
was optional and only moved pre-existing findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiCnsFNBm2yppev9xda
…all sites

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiCnsFNBm2yppev9xda
@jhoffner
jhoffner merged commit d97031f into main Oct 28, 2026
13 checks passed
@jhoffner
jhoffner deleted the claude/project-thread-3po1h4 branch October 28, 2026 21:55
jhoffner pushed a commit that referenced this pull request Oct 28, 2026
#4094 added this test with the old "human_input" reason after #4093
renamed the suspension reasons to user; the vocabulary sweep fails on
main without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFrReXArpkhZobYuj7
jhoffner pushed a commit that referenced this pull request Oct 28, 2026
…2151 retired human_input)

FIX-2157 (#4094) landed a human_input suspend after FIX-2151 (#4093) retired
the word, so the vocabulary sweep fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiGQ78WLDsELcUBdUse
jhoffner pushed a commit that referenced this pull request Oct 28, 2026
 does

Main is red: #4094 added a human_input suspension after #4093 retired the
reason, and the pre-push vocabulary sweep refuses every push. Same one-line
change as #4143; a no-op once main carries it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEMmwQjfux9CBTxNhE
jhoffner pushed a commit that referenced this pull request Oct 28, 2026
…1 renamed it

Main's vocabulary sweep fails on the one human_input left after #4093 and #4088 crossed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
jhoffner pushed a commit that referenced this pull request Oct 28, 2026
…n reason

#4093 renamed it to user_input while #4094 added this test; main fails the
vocabulary sweep on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF
jhoffner added a commit that referenced this pull request Oct 28, 2026
…06) (#4143)

#4094 added a ctx.suspend with reason "human_input" after #4093
(FIX-2151) retired it, turning main's Typecheck and Test red.


Claude-Session: https://claude.ai/code/session_01NczDiGKfzKtsjjuUwccXuh

Co-authored-by: Claude <noreply@anthropic.com>
jhoffner added a commit that referenced this pull request Oct 28, 2026
…3) (#4085)

* feat(engine): record where a turn's history starts and open the window reads (FIX-1613)

Each turn records historyStart on its request once earlier turns fall out of
its history window (one extra row read tells). Blocks get a read-only
ctx.session.window, history({ afterRequestId }), and items.turns() listing
the window's turns and open ones, or named turns by id within the session.

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

* feat(core): historySummary capability and fold, and a capability history key (FIX-1613)

utility.historySummary({ summarize }) returns a capability (a session resource
holding the running summary, the summary as context, history read after its
mark) and a fold step the flow runs before the answering generator. The fold
starts while the oldest unfolded turn is in the oldest quarter of the window,
keeps unsettled turns by id and folds them once they settle, and writes with a
version check. Capabilities gain a generator-only history preset key that
narrows every history read of the block.

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

* feat(workforce,client): beforeAnswer step and historyStart on the client type (FIX-1613)

The agent worker flow runs an app's beforeAnswer block before the worker
answers, where a history summary's fold goes. The client's request summary
carries historyStart, and a route test proves it reaches a screen. The
history preset key joins the dynamic keys a worker may pick.

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

* test(goals): history window goal check, and the changeset (FIX-1613)

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

* docs: summarizing turns past the history window (FIX-1613)

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

* fix(core): a failed fold records the oldest unfolded turn, so lost turns mark the summary incomplete (FIX-1613)

A summary whose fold kept failing never wrote nextRequestId or gap, so turns
left the window unsummarized while the resource still read complete.

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

* fix(engine): history after a mark that has not settled starts after it (FIX-1613)

A summary can move its mark past a waiting turn. That turn is not among the
settled turns history reads, so the narrowing fell back to the whole window
and the model read summarized turns again. The mark is now found among every
turn, unsettled ones included.

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

* fix(core): a fold is stale when any other fold committed, not only one that moved the mark (FIX-1613)

A fold of settled pending turns leaves the mark where it is, so a slower fold
read before it passed the mark check and wrote back over it.

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

* fix(core): a fold keeps the summarizer's key points with its summary (FIX-1613)

Core's summarizer returns { summary, keyPoints? } and a real model put the
launch date and codename in keyPoints alone; the fold kept only summary.

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

* fix(core): FIX-1613 keep a turn sharing the mark's start time once the mark leaves the window

When the mark is gone from the window, find the turns after it by the
position of the oldest turn the last fold left unfolded, before falling
back to the start-time compare.

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

* fix(engine): FIX-1613 trim the window's extra row before reordering it

The store lists turns newest first with an id tie-break; trimming the
lookahead row after a start-time-only sort could keep a different turn
than before when two turns tie at the window's edge.

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

* fix(engine): FIX-1613 order same-millisecond turns by id everywhere

Window turns and open turns were merged with a start-time-only sort, so a
turn that settled could move to the other side of a sibling a summary's
mark had already passed. One comparator, start time then id, now orders
every turn list.

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

* fix(engine,core): FIX-1613 a summary mark newer than the loaded window

A request whose window loaded before another request folded past all of it
read those turns again beside the summary, because a mark not in the
window was taken to be older than it. afterRequestId now reads the mark by
id and keeps the turns after it by start time then id; the fold no longer
records a gap when the turn after the mark is newer than its window.

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

* fix(core): FIX-1613 waiting turns no longer take the fold's places

A fold took a quarter of the window's turns, waiting ones included, so
enough older waiting turns held every settled turn back until it left the
window. The quarter now counts settled turns; waiting turns on the way
move to pending.

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

* fix(engine): FIX-1613 a retried turn keeps its place in turns()

turns() dropped an interrupted turn a retry re-ran while the window still
counted its row, so a summary's fold came due a turn too late and turns
left the window unsummarized. It is now listed settled with no messages.

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

* fix(core): FIX-1613 a resumed pending turn stays pending; lost check uses turn order

A turn behind the mark that resumed and ran its own fold dropped itself
from pending, since it cannot read itself as a turn; every pending turn
not read as settled now stays pending. The lost-turn check compared start
times only and called a newer same-millisecond turn lost; it now orders by
start time then id, like the engine.

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

* fix(engine): FIX-1613 a retried turn read by id has nothing to read

turns({ requestIds }) returned an interrupted turn a retry re-ran with its
partial output, so a pending fold could summarize it beside the retry's
answer. It now reads the same as in the window: settled, no messages.

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

* fix(engine): FIX-1613 read turns by id fresh, and ended turns as empty

turns({ requestIds }) served a turn from the window's cached record, so a
pending turn that resumed and completed since read as settled with its
partial items; it now reads the store. A turn that failed or was aborted
reads settled with no messages, as history never admits it.

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

* FIX-1613: read a shared dependency's history once through dynamic uses

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

* FIX-1613: say turns were lost when settled turns leave behind an older waiting turn

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

* FIX-1613: list a continuable interrupted turn as open

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

* test(orchestration): a steer turn's stop reason says user, as FIX-2151 renamed it

Main's vocabulary sweep fails on the one human_input left after #4093 and #4088 crossed.

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

* FIX-1613: resolve a history mark that names the resuming request

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

* FIX-1613: a fold keeps the request running it pending when it moves past it

items.turns() lists the running request open where it started, so a fold
run by an older request sees it among newer running ones; the plan leaves
it out of the window's fill.

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

* FIX-1613: list a turn that settled after the window loaded as open

A request that finished between this request's window load and its fold
was in neither read, so a fold could move its mark past it unseen.

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

* FIX-1613: drop a pending turn that retention deleted before it settled

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
jhoffner added a commit that referenced this pull request Oct 28, 2026
… side (#4083)

* goal(FIX-1918): the closure walks all four Kitchen Sink modes side by side

One browser, one next dev, one store: Flow State, Claude Code, Codex and
Cursor interleaved, each graded on l, c, p, r, kept and own off the page,
with no-resume, no-record and new-conversation controls, and a
GOAL_SCRIPTED dry run for the walk's own mechanics.

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

* goal(FIX-1918): own reads the mode's own rail row before grading what it leaves out

An empty, loading or erroring rail has no rows, so own passed without reading one.
It now waits for the walked session in its own rail (reopening Flow State's
assistant row, which a reload closes) and fails if it never shows.

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

* goal(FIX-1918): l is watched in the page, and a turn past its deadline fails its leg

A reply drawn and finished between two 500 ms polls read as no item before
completion; an observer installed before the send now records it. A turn
still running at TURN_MS returned as if it had ended and could be graded;
it now fails the leg it was sent for.

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

* test(orchestration): the settles test suspends with user_input, as #4143 does

Main is red: #4094 added a human_input suspension after #4093 retired the
reason, and the pre-push vocabulary sweep refuses every push. Same one-line
change as #4143; a no-op once main carries it.

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

* goal(FIX-1918): its own port, 3053; 3049 is codex-continues-its-thread's

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

* goal(FIX-1918): a binding the page never shows fails c and r, not compares equal

boundId() returned the "none yet" placeholder on timeout, so an id that
never arrived matched itself at turn 2 and after the reload. It now
returns "", and c and r fail on an empty id.

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

* goal(FIX-1918): a browser that fails to launch stops the server it started

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
jhoffner added a commit that referenced this pull request Oct 28, 2026
…ation (#4086)

* FIX-2154: wire the Teammates lab to the real packages

The lab now runs on a real model and a durable SQLite store through
`fsdev dev --app`: lead, researcher and writer on the built-in agent flow
with memory composed in, coder on the lab's one coding flow (one
harnessManager per harness over projectWorkspace(), routed by the worker's
`harness:`), and the user's projects created at start. The adapter calls
the workforce client, session items and streams, the message log, and
setWorkProject; the fixtures are gone (kept only as a test double).

Adds the goal check goals/teammates-lab/a-worker-talks-to-another-while-you-talk
(steps 1-3 and 5 in a browser; step 4 waits on FIX-1613), and lets
launchChromium find a pre-installed chrome-linux64 build.

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

* FIX-2154: record the goal's verdicts and controls, file the gaps

Opens the page on the first worker you can talk to, shows "idle" before a
worker's first turn, opens the roster before reading projects (a fresh
store had none to list yet), and labels a pending run without a project.
lead's WORKER.md now says to file code changes with a title and goal and
nothing in `input` (FIX-2282). The goal grades step 5 on its own task cards
and records PASS twice plus all four controls failing their steps. The
README lists what isn't wired: G1 (FIX-1613), FIX-2280, FIX-2281, FIX-2282.

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

* FIX-2154: say user, not person, in the lab's comments

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

* FIX-2154: name the Teammates lab's server config as a fallow entry

fsdev loads fsdev.config.mts by path, so nothing imports it; like
knowledge-hub's, it is an entry point.

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

* FIX-2154: keep host.mts's own constants unexported

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

* FIX-2154: answer review on the adapter and the goal

- watchWorkProject reads the last setWorkProject answer once, over every
  page of finished requests, then follows the picks made on this page, in
  place of re-reading 200 requests with their output every 1.5 s.
- watchRun's run session comes from the task rows watchTasks reads, and its
  wait stops once the run's feed is attached.
- The goal waits for coder's result after your pick, not the refused task's.

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

* FIX-2154: read the feed's snapshot again when the history moves while paged

Each later page starts on the last item held, as useSession reads it; a page
that doesn't means a keyed item moved and an older one may have been
skipped, so the read starts over. The new test loses item 10 of 502 on the
old read.

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

* FIX-2154: hand the lab's Codex runs only the environment Codex needs

CODEX_PASS moves from the kitchen sink into @flow-state-dev/codex, next to
claude-code's CLAUDE_CODE_PASS, and the Teammates lab's codex harness builds
client.env from it instead of inheriting the server's whole process.env.

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

* FIX-2154: follow a task's run by the session its card already names

watchRun takes the run session the task row names, so the runOf map and its
wait poll go. The README inventory is regenerated, which ed88b9f's host.mts
change had left stale.

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

* FIX-2154: name the issue in the Codex pass-list changeset

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

* FIX-2280: the Teammates lab reads a worker's project from its conversation

The lab named a worker's project from its own last setWorkProject answer, so a
pick made in another tab or client never showed and a long conversation could
lose it. It now reads workProjectId off the session read, which every worker
session exposes (ported from FIX-2278, #4073; it no-ops once that merges).

- workforce: a test on the built-in agent flow that a project set from a second
  client shows on the first client's read and listing, can't be seeded, and
  isn't readable by another user. Red without the expose.
- labs/teammates: watchWorkProject polls the session read; the request-answer
  read and the in-tab memo are gone.
- docs: README and projects.md say how to read the project back.

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

* FIX-2280: show a pick made here at once, before the next read confirms it

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

* FIX-2289: render worker text as Markdown in the Teammates lab

A worker's answer, a message from another worker and a task's result are drawn
through the UI registry's MessageResponse (Streamdown), copied into the lab's
flow-state components. An unfinished code fence renders as a code block while
the answer streams. Streamdown parses raw HTML by default; the lab drops its
raw rehype plugin so HTML a model writes shows as text. Tests cover the open
fence, Markdown structure and the HTML, and fail on the plain-text entries.

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

* FIX-2289: keep MessageResponse internal to the lab's Markdown component

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

* FIX-2280: recount the lab inventory after the merge

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

* FIX-2280: a project set back elsewhere shows after a pick here

The pick here was shown without the poll knowing, so a later read equal to the
poll's last one was dropped. Each read now reaches the watch, which compares it
with what the screen last showed.

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

* FIX-2289: read the lab's entries as shown in the goal check

A Markdown body is a block next to its label, so textContent ran the label
into the text ("reply12 October") and missed the date. entriesOf reads
innerText, and the task-failed check ignores case since innerText applies
the label's uppercase style. Re-run on a real model: PASS.

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

* FIX-2289: show a worker's answer as it is written

The session stream sends an item once it is finished, and a request's stream
read by id carries no text deltas, so answers arrived whole. The lab now
streams its sends and keeps the response's messages as they grow. A failed
snapshot read is read again while the conversation is watched, instead of
leaving the cached feed blank. Tests cover both; the screenshot is retaken
mid-answer.

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

* FIX-2280: recount the Teammates inventory after merging #4079

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

* Teammates lab: an unlinked task answer is not drawn as failed; lead never waits on a message

A task filed with resultTo: "conversation" ends as the worker's bare
answer, with no task id on the line, so the lab drew a finished task as
failed. Only a line that names its task and whose row did not finish is
failed now (test/entries.test.ts).

Lead's prompt names the parameter: it never passes wait, so researcher's
reply lands as its own message after lead's answer (goal step 3).

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

* Teammates lab: researcher answers only through sendMessage; goal waits for the Talk panel

Two real-model runs failed step 3 for the model's reasons: lead called
researcher (wait) once, and researcher answered in its own conversation
once, which never reaches lead. Researcher's prompt now names inReplyTo
and says only the send reaches the asker. Step 2 counted the Talk panel's
group the moment the panel opened, before it read the log; it waits now.
Verdict logged: PASS.

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

* FIX-2280: recount the Teammates inventory after merging #4079 at b82f66d

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

* Port fix: a task-board test still named the old human_input suspension reason

#4093 renamed it to user_input while #4094 added this test; main fails the
vocabulary sweep on it.

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

* FIX-2280: recount the Teammates inventory after the main merge settled

The last count ran while the merge still had unmerged entries.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
jhoffner added a commit that referenced this pull request Oct 28, 2026
…#4132)

* fix(engine): a request observer runs on its own block path (FIX-2299)

A flow's request and action observers ran on the action block's root path,
so their trace on `<requestId>:root:0` read as a re-run of the action block
and the canonical log dropped what the action block emitted. A session read
lost the EM's answer in the shift-manager turn goal (FIX-2293's em door leg).

Each observer now runs on `observer[<owner>.<hook>]` (blockPathObserver).

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

* fix(engine): type the observer hook, pin the observer's path in the test (FIX-2299)

Review on #4132: `hook` is a union of the six lifecycle hooks with one shared
`ObserverRunOptions`; the test also covers request.onCompleted and
action.onCompleted and asserts the observer's trace parses to
`observer[<hook>]` while the action's message stays on `root`. The path
grammar names `observer[...]` in block-instance-id's header and in
flows-and-actions.md.

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

* test(orchestration): the stop-for-a-person test says user_input (FIX-2151 retired human_input)

FIX-2157 (#4094) landed a human_input suspend after FIX-2151 (#4093) retired
the word, so the vocabulary sweep fails on main.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
jhoffner added a commit that referenced this pull request Oct 28, 2026
* fix(goals): task-board goals grade today's board (FIX-2296)

settles-when-its-work-is-over leg d graded keptOpenBy "user", which
FIX-2133 retired: a stop for a person is kept open by "wait" and mirrored
on the row as a suspension question. waits-on-a-task-it-filed leg c had two
races: the cancel case waited for idle before opening the gate the piece was
held on, and the kill case read getTask output before it landed.

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

* test(orchestration): the steer-turn stop says user_input

#4094 landed a human_input suspension after #4093 renamed the reasons, so
the one-word-per-thing sweep fails on main and refuses every push.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
jhoffner added a commit that referenced this pull request Oct 29, 2026
* FIX-2308: the Teammates lab gets its own Grok Bot-like theme

The lab drops @flow-state-dev/design-system's shift-manager.css for a local
theme, src/lib/theme.css: the same token names, dark only, grey steps with
soft accents, rounded surfaces and the system's sans. A worker's answer
reads as text on the page, your lines as soft bubbles, the composer as one
rounded field. This is a deliberate exception to labs taking their theme
from the design system; the README says the theme is local. CSS and lab
config only; no package and no other app changes.

Before and after shots of each screen in specs/issues/FIX-2308/assets.

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

* test(orchestration): the steer-turn wait suspends with user_input

Main carries one 'human_input' from a test added beside FIX-2151's rename
(#4093). The reason is no longer a user-input one, so the resume fails
and the test is red on main, and the pre-push vocabulary sweep refuses
the word. It suspends with 'user_input' now; 35 of 35 pass.

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

* FIX-2308: chat-first styling lives on the lab's components; theme.css is tokens only

Review: the theme's chat-first rules restyled the lab's components from
outside with unlayered, structural selectors. The classes now sit on the
components (Entry's answer is plain text, your lines a wider bubble; the
composer rounded-3xl with a rounded-full Send; the small controls
rounded-sm), and theme.css holds values only. index.html sets .dark, so
there's no flash before the script runs. The dead base-layer sidebar and
inspector fallbacks go, Inter leaves the font stack (nothing loads it),
and issue ids leave the code comments. After shots retaken; goal verdict
logged (PASS).

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

* Regenerate the teammates lab README inventory after the main merge

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
jhoffner added a commit that referenced this pull request Oct 29, 2026
…aws the divider (with FIX-1613) (#4124)

* feat(engine): record where a turn's history starts and open the window reads (FIX-1613)

Each turn records historyStart on its request once earlier turns fall out of
its history window (one extra row read tells). Blocks get a read-only
ctx.session.window, history({ afterRequestId }), and items.turns() listing
the window's turns and open ones, or named turns by id within the session.

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

* feat(core): historySummary capability and fold, and a capability history key (FIX-1613)

utility.historySummary({ summarize }) returns a capability (a session resource
holding the running summary, the summary as context, history read after its
mark) and a fold step the flow runs before the answering generator. The fold
starts while the oldest unfolded turn is in the oldest quarter of the window,
keeps unsettled turns by id and folds them once they settle, and writes with a
version check. Capabilities gain a generator-only history preset key that
narrows every history read of the block.

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

* feat(workforce,client): beforeAnswer step and historyStart on the client type (FIX-1613)

The agent worker flow runs an app's beforeAnswer block before the worker
answers, where a history summary's fold goes. The client's request summary
carries historyStart, and a route test proves it reaches a screen. The
history preset key joins the dynamic keys a worker may pick.

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

* FIX-2154: wire the Teammates lab to the real packages

The lab now runs on a real model and a durable SQLite store through
`fsdev dev --app`: lead, researcher and writer on the built-in agent flow
with memory composed in, coder on the lab's one coding flow (one
harnessManager per harness over projectWorkspace(), routed by the worker's
`harness:`), and the user's projects created at start. The adapter calls
the workforce client, session items and streams, the message log, and
setWorkProject; the fixtures are gone (kept only as a test double).

Adds the goal check goals/teammates-lab/a-worker-talks-to-another-while-you-talk
(steps 1-3 and 5 in a browser; step 4 waits on FIX-1613), and lets
launchChromium find a pre-installed chrome-linux64 build.

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

* FIX-2154: record the goal's verdicts and controls, file the gaps

Opens the page on the first worker you can talk to, shows "idle" before a
worker's first turn, opens the roster before reading projects (a fresh
store had none to list yet), and labels a pending run without a project.
lead's WORKER.md now says to file code changes with a title and goal and
nothing in `input` (FIX-2282). The goal grades step 5 on its own task cards
and records PASS twice plus all four controls failing their steps. The
README lists what isn't wired: G1 (FIX-1613), FIX-2280, FIX-2281, FIX-2282.

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

* FIX-2154: say user, not person, in the lab's comments

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

* FIX-2154: name the Teammates lab's server config as a fallow entry

fsdev loads fsdev.config.mts by path, so nothing imports it; like
knowledge-hub's, it is an entry point.

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

* FIX-2154: keep host.mts's own constants unexported

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

* FIX-2154: answer review on the adapter and the goal

- watchWorkProject reads the last setWorkProject answer once, over every
  page of finished requests, then follows the picks made on this page, in
  place of re-reading 200 requests with their output every 1.5 s.
- watchRun's run session comes from the task rows watchTasks reads, and its
  wait stops once the run's feed is attached.
- The goal waits for coder's result after your pick, not the refused task's.

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

* FIX-2154: read the feed's snapshot again when the history moves while paged

Each later page starts on the last item held, as useSession reads it; a page
that doesn't means a keyed item moved and an older one may have been
skipped, so the read starts over. The new test loses item 10 of 502 on the
old read.

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

* test(goals): history window goal check, and the changeset (FIX-1613)

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

* FIX-2154: hand the lab's Codex runs only the environment Codex needs

CODEX_PASS moves from the kitchen sink into @flow-state-dev/codex, next to
claude-code's CLAUDE_CODE_PASS, and the Teammates lab's codex harness builds
client.env from it instead of inheriting the server's whole process.env.

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

* FIX-2154: follow a task's run by the session its card already names

watchRun takes the run session the task row names, so the runOf map and its
wait poll go. The README inventory is regenerated, which ed88b9f's host.mts
change had left stale.

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

* FIX-2154: name the issue in the Codex pass-list changeset

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

* docs: summarizing turns past the history window (FIX-1613)

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

* fix(core): a failed fold records the oldest unfolded turn, so lost turns mark the summary incomplete (FIX-1613)

A summary whose fold kept failing never wrote nextRequestId or gap, so turns
left the window unsummarized while the resource still read complete.

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

* fix(engine): history after a mark that has not settled starts after it (FIX-1613)

A summary can move its mark past a waiting turn. That turn is not among the
settled turns history reads, so the narrowing fell back to the whole window
and the model read summarized turns again. The mark is now found among every
turn, unsettled ones included.

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

* fix(core): a fold is stale when any other fold committed, not only one that moved the mark (FIX-1613)

A fold of settled pending turns leaves the mark where it is, so a slower fold
read before it passed the mark check and wrote back over it.

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

* FIX-2154: the Teammates lab keeps what left its history window, and draws the divider

lead, researcher and writer install core's historySummary capability and run
its fold before they answer. The divider reads the last answering request's
historyStart and the session's historySummary mark, and is labelled
summarized only when the summary reaches the window. Goal step 4 runs 60
lines past the window, with controls no-summary and no-memory.

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

* fix(core): a fold keeps the summarizer's key points with its summary (FIX-1613)

Core's summarizer returns { summary, keyPoints? } and a real model put the
launch date and codename in keyPoints alone; the fold kept only summary.

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

* fix(core): FIX-1613 keep a turn sharing the mark's start time once the mark leaves the window

When the mark is gone from the window, find the turns after it by the
position of the oldest turn the last fold left unfolded, before falling
back to the start-time compare.

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

* fix(engine): FIX-1613 trim the window's extra row before reordering it

The store lists turns newest first with an id tie-break; trimming the
lookahead row after a start-time-only sort could keep a different turn
than before when two turns tie at the window's edge.

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

* fix(engine): FIX-1613 order same-millisecond turns by id everywhere

Window turns and open turns were merged with a start-time-only sort, so a
turn that settled could move to the other side of a sibling a summary's
mark had already passed. One comparator, start time then id, now orders
every turn list.

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

* FIX-2289: render worker text as Markdown in the Teammates lab

A worker's answer, a message from another worker and a task's result are drawn
through the UI registry's MessageResponse (Streamdown), copied into the lab's
flow-state components. An unfinished code fence renders as a code block while
the answer streams. Streamdown parses raw HTML by default; the lab drops its
raw rehype plugin so HTML a model writes shows as text. Tests cover the open
fence, Markdown structure and the HTML, and fail on the plain-text entries.

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

* FIX-2154: step 4 waits for each answer, and the summary keeps earlier facts

The goal's lines now wait for their own answer, and a codename kept as a
standing rule fails the step. The lab's summarizer is told its summary replaces
the one so far, so a fold never drops the launch facts.

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

* FIX-2289: keep MessageResponse internal to the lab's Markdown component

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

* fix(engine,core): FIX-1613 a summary mark newer than the loaded window

A request whose window loaded before another request folded past all of it
read those turns again beside the summary, because a mark not in the
window was taken to be older than it. afterRequestId now reads the mark by
id and keeps the turns after it by start time then id; the fold no longer
records a gap when the turn after the mark is newer than its window.

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

* fix(core): FIX-1613 waiting turns no longer take the fold's places

A fold took a quarter of the window's turns, waiting ones included, so
enough older waiting turns held every settled turn back until it left the
window. The quarter now counts settled turns; waiting turns on the way
move to pending.

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

* FIX-2154: step 3 may redden under the step-4 controls, with the reason

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

* FIX-2154: the lab's inventory table, current

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

* FIX-2289: read the lab's entries as shown in the goal check

A Markdown body is a block next to its label, so textContent ran the label
into the text ("reply12 October") and missed the date. entriesOf reads
innerText, and the task-failed check ignores case since innerText applies
the label's uppercase style. Re-run on a real model: PASS.

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

* FIX-2154: step 4's verdict log

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

* FIX-2289: show a worker's answer as it is written

The session stream sends an item once it is finished, and a request's stream
read by id carries no text deltas, so answers arrived whole. The lab now
streams its sends and keeps the response's messages as they grow. A failed
snapshot read is read again while the conversation is watched, instead of
leaving the cached feed blank. Tests cover both; the screenshot is retaken
mid-answer.

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

* fix(engine): FIX-1613 a retried turn keeps its place in turns()

turns() dropped an interrupted turn a retry re-ran while the window still
counted its row, so a summary's fold came due a turn too late and turns
left the window unsummarized. It is now listed settled with no messages.

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

* FIX-2154: the lab's inventory table, current

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

* fix(core): FIX-1613 a resumed pending turn stays pending; lost check uses turn order

A turn behind the mark that resumed and ran its own fold dropped itself
from pending, since it cannot read itself as a turn; every pending turn
not read as settled now stays pending. The lost-turn check compared start
times only and called a newer same-millisecond turn lost; it now orders by
start time then id, like the engine.

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

* Teammates lab: an unlinked task answer is not drawn as failed; lead never waits on a message

A task filed with resultTo: "conversation" ends as the worker's bare
answer, with no task id on the line, so the lab drew a finished task as
failed. Only a line that names its task and whose row did not finish is
failed now (test/entries.test.ts).

Lead's prompt names the parameter: it never passes wait, so researcher's
reply lands as its own message after lead's answer (goal step 3).

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

* fix(engine): FIX-1613 a retried turn read by id has nothing to read

turns({ requestIds }) returned an interrupted turn a retry re-ran with its
partial output, so a pending fold could summarize it beside the retry's
answer. It now reads the same as in the window: settled, no messages.

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

* FIX-2154: step 4 reads lead's answer once it is fully drawn

With streamed answers, "is answering" clears when the request ends, which can
be before the answer's last words are drawn: a real-model run read a
correct answer cut at "…and the". The goal now waits until the drawn
conversation stops changing.

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

* Teammates lab: researcher answers only through sendMessage; goal waits for the Talk panel

Two real-model runs failed step 3 for the model's reasons: lead called
researcher (wait) once, and researcher answered in its own conversation
once, which never reaches lead. Researcher's prompt now names inReplyTo
and says only the send reaches the asker. Step 2 counted the Talk panel's
group the moment the panel opened, before it read the log; it waits now.
Verdict logged: PASS.

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

* fix(engine): FIX-1613 read turns by id fresh, and ended turns as empty

turns({ requestIds }) served a turn from the window's cached record, so a
pending turn that resumed and completed since read as settled with its
partial items; it now reads the store. A turn that failed or was aborted
reads settled with no messages, as history never admits it.

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

* FIX-2154: record step 4's pass at 00e8f07

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

* FIX-2154: the lab's inventory table, current

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

* FIX-1613: read a shared dependency's history once through dynamic uses

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

* FIX-1613: say turns were lost when settled turns leave behind an older waiting turn

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

* FIX-1613: list a continuable interrupted turn as open

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

* test(orchestration): a steer turn's stop reason says user, as FIX-2151 renamed it

Main's vocabulary sweep fails on the one human_input left after #4093 and #4088 crossed.

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

* Store a received worker message as a user line in the recipient's history

A worker's received message landed in its history as an assistant line, so
the recipient's model read the sender's request as something it had already
said. In the teammates lab, researcher heard lead's request and ended its
turn with an empty answer and no sendMessage.

_emitMessageAwaited now takes an optional role (default assistant), and the
onMessageReceived entry writes the "From <sender>: <text>" line as user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* FIX-1613: resolve a history mark that names the resuming request

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

* FIX-1613: a fold keeps the request running it pending when it moves past it

items.turns() lists the running request open where it started, so a fold
run by an older request sees it among newer running ones; the plan leaves
it out of the window's fill.

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

* FIX-1613: list a turn that settled after the window loaded as open

A request that finished between this request's window load and its fold
was in neither read, so a fold could move its mark past it unseen.

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

* FIX-1613: drop a pending turn that retention deleted before it settled

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

* FIX-2154: place the divider by the order turns started

Overlapping turns interleave their items, so the summarized turn's last item
can sit after a newer turn's first: the divider then marked that newer turn
as summarized though the worker still reads it word for word. The divider now
goes before the first turn that started after the summary's mark.

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

* FIX-2154: regenerate the Teammates lab inventory after merging main

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

* FIX-2154: keep the summary's mark when it has a hole; the hole only drops the label

The history capability reads after throughRequestId whether or not the
summary is complete, so the divider sits there too.

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

* FIX-2154: regenerate the Teammates lab inventory after merging main

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

* FIX-2154: regenerate the Teammates lab inventory after merging main

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

* FIX-2154: goal verdicts on the merged real-tools lab

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants