Repository navigation
feat(devforce-lab): the EM seat asks a person before it files (FIX-1666) - #2445
Conversation
A third door on the em kind: a durable action that suspends on a stock human_approval naming the feature, then on approve files the row through addRow and runs the board so the coder seat starts; on reject files nothing and says so. raiseAsk (lab/ask.mts) raises it once per feature in the EM seat's own session; openLab takes an ask option, absent by default, that turns durable execution on and calls it. New goal check it-waits-for-a-person-before-it-files: model-free and keyless, reads through the lab's HTTP door, answers through the engine's resume route. GOAL_CONTROL=no-gate fails on a row existing before any approval. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
… ask section (FIX-1666) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
|
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. |
Second look + architecture pass (FIX-1666)Direction is the approved spec's, so this reviews shape and leverage, not the decision. Overall the approach is lean: one new durable action, one step module, and Worth changing in this PR
Type and contract looseness, cheap to tighten
Architecture
Not flaggedOff-by-default wiring ( Rebase noteFIX-1667 (#2441) edits Generated by Claude Code |
There was a problem hiding this comment.
Problem
FIX-1666 needs the DevForce goal lab to raise a stock human_approval on the EM seat (no model), prove approve/deny through the same resume path App Lab uses, and leave the three existing checks untouched.
Verdict
Approve. I do not think the implementation overshot the problem. The split (ask.mts + third EM action + opt-in openLab({ ask })) matches the spec constraints: synchronous raise until suspended (HTTP 202 alone would weaken AR-6), raiseAsk callable outside openLab for App Lab / fsdev.config, and a separate door instead of a flag on file so older checks keep proving the same thing.
I ran goals/devforce-lab/it-waits-for-a-person-before-it-files/run.mts locally — PASS (~2s, keyless).
Simpler approaches (and why I’d keep this one)
| Alternative | Why it’s tempting | Why it’s worse here |
|---|---|---|
Only openLab + lab.door |
Fewer modules | 202 before the gate; harder to fail open loudly; breaks hosts that don’t use openLab |
file + waitForApproval input |
One action | Mutates what the first check proves; rejected in spec |
Idempotency only inside prepareAsk |
Shorter raiseAsk |
Spreads host vs action concerns; weaker “one host step” contract |
Extract approval factory to packages/ |
DRY with kitchen-sink | Explicitly out of scope; kitchen-sink approval-gate.ts is the right reference copy |
Reusing engine runAction + stock suspension + orchestration board.drain is the right level of “don’t roll your own HITL.”
What I’d still trim (non-blocking)
- Duplicate JSDoc before
addRowinem.mts— looks like a half-merged edit; drop the first block (inline). ask.mts→em.mtsforASK_ENTRY— host utility coupled to the worker flow file. If you want a small cleanup, mirrorINSPECT_ENTRYand put action names inseat-config.mts(or similar). Optional; not worth blocking.- FIX-1668 full spec set in this PR — no implementation creep (still
goals/only), but it widens review surface for a “1 PR” issue. If epic batching wasn’t intentional, a follow-up spec-only PR would narrow the diff; I’m not asking for that as a merge gate. specs/issues/FIX-1666/poc/durable-drain/— production shape now lives inem.mts; a one-line README pointer avoids two sources of truth.
Performance / test shape
Goal check polling + many openLab() cycles is heavy but consistent with sibling devforce goals and buys isolation. Not a production hot path.
Skipped (would need your call)
- Shared
goals/libsuspension-door helpers — wait for a second consumer. request.listfiltering in the store API — only matters if request history grows large outside tests.
Sent by Cursor Automation: Review For Best Approach
There was a problem hiding this comment.
Code Snob — already tight. No POC.
I read goals/devforce-lab/lab/ask.mts, goals/devforce-lab/lab/host.mts (the new door and the existing inspect probe), goals/devforce-lab/lab/workforce/flows/workers/em.mts, goals/devforce-lab/it-waits-for-a-person-before-it-files/run.mts, goal.md, and the README diff, against the pinned sketch in specs/issues/FIX-1666/PLAN.md.
The new door is that sketch: prepare, a stock human_approval, then tapIf onto the existing addRow and board.drain. raiseAsk is the one step the plan asked a host to call, and the goal check is the named legs, shorter than the sibling checks in this lab. That is the size of the contract. Inlining the step into the host, or collapsing the sequencer, would drop a shape the spec and the kitchen-sink approval gate already fixed.
The overlap that looks like a cut is Lab.door next to the inspect probe. Both build a Request, attach the lab bearer, and call router[method]. They then split: JSON in and JSON-or-text out, versus accept: text/event-stream and an event parse. A shared callRouter gives back about as many lines as it removes. fileInputSchema.pick({ issue: true, goal: true }) would shorten askInputSchema by a few lines and lose the ask-specific field text. The repeated board-capability cast matches the two doors already in em.mts. None of those is a smaller shape.
Sent by Cursor Automation: Code Snob
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4482e7c845
ℹ️ 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".
Drop the stale first JSDoc before addRow; move ASK_ENTRY beside INSPECT_ENTRY in seat-config.mts so ask.mts no longer imports the worker flow module; point the POC README at the production shape in em.mts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
…efusals (FIX-1666) raiseAsk now claims the feature with the resource-state store's create-if-absent write before it runs, so two concurrent raises over one store raise one ask. Only a pending, in-progress or answered request holds the claim; an interrupted, aborted, failed or incomplete one is taken over by compare-and-set and a fresh ask raised. Every store read goes through the step's refusal, so a rejecting store fails naming raiseAsk (AR-6). Goal-check legs 8-10 cover each; each fails on the previous ask.mts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
Conflicts in host.mts and em.mts resolved so both survive: the EM kind takes FIX-1667's channel ledger and this PR's fileBeforeAsking control. raiseAsk now reads 'the row exists' from the ledger the host hands the EM kind (org-scoped channel board) instead of the removed LEDGER_ID. Leg 6's perturbed tree keeps its channel (now required) and drops only the EM. README lists all five checks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
…ror (FIX-1666) raiseAsk released its claim when runAction threw but not when it returned an error, so a claim naming a request that was never read back held the feature and a reopen raised nothing. Goal-check leg 11 covers it and fails on the previous ask.mts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq
| * refuses, or the request ended in anything but a pending suspension. Every | ||
| * message starts with {@link RAISE_ASK_STEP}. | ||
| */ | ||
| export async function raiseAsk(options: RaiseAskOptions): Promise<RaiseAskResult> { |
There was a problem hiding this comment.
This feels like a core aspect of workforce, why is it in the lab
There was a problem hiding this comment.
It's in the lab because the spec fenced FIX-1666 to the goal lab's tree. The framework gained no approval model, and the ask uses the stock human_approval suspension (DECISIONS "Considered and dropped": lifting kitchen-sink's ask API into a package was ruled out).
You're right that the general part is a Workforce concept: a seat asks a person before it files work, once per piece of work, and Approve files and starts it. It is now copied twice, here and in App Lab's DevForce config. Only a few pieces are genuinely the lab's: which seat asks, and turning it on when the lab opens.
My recommendation is to merge this as it is and file a follow-up that lifts "ask before filing" into Workforce as a seat option, built on the stock suspension. The lab and App Lab would then both use it. The alternative is to lift it in this PR first, which widens it and holds up #2449 and the task screen behind it.
Generated by Claude Code


The problem
Nothing in the DevForce goal lab ever asked a person anything. App Lab's Inbox, pointed at it, stayed empty, so the closure's "Inbox → Approve & run" journey (FIX-1663, leg a1) had nothing to approve on the tree the epic pins.
What this does
When a host opens the lab with the ask turned on, the EM seat raises one approval in its own session, the same way every run and with no model: "File night-mode-toggle: … and start the coder seat on it?". Approve (through the engine's resume route, the one App Lab uses) files the row on the feature channel's board and starts the coder seat's run. Deny files nothing, and the EM says so. The ask is raised once per feature per store, even when two hosts open at the same moment. An answered ask is never re-raised; one that nobody decided (the run was interrupted or aborted) is raised again.
It is off unless a host asks for it. The other devforce-lab checks don't, and open exactly as before.
Today: opening the DevForce lab gives the EM two doors, a direct file action and a channel post, both of which file at once, and nothing ever asks a person. After: a third door, off by default, where the EM asks first; the ask sits in the EM's own session where Inbox reads, Approve files the row and hands it to the coder through the same board, Deny files nothing
What's asked of you
Nothing new. This implements the approved spec. Merging is yours.
Parts worth reviewing closely
lab/ask.mts→raiseAsk: the once-per-feature claim. Before it runs anything, the step claimsdevforce-lab-asks/<issue>with the resource-state store's create-if-absent write. The claim names the request id it then passes torunAction.suspended,in_progressorcompleted, the feature stays held.lab/host.mts:durable: trueonly whenaskis present. This is what keeps the other checks unchanged.Lab.door()sends a read or an answer through the same router and bearer the first check's leg 7 uses.Lab.stateandLab.ledgerare what a host handsraiseAsk.em.mts: the drain sits in the approved branch of the same durable request. The spec's POC settled this, and I re-ran it on this branch.addRowis still the only row writer for all three doors.Spec:
specs/issues/FIX-1666/(spec PR #2437) · Linear: FIX-1666 · Epic FIX-1649 · This PR merges.How to review this
Engineering calls
askToFile, andASK_ENTRYlives besideINSPECT_ENTRYinseat-config.mts. The option isask. The step israiseAsk, exported fromlab/ask.mtswithseatSessionId, whichhost.mts'ssessionForalso uses.resourceState.setwithexpectedVersion: 0, and a takeover sets on the claim's own version. Nothing new was added to L1. The store contract says the filesystem adapter's CAS is in-process only.openLabrefuses, namingraiseAsk, unless exactly one hired seat is on theemkind.goals/is not a vitest root.fsdev.config.mtslines) is not here. That config isn't onmain, so FIX-1662's S12 carriesdurable: trueplus araiseAsk({ state, emSeat, feature, principal, ledger })call.Everything else
Verification (on b212e21, after merging main with FIX-1667)
The goal check is model-free and keyless. Every read goes through the lab's HTTP door with the verified bearer, and the answer goes through
POST /eng.em/requests/:id/resume.it-waits-for-a-person-before-it-filesGOAL_CONTROL=no-gateit-wakes-the-seat-a-file-declaredit-keeps-its-rows-on-the-channels-boardit-commits-from-the-seats-own-file(model-backed)it-ships-an-artifact-a-person-can-open(model-backed)The review findings were each tested against the previous
ask.mts, before the main merge, and each leg failed there:Also passing:
pnpm typecheck(includesgoalsandguard:control-shape),pnpm knip:ci, andvalidate-spec-folder.Files
goals/devforce-lab/lab/workforce/flows/workers/em.mts: theaskToFiledurable action and thefileBeforeAskingcontrol.goals/devforce-lab/lab/ask.mts(new):raiseAskwith the atomic claim.goals/devforce-lab/lab/seat-config.mts:ASK_ENTRY.goals/devforce-lab/lab/host.mts: theaskoption, thefileBeforeAskingcontrol, andLab.ask/state/ledger/door.goals/devforce-lab/it-waits-for-a-person-before-it-files/:goal.md,run.mtsandfixtures/input.json.goals/devforce-lab/lab/README.md: now lists all five checks and has the ask section.specs/issues/FIX-1666/poc/durable-drain/README.md: a pointer to the production shape.Nothing under
packages/,labs/orapps/changes. No changeset: goals are private (BP-022).Cross-issue
mainby merge commit, with conflicts inhost.mtsandem.mtsresolved so both survive. The README also gainsit-keeps-its-rows-on-the-channels-board's row, which FIX-1667: DevForce feature channel carries its board #2441 hadn't listed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Cnm5DbhFmkarpesBpPQ9Dq