Repository navigation
FIX-2280: the Teammates lab reads a worker's project from its conversation - #4086
Conversation
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
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
- 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
… 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
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
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
…ation 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
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Simplify / approach review (FIX-2280)
Verdict: The workforce change is the right minimal fix; the Teammates delta is a real simplification. Approve — nothing here blocks merge on architecture grounds.
Did this go too far?
No on the package side. workProjectId was already server-owned session state; it just was not client-projected, so any UI that needed authoritative project (including picks from another tab/client) could not read it without inventing a side channel. Wiring client: { expose: [WORK_PROJECT_STATE_KEY] } through installation.session() matches the existing FSD projection model (same idea as per-flow client.expose elsewhere) and applies once to every worker flow. A lab-only workaround would stay wrong or fragile:
| Alternative | Why I'd skip it |
|---|---|
Keep paginating completed setWorkProject requests with includeResultOutput |
Not the source of truth; expensive on long histories; still wrong once you page past the last action |
Only update local cache when this tab calls setWorkProject |
That was the original bug (FIX-2280) |
| New RPC just for "current project" | Same data as session read, more surface area |
The old adapter path (~40 lines of picked / pickWatchers / request paging) was the complexity smell; this PR removes it.
Lab layer
workProjectOf + parseProjectRef from @flow-state-dev/workforce/browser is appropriate: Teammates UI policy (shared projects only → bare id) should not reuse server-side filingProjectOf (coordinator/filed precedence). Exporting the helper for unit tests is fine.
Cross-imports look clean: lab → /browser only, not workforce internals.
Tradeoffs worth knowing (optional follow-ups, not blockers)
-
Polling fan-out:
watchWorkProjectnow uses sharedpoll()(1.5s) +sessions.get. EachuseWatchsubscriber gets its own timer. In Runs, everyFiledByrow callswatchWorkProject(filer.id)— so steady load scales with the number of conversational workers, even thoughpolldedupes UI updates, not HTTP. The old path was worse at cold open (paged history scan) but silent when idle. Consider a per-worker singleton poller (reuse the oldpickWatchersshape, but read session state) if DevTools shows chatter in Runs view. -
Local pick latency: Removing
picked.set+ synchronous watcher fan-out onsetWorkProjectmeans the UI may wait up to one poll tick for its own pick unless the select is already optimistic in React. Small UX regression possible; could push the new value locally after a successfulsetWorkProjectwhile keeping session read for cross-tab truth. -
Release notes: If
@flow-state-dev/workforceconsumers should notice session reads now includeworkProjectId, a.changesetfragment may be warranted (BP-022) — confirm against your release habit for projection additions. -
Harness tweak:
flowOf(flow)({ id: name })inprojects-harness.tsis justified for the new agent-flow test; it slightly widens the diff but is not product complexity.
Docs / tests
Workforce integration test for cross-client read on the agent flow + docs snippet in projects.md match the new contract. Teammates unit tests cover workProjectOf filtering; cross-tab behavior is appropriately owned by the package test.
Net: correct direction, smaller lab, appropriate framework exposure. Inline notes call out the two lab-side polish items I'd consider if you touch this file again soon.
Sent by Cursor Automation: Review For Best Approach
…s it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF
Second look + architecture passVerdict: the approach is right and lean (+91/−49, net deletion of the Worth fixing
Considered, no change recommended
Correctness spot checks passedNo-project ( Generated by Claude Code |
There was a problem hiding this comment.
Code Snob — already tight. No POC.
Head 6e31e6b22a4ef04b3dfcf480f582568e2a183f9c.
Read labs/teammates/src/adapter.ts, labs/teammates/test/work-project.test.ts, labs/teammates/src/lib/use-watch.ts, labs/teammates/src/components/Conversation.tsx, packages/workforce/src/workers/installation.ts, packages/workforce/test/projects-harness.ts, packages/workforce/test/work-project.test.ts, packages/workforce/src/projects/workstream-ref.ts, and the installation.session() spread in packages/workforce/src/agent-worker-flow.ts. installation.ts is the same bytes as #4073 (53d3e9c03e).
watchWorkProjectis the existingpollplussessions.get. The page loop,picked, andpickWatchersare already gone.workProjectOfis the shared-id filter the lab test locks (a private project and a bare id name none). Inlining it copies those three lines into the poll and leaves the test with nothing to call.projectWatchersis the notify aftersetWorkProject, so the controlled project select does not wait outPOLL_MS. A confirming re-read still needs that set to reachuseWatch. Holding the pick in the screen means Conversation, Runs, and the card each grow a second value.- The harness passes
{ id: name }because the agent flow is a collection. A branch only for that key is longer. - The workforce test’s new lines are the other client’s read, the listing, and the change. The seed-400 and other-user asserts sit on that same test; dropping them does not shorten the read.
not-seededalready refuses a seeded create through the samecreateCheck. - The README sentence and the docs example are the read path. No second helper to delete.
Sent by Cursor Automation: Code Snob
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
…to claude/project-thread-o2af7c # Conflicts: # labs/teammates/README.md # labs/teammates/src/adapter.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ecb5e55ffd
ℹ️ 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".
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
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
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
…to claude/project-thread-o2af7c
…laywright helper) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
…to claude/project-thread-o2af7c # Conflicts: # labs/teammates/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF
…ever 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
…s 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
…to claude/project-thread-o2af7c # Conflicts: # labs/teammates/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF
Keeps this PR's session-read watch over the squashed #4079 adapter, and restores the lab README's wiring row and the dropped FIX-2280 bullet that earlier README merges had lost; inventory recounted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF
…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
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


Requested by Jake · project thread
The problem
The Teammates lab named a worker's project from the answer of its own last
setWorkProjectrequest. A pick made in another tab or client did not show. In a long conversation the pick could drop out of the requests the lab read.What this does
This builds the approved FIX-2280 spec.
watchWorkProjectpolls the conversation's session read and names itsworkProjectId. A pick here shows at once, and a later read that differs from what is shown always reaches the screen. The request-answer read and the in-tabpickedmemo are gone. A private project names none, because the screen lists only shared projects. The README's wiring row is updated and the FIX-2280 "Not wired yet" bullet removed.listWorkerSessions. A change shows too. A create that seeds the field gets 400. Another user can't read the session. (FIX-2153: wire the Claude Code-style lab's session mode to the real packages #4073 has since merged with its own coordinator-flow read test; both are kept.)packages/workforce/README.mdandapps/docs/docs/workforce/projects.mdsay how to read the project back, and how it differs fromprojectId.packages/orchestration/test/task-board/settles-when-its-work-is-over.test.tsstill named the oldhuman_inputsuspension reason (refactor(FIX-2151): the suspension reasons say user #4093 renamed it touser_inputwhile FIX-2157: wire the Claude Code-style lab's threads mode to the real packages #4094 added the test), so main fails the vocabulary sweep. One word, same fix wherever it lands first.#4079 (the Teammates lab wiring) has merged; this PR now targets
main.Goal check
elsewhere,listing,changed,no-write,other-user(workforce test on the agent flow)expected { workerId: 'writer' } to match object { workProjectId: 'shared/apollo' }lab(adapter's read maps the stored field; shown-on-change sequence)One change from the spec: the lab test checks the adapter's pure read,
workProjectOf(state), not a fake client. A fake client forensureWorkerSessionwould mostly test the fake. The package test covers the read path end to end.Parts worth reviewing closely
packages/workforce/test/projects-harness.ts. Extra flows are now created with{ id: <key> }, because the agent flow is a collection flow. All 10 test files that use the harness pass (145 tests).Verification
packages/workforce: the 10 harness test files, 145/145.labs/teammates: typecheck clean, 27/27 tests,inventory.mjs --wiredPASS (README table rewritten).packages/orchestration: the ported test file, 35/35; vocabulary sweep PASS.check-retired-termsPASS. Lint clean.Spec
specs/issues/FIX-2280· FIX-2280 · epic FIX-2152How to review this: implementation PR. Is it correct, and does it match the approved direction?
Judge correctness and second paths: a conversation with no project, a private project, a project set by another client, and auth from caller-controllable input. Please don't re-litigate what the spec decided: read through the session read, not a workforce client call.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NczDiFjomt1WzivnJPVSoF