Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2525ad6
fix(goals): the built-in kind goal hires onto one copy of agent (FIX-…
claude Oct 9, 2026
aed8ce4
fix(goals): the held-package goal runs its seats on one agent copy (F…
claude Oct 9, 2026
55634c0
fix(goals): the capabilities goal builds its kind on the installation…
claude Oct 9, 2026
4221471
fix(goals): it-shows-who-is-on-shift on one copy per flow, asks by wo…
claude Oct 9, 2026
1fdfb1f
fix(goals): the chief-of-staff desk on one copy per flow (FIX-1824)
claude Oct 9, 2026
190b89f
fix(goals): it-draws-v2s-look reads seat asks through the shared help…
claude Oct 9, 2026
e5b3f6a
fix(goals): multi-seat-collab and its two DevTool siblings read a sea…
claude Oct 9, 2026
d22d161
fix(goals): the skinned-shell closure reads asks by the worker a sess…
claude Oct 9, 2026
22e135b
fix(goals): re-point the optimistic-reply control at the conversation…
claude Oct 9, 2026
accb40c
fix(goals): the skinned shell grades the theme mark; pickShift moves …
claude Oct 9, 2026
f80e923
fix(goals): part 4 pins a conversation's session on the seat's flow (…
claude Oct 9, 2026
55bbc65
fix(goals): it-shows-and-stops-a-task-run compares a run's flow with …
claude Oct 9, 2026
8d831cb
fix(goals): part 3 lets optimistic-turn redden the em door leg too (F…
claude Oct 9, 2026
9f9351b
docs(goals): the closure's verdict rows on the theme mark, every part…
claude Oct 9, 2026
360f03c
docs(goals): it-draws-v2s-look's verdict row with pickShift shared (F…
claude Oct 9, 2026
0ad8b70
fix(goals): it-takes-its-look-from-the-design-system on the theme mar…
claude Oct 9, 2026
d3b2098
fix(shift-manager): the theme mark's svg paints no fill of its own
claude Oct 9, 2026
d468817
docs(goals): it-takes-its-look-from-the-design-system green on the th…
claude Oct 9, 2026
9cc8f83
poc: count pending asks without grouping them by seat
cursoragent Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion goals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Every goal repeats the same scaffolding around the part that is actually its own
| `specs` | `runSpecs` — delegate to an app's mock-free vitest specs |
| `server` | `refuseIfAnswering`, `stopProcessGroup` — for a goal that spawns its own server: refuse when anything already answers on the port, and stop the whole detached process group so no survivor is left for the next run to grade |
| `playwright` | `launchChromium`, `preinstalledChromium` — Chromium for a goal that reads the shipped DevTool. **Not re-exported from `index.mts`**, so a goal that opens no browser does not load Playwright; import `../../lib/playwright.mts` directly |
| `shift-manager` | `buildShiftManagerCopy` (a patched scratch copy, built with Vite), `startShiftManager` (its command over a Lab, with `NODE_ENV` as it was before any in-process build; optional `root`, `tsx` and `timeoutMs` to serve another checkout, including an older one that has only `bin/start.mts`), `labApi` (the Lab's routes) — for the Shift Manager goals; and, for a goal that drives Shift Manager as a person in Playwright, `buildShiftManagerPages`, `labRoutes` (`labApi` read as one verified user) and `personPage` (a browser context as a given person). **Not re-exported from `index.mts`**; import `../../lib/shift-manager.mts` directly |
| `shift-manager` | `buildShiftManagerCopy` (a patched scratch copy, built with Vite), `startShiftManager` (its command over a Lab, with `NODE_ENV` as it was before any in-process build; optional `root`, `tsx` and `timeoutMs` to serve another checkout, including an older one that has only `bin/start.mts`), `labApi` (the Lab's routes), `pendingSeatAsks` (the person's pending asks on the seats' sessions, picked as Shift Manager picks them), `workerOf` (the worker a listed session names) and `pickShift` (a theme picked with the sidebar's theme mark) — for the Shift Manager goals; and, for a goal that drives Shift Manager as a person in Playwright, `buildShiftManagerPages`, `labRoutes` (`labApi` read as one verified user) and `personPage` (a browser context as a given person). **Not re-exported from `index.mts`**; import `../../lib/shift-manager.mts` directly |

The library covers scaffolding only. **The grading logic is the goal** and belongs in `run.mts`. So does retry *policy* — the corpus has three, and they mean different things (retry-until-first-pass over model flakiness vs. require-k-of-k where the stability number is itself the published result).

Expand Down
3 changes: 3 additions & 0 deletions goals/devtool-workforce-visibility/the-checklist-rows/goal.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ The view-side and server-side reds have no named control, because producing them
| 2026-09-24 | `41eb55216` (control: `silent-park`) | n/a | FAIL (expected) | **Row 4 only**, at the positive record, as before. Row 5 PASS. |
| 2026-09-24 | FIX-1502 working tree, seven hand mutations, each reverted | n/a | FAIL (expected) | Each produced once on the row-5 leg and reverted by restoring the file from a copy: **the browser read removed** from the three collections → *"[row 5] step 4: the mailbox's session eng.queue shows no Inventory tab"* plus step 6 naming each collection's missing 200. The plan expected the tab to name a 403 here; it cannot, because the manifest omits a collection with no browser read, so the tab never appears. So a second mutation left the seat and membership reads in place and declared the mailbox collection with a content read only: *"[row 5] step 4: the mailboxes section reads "failed" … The mailboxes read was refused (403): State read not permitted for "mailboxes". This is not an empty organization."* **The view pointed at the debug read**, debug off → steps 4 (each section refused 403 `debug_endpoints_disabled`) and 6 (*"the page asked the debug endpoint for the inventory"*); **the same with debug on** → step 4 passed on the debug rows, and step 6 alone failed (*"no 200 on the production collection read"*, *"a debug read was served with the debug endpoints off"*, *"the debug Resources surface does not report the debug endpoints disabled"*): the hollow pass step 6 exists for. **The tab pushed 3000px down its pane** → *"[row 5] step 5: the seats row eng.builder is out of view vertically: 0px of a 29px cell can be seen"*, one line per row. **The route made to read the foreign organization too** → *"the tab lists 4 seat(s); the store holds 3"* and *"another organization's "foreign-….seat" is on the page"*. **A mailbox that re-stamps its registration time every boot** → *"[row 5] step 3: a second boot over the same database changed the inventory"*. **A boot whose inventory reports a problem** (`seatWriter` naming a kind that is not served) → the server does not start: *"the lab's inventory did not register, so the lab will not serve: the seat rows could not be written — no flow is served under "no-such-kind""*. |
| 2026-09-28 | `1f2bc1183` (FIX-1629: the Tasks tab is now rows that open in place, and the reason is a slot on the collapsed row) | n/a | **PASS: row 4 and row 5.** Row 6 not graded, as before | The row-4 read was re-pointed from the cell under the `Reason` heading to the collapsed row's reason slot, found by `data-task-id`, with open rows counted in place of open expanders. `eng.builder` parked the row, and its run showed `parked` with the ledger's reason in the slot, no row open. At 1440px 172px of the slot is visible, and at 1280px 92px is (FIX-1523; it was 20px and 0px). Controls were re-run on the tree committed as `25a363b4` (the same check, and a DevTool without the two later row fixes): `silent-park` FAIL (expected) at row 4 only, and `no-inventory` FAIL (expected) at row 5 step 3 only. |
| 2026-10-09 | fix/FIX-1824-goals-one-copy on 9d136d21a, before the fix | n/a | FAIL | Red on `main` since FIX-1788 P4, at row 4: *"locator.getAttribute: Timeout 30000ms exceeded … waiting for locator('[data-instance-id="eng.builder"]')"*. The seat was opened as a navigator instance; it is now a worker on the one `worker` copy. |
| 2026-10-09 | fix/FIX-1824-goals-one-copy on 9d136d21a | n/a | **PASS: row 4 and row 5.** Row 6 not graded, as before | Row 4 opens the one `worker` copy, then the seat's own session on it, then its run: `eng.builder` parked its row and the run showed it `parked` with the question in the reason slot, nothing expanded. Row 5 as before: 3 seats, the mailbox `eng.queue` and 3 memberships, exactly as the store holds them, with the debug endpoints off. |
| 2026-10-09 | same (controls) | n/a | FAIL (expected) | `silent-park` at row 4 only (*"the hire parked row … with no reason on it"*), row 5 PASS. `no-inventory` at row 5 step 3 only, row 4 PASS. |
13 changes: 7 additions & 6 deletions goals/devtool-workforce-visibility/the-checklist-rows/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ async function waitForBadge(page: Page, sessionId: string): Promise<void> {
}

/**
* Open a session the way a person does: the kind, then the seat, then the
* seat's own session, then the run it spawned.
* Open a session the way a person does: the kind, then its one copy (a seat
* has none of its own; a copy's id is its kind), then the seat's own session
* on it, then the run it spawned.
*/
async function openRun(page: Page, seat: string, seatSession: string, run: string): Promise<void> {
async function openRun(page: Page, seatSession: string, run: string): Promise<void> {
const kindRow = page.locator(`[data-kind="${WORKER_KIND}"]`);
if ((await kindRow.getAttribute("aria-expanded")) !== "true") await kindRow.click();
const seatRow = page.locator(`[data-instance-id="${seat}"]`);
if ((await seatRow.getAttribute("aria-expanded")) !== "true") await seatRow.click();
const copyRow = page.locator(`[data-instance-id="${WORKER_KIND}"]`);
if ((await copyRow.getAttribute("aria-expanded")) !== "true") await copyRow.click();
await page.locator(`[data-session-id="${seatSession}"]`).click();
await waitForBadge(page, seatSession);
await page.locator(`[data-session-id="${run}"]`).click();
Expand Down Expand Up @@ -290,7 +291,7 @@ async function main(): Promise<{ failures: string[]; evidence: string }> {
// ---- the screen ------------------------------------------------------
const page = await browser.newPage({ viewport: { width: 1600, height: 1000 } });
await page.goto(served.origin, { waitUntil: "networkidle" });
await openRun(page, owner, lab.seatSession(owner), parkLine.session);
await openRun(page, lab.seatSession(owner), parkLine.session);
const onScreen = await readTaskRow(page, parked.id, (cells) => cells.Status === "parked");
await page.screenshot({ path: join(SHOTS, "row4-parked.png") });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ So the check never reads the store to decide what is on screen. The ledger is on
| 2026-09-28 | `b8ad96ff` (control: `mailbox-actions-off`) | n/a | FAIL (expected) | **tool and refuse only**: *"the mailbox's row offers [], not the board's `cancelTask_eng_queue_work`"*. Read and answer stayed green. Today's-`main` control not re-run: this round changed nothing it depends on. |
| 2026-09-28 | PR review round 6 (over `b3f74ea5d`: read grades every carried field; outcome skips lifecycle-hook roots) | n/a | **PASS** | Every leg green at 1280×800. **read:** all 16 ledger fields a client is sent were shown and matched, including `leaseDurationMs`, `writeLogTruncated` and `incarnationId` under their raw keys. `claimedBy` is server-only and noted. Answer, tool and refuse as before. Run twice. |
| 2026-09-28 | same, with the row's catch-all for unlabelled fields removed (negative, not committed) | n/a | FAIL (expected) | **read only**: *"the open row does not show leaseDurationMs, writeLogTruncated, incarnationId, which the ledger holds"*. Restored and rebuilt. |
| 2026-10-09 | fix/FIX-1824-goals-one-copy on 9d136d21a, before the fix | n/a | FAIL | Red on `main` since FIX-1788 P4, before any leg: *"locator.click: Timeout 30000ms exceeded … waiting for locator('[data-session-id="s_eng_builder"]')"*. The navigator was opened on an instance named for the seat, which no longer exists: the seat's session is on the one `worker` copy. |
| 2026-10-09 | fix/FIX-1824-goals-one-copy on 9d136d21a | n/a | **PASS** | The navigator opens the one `worker` copy (a copy's id is its kind) and the seat's session under it. Every leg green at 1280×800: the parked row collapsed shows `parked` and 92px of its reason; open, all 17 ledger fields a client is sent shown and matching; `answer` run from the row; `cancelTask_eng_queue_work` cancelled ledger and row; the second run refused as terminal with the ledger unchanged. |
| 2026-10-09 | same (control: `mailbox-actions-off`) | n/a | FAIL (expected) | **tool and refuse only**: *"the mailbox's row offers [], not the board's `cancelTask_eng_queue_work`"*, and the same for refuse. The today's-`main` control was not re-run: it compares against a DevTool from before FIX-1629, which this change does not touch. |
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ async function main(): Promise<{ failures: string[]; evidence: string }> {
await page.goto(served.origin, { waitUntil: "networkidle" });

// ---- read: collapsed, then open, in the run the row parked in ------------
await openSession(page, WORKER_KIND, owner, lab.seatSession(owner));
// A seat has no copy of its own: its session is on the one copy of the worker flow (a copy's id is its kind).
await openSession(page, WORKER_KIND, WORKER_KIND, lab.seatSession(owner));
await page.locator(`[data-session-id="${parkLine.session}"]`).click();
await waitForBadge(page, parkLine.session);
await openTasksTab(page);
Expand Down
74 changes: 74 additions & 0 deletions goals/lib/shift-manager.mts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
* itself.
* - {@link labApi}: the Lab's HTTP routes, read with the goal's own requests,
* so a goal's oracle is the store and never Shift Manager's state.
* - {@link pendingSeatAsks}: the person's pending asks on the seats' sessions,
* picked the way Shift Manager picks them, and {@link workerOf}, the worker
* a listed session names.
* - {@link pickShift}: the page put in a theme with the sidebar's theme mark,
* as a person picks one.
*
* `vite.build()` run in-process sets `process.env.NODE_ENV` to `production`
* and never restores it. A Lab started after a build would inherit it, which
Expand All @@ -36,6 +41,7 @@ import { createRequire } from "node:module";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
import type { Browser, BrowserContext, Page } from "playwright";
import { WORKER_ID_STATE_KEY } from "@flow-state-dev/workforce/browser";
import { intentFreeEnv } from "./env.mts";
import { REPO_ROOT, repoPath } from "./paths.mts";

Expand Down Expand Up @@ -238,6 +244,74 @@ export function labApi(origin: string, bearer: string | undefined) {
/** A Lab's routes, as {@link labApi} reads them. */
export type LabApi = ReturnType<typeof labApi>;

/**
* Put the page in `shift` with the sidebar's theme mark, clicking it as a person cycles the
* themes (day, evening, night), and let each click's fade (the root's `theme-fade` class)
* end before the next. The mark replaced v2's Day / Night switch (36bed1297 / #2825).
*
* @throws When three clicks never bring the mark to `shift`.
*/
export async function pickShift(page: Page, shift: "day" | "evening" | "night"): Promise<void> {
const mark = page.getByTestId("theme-mark");
for (let i = 0; i < 3 && (await mark.getAttribute("data-theme")) !== shift; i += 1) {
await mark.click();
await page.waitForFunction(() => !document.documentElement.classList.contains("theme-fade"), undefined, { timeout: 10_000 });
}
if ((await mark.getAttribute("data-theme")) !== shift) throw new Error(`the theme mark never reached "${shift}"`);
}

/** Suspension reasons that are a person being asked something. */
const PERSON_REASONS = new Set(["human_approval", "human_input"]);

/** The worker a listed session runs, as its state names it (`workerId`), or `null` when it names none. */
export function workerOf(session: Readonly<Record<string, any>>): string | null {
const worker = session.state?.[WORKER_ID_STATE_KEY];
return typeof worker === "string" ? worker : null;
}

/** A person-ask still pending in a seat's session. */
export type PendingAsk = {
suspensionId: string;
/** The session it waits in. */
sessionId: string;
/** The seat that session names as its worker, or `null` when it names none. */
seatId: string | null;
};

/**
* The person's pending asks, read from the seats' sessions as Shift Manager
* reads them (`packages/shift-manager/src/lib/reads.ts`): a session on a
* seat's kind that names that seat as its worker, or names no worker at all,
* whose asks are then the seat-less ones. An ask is a suspension asking a
* person that holds no resume.
*
* @param api Reads one session's items by type: {@link LabApi}'s `items`, or a goal's own.
* @param sessions The person's session listing, dispatch runs included: a seat
* a mailbox post woke asks from one.
* @param seats The inventory's seats, each with the kind it runs on.
*/
export async function pendingSeatAsks(
api: { items(sessionId: string, types: string[]): Promise<Array<Record<string, any>>> },
sessions: ReadonlyArray<Readonly<Record<string, any>>>,
seats: ReadonlyArray<{ id: string; kind: string | null }>,
): Promise<PendingAsk[]> {
const ids = new Set(seats.map((s) => s.id));
const kinds = new Set(seats.flatMap((s) => (s.kind === null ? [] : [s.kind])));
const asks: PendingAsk[] = [];
for (const session of sessions) {
const seatId = workerOf(session);
if (!kinds.has(String(session.flowKind)) || (seatId !== null && !ids.has(seatId))) continue;
const found = await api.items(String(session.id), ["suspension", "suspension_resume"]);
const resumed = new Set(found.filter((i) => i.type === "suspension_resume").map((i) => String(i.suspensionId)));
for (const item of found) {
if (item.type === "suspension" && PERSON_REASONS.has(String(item.reason)) && !resumed.has(String(item.suspensionId))) {
asks.push({ suspensionId: String(item.suspensionId), sessionId: String(session.id), seatId });
}
}
}
return asks;
}

/**
* Build Shift Manager's pages into `outDir` with the Vite the checkout at
* `root` carries.
Expand Down
Loading
Loading