Repository navigation
feat(devforce-lab): FIX-1762 code in the project's repository or its files (4/4) - #2748
Conversation
…ry-tikxs6' into claude/fix-1762-lab-and-goal-bea8wn
…rd (FIX-1762) A coding run on a mailbox board now gets its files from the project that holds the board's workstream: board -> mailbox (derived from the board's minted id) -> the workstream's claim -> the project row -> its repository with the project's files beside the checkout, or the project's files alone. Reads only the claim and the row; refuses a run whose owner is not a member, or whose workstream no project holds, before any file is read. projectWorkspaceCapability declares the collections it reads. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
…its files (FIX-1762) The lab's coder runs on a workspace host whose source is projectWorkspace on the board. Storefront names a bare repository beside the store; a new Sandbox project names none. The chief of staff gains setRepository, and every repository write (setRepository, or createProject with one) waits on a human_approval in Inbox first. phase.mts validate now receives the host. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
The Brief tab shows the repository the project's coding work runs in, or "No repository · runs on project files". A legacy row reads as none. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
…(FIX-1762) Three legs on the DevTeam lab: a project with a repository runs on a branch of it with its kept files beside the checkout; a project without one runs on its files and the next run sees them; a remote the host does not allow is refused by name before anything is cloned. Controls fixed-source and no-sync-back. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
|
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. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 37e4b489-3873-4515-870a-fe3dcb8b1efc) |
Second look + architecture pass (PR 4/4, FIX-1762)Reviewed the five commits above B. The overall shape holds up: 1. Correctness: a files run is "done" without the harness doing anything (
|
There was a problem hiding this comment.
Problem this PR solves
Coding runs were tied to a single lab scratch repo regardless of which project held the board, and non-git project artifacts did not survive across runs. FIX-1762 (4/4) wires per-project repository + project-files, a projectWorkspace run source, engine list(prefix) for lazy org collections, lab/shift-manager integration, and a model-free goal that reads outcomes from git + lab.stored.
Is this the right shape?
Mostly yes. The split matches how the repo is already layered:
@flow-state-dev/workspace— clone, mount, projection, remotes allowlistworkforce— project row semantics, membership, claims, what gets stored on the rowharness-manager— supervision; consumesRunSourcevialocalWorkspaceHost
A simpler story (“just put a repository on the project row”) does not cover the goal: notes beside the checkout must not land in git, and repository-less projects need durable files. A separate project-files collection plus projectWorkspace is the minimal way to express “repo branch + project/ tree” vs “files only” without overloading the projects row or inventing a second git remote.
The engine resource-registry list(prefix) → scoped getByPrefix change is load-bearing (BP-033). Without it, multi-project orgs would bulk-load every project-files/** row on the first scoped list. Good that it ships in the same PR as the consumer.
Where complexity crept in (and what I’d do differently)
| Area | Observation | Cleaner alternative (if revisiting) |
|---|---|---|
readProjectFiles |
Lists paths/sizes but readContent() + UTF-8 encode every file (see inline). projectFileSchema already carries hash / updatedAt from projection sync but not size. |
Persist size (bytes) at write/sync time in state (or expose byte length from the store API) so listing stays metadata-only. |
| Remote validation | repository-value.ts (what may be stored) parallels workspace/remotes.ts (what may be cloned). Rules will drift. |
Shared pure parse layer; workforce maps to refusal strings, workspace adds allowlist + cloneKey. npm git-url parsers do not cover your scp + smuggling rules. |
host.mts |
Large integration surface in one module (projects seeding, workspace host, ask flow, session client). | Not wrong for a lab entrypoint; if churn continues, split at documented seams (lab-session-client, lab-door, chief-of-staff tools) rather than growing openLab further. |
Claim create vs stampClaim |
createProject inlines claim create loops instead of reusing stampClaim (intentionally never “adopts”). |
Small createClaimOnly helper to avoid future drift — optional. |
| Escaped-segment tests | Multiple adapter packages repeat similar flow-kind vectors (some may ride in from the parent branch). | Shared test vectors from engine — follow-up, not a blocker for this epic slice. |
Smaller fixes worth doing in this PR
defineProjectBlocksaction description forreadProjectFilesstill says “body” while the handler and README return path + size only — tools/models will trust the action map.
What I would not simplify away
projectWorkspaceCapability+ refusal reasons before clone — correct BP-031 story.- No browser read on
project-files+ member-only handler — intentional. - Goal anti-game (read git + storage, not harness logs) — appropriate for FIX-1762 proof.
- Volume of docs/tests — heavy but proportional to a new public workforce surface.
Verdict
Direction looks right and the cross-package boundaries are clean. I’m not approving yet because readProjectFiles scales with total file bytes for a metadata API, and the action description mismatch is a real foot-gun for chief-of-staff tooling. Neither requires re-architecting the epic; both are tighten-ups on the chosen approach.
Happy to approve after those are addressed or explicitly accepted as known v1 limits in the PR description.
Sent by Cursor Automation: Review For Best Approach
…(FIX-1762) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HncstYwr5VM81872oUq6gc
There was a problem hiding this comment.
Code Snob
withoutCredentials in goals/devforce-lab/lab/host.mts is a second copy of redactRemote (packages/workspace/src/remotes.ts). Inbox only needs the password left out of the remote it shows. Call the existing function: one export line, and the lab helper goes.
POC (draft, do not merge): #2749
Fold that subtraction into this PR, then close the POC unmerged after this lands.
I also read packages/workforce/src/projects/project-workspace.ts, goals/devforce-lab/lab/phase.mts, goals/devforce-lab/lab/scratch-repo.mts, goals/devforce-lab/it-codes-in-the-projects-repository/run.mts, and the Brief / setRepository wiring. The three-way answer, the ask-before-write, and the two rev-list probes are the contract. Folding the probes into one counter ties once each question stays. The file headers restate the code and are not a smaller shape.
Sent by Cursor Automation: Code Snob
The action description still said each file's body after the handler stopped returning bodies. Same text as #2748's 3ad370c. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyaSbP7u4EMjKM6U3bXQ6t
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0070bf674
ℹ️ 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".
…e (FIX-1762) Drops the lab's own withoutCredentials copy; workspace now exports redactRemote. Folds Cursor's POC #2749. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HncstYwr5VM81872oUq6gc
…tance; refuse a backslash in a project id (FIX-1762) - A files run is done only when workspace/ differs from what it held as the harness started (recorded through the harness cwd feed), and it now goes through the requireAcceptance gate like a repository run. - projectIdProblem refuses '\\', which a workspace mount scope rejects. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HncstYwr5VM81872oUq6gc
…sume uses (FIX-1762) The test swapped the model on the runtime's config after boot, which the HTTP door's router had already copied, so the Approve resume resolved the environment's model: a live one locally, none in CI. openLab now takes a modelResolver and the test hands it a scripted one once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HncstYwr5VM81872oUq6gc
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: e83d20de-03aa-4614-a03e-e3f020d10d44) |
…nd-goal-bea8wn # Conflicts: # goals/devforce-lab/lab/workforce/flows/workers/coder.mts
…nd-goal-bea8wn # Conflicts: # packages/shift-manager/test/devteam-repository-ask.test.ts
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 92438e7f-3b2d-4a43-98a5-074e56077fed) |


Requested by Jake · project thread
PR 4 of 4 for FIX-1762. PRs 1 to 3 (#2737, #2738, #2744) have merged, so this PR targets
mainand its diff is only PR 4's change. One review fix here touches code from PR 2: project ids now refuse a backslash. The files tool's description fix already landed with PR 2.Before
After
projectWorkspace({ board })(workforce,minor) is aRunSourcefor a project's mailbox board. It finds the project that holds the board's workstream and answers in one of three ways:project/beside the checkout.workspace/, when the project has no repository.not-a-memberwhen the run's owner isn't a member,no-projectwhen no project holds the workstream, orno-such-project.It reads exactly two rows: the workstream claim and the project. It derives the mailbox from the board id, and the run's owner comes from the server-set identity (BP-031). Its collections come through
projectWorkspaceCapability. harness-manager does not import Workforce.DevTeam (Shift Manager):
localWorkspaceHost, which allows onlyfile://remotes, withprojectWorkspaceas its source.setRepository. Every repository write waits on ahuman_approvalin Inbox, whether it comes fromsetRepositoryor fromcreateProjectwith a repository. Approve writes it and Deny writes nothing. What Inbox shows leaves out any password.Brief tab: it names the project's repository, or shows "No repository · runs on project files". A legacy row with no
repositorykey reads as none.Goal check
goals/devforce-lab/it-codes-in-the-projects-repository/: three legs and two controls (see Verification).Docs:
project/beside the checkout.phase.mtsvalidatenow receives the host. A host run counts as done in one of two cases:workspace/changed from what it held as its harness started (and that passes acceptance whenrequireAcceptanceis on);How
project-workspace.ts: the claim is read fromworkstream-claims/<mailboxId>, then the project row, which is parsed throughprojectRowSchema. Membership is checked before any file is read. The kept files are bound to the caller's ownproject-filescollection id, so every hydrate and flush is scoped to that project's key.openLab({ workspace: { root, remotes } })builds the host.labWorkspaceHost'ssaveNothingis theno-sync-backcontrol. The repository ask is atapIf/taphandler ahead of the write step, so a Deny throws out before the write runs.main:filesOnlypinning and "a failed final save fails the attempt" needed no code change here.main's ledger door and this PR's project workspace.packages/shift-manager/test/.Verification
All of the following ran on the latest merge of
main(head8b3452e2). The shift-manager suite ran with no model keys set.VG, goal check:
pnpm tsx goals/devforce-lab/it-codes-in-the-projects-repository/run.mtspasses, keyless, in about 4 s.project-files/storefront/notes/storefront-plan.md, and git status is clean.workspace/. Itsapp/index.htmlis inproject-files/sandbox/, and the second run started with it. A platform run started empty.remote-not-allowed: the remote "https://git.example.com/acme/platform.git" is not allowed on this host..clonesholds only storefront's.Controls: both fail where they must, and the control-shape guard passes.
GOAL_CONTROL=fixed-source: FAIL ata:marker(… does not hold MARKER-A.txt with marker A: it was not cut from storefront's repository), and on every leg that needs a project's source.GOAL_CONTROL=no-sync-back: FAIL on exactlya:note-saved,b:file-savedandb:second-run-sees-file(the second run started with [], not the first run's app/index.html).Held-out fixture: a second fixture, with nested paths and an ssh
git@remote, also passes.V6,
projectWorkspace:packages/workforce/test/project-workspace.test.tscovers:workstream-claims.getOptional(eng.feature)andprojects.getOptional(sandbox);not-a-memberandno-projectrefused, with no files read and no place made;It goes red with the membership check removed and with the files branch forced.
V7, repository approval:
packages/shift-manager/test/devteam-repository-ask.test.tsuses a scripted chief-of-staff model, answered through the engine's resume route as Inbox does. It covers:setRepository: nothing changes while waiting or on Deny, and Approve writes it.createProjectwith a repository: Deny creates nothing.createProjectwithout one: no ask.All three tests go red when the ask is removed.
Suites:
goalstsc --noEmitpasses, and package-boundary validation passes.pnpm install --frozen-lockfilepasses.Sibling checks: All five other DevForce goal checks pass.
Review fixes
readProjectFiles's action description now says path and size, not body.redactRemote(now exported, with apatchchangeset) instead of its own copy.projectIdProblemrefuses a backslash, which a workspace mount scope rejects.openLabtakes amodelResolver, so the approval test's resume uses its scripted model. Before this it used the environment's model, and with no key that failed in CI.Notes
minorand workspace apatch. Goals and labs get none.eng.featurebetween projects, because the lab opens one board.goalsandworkforce→workspacewere added by hand. A fullpnpm installalso rewrote unrelated entries, and I reverted those.🤖 Generated with Claude Code
https://claude.ai/code/session_01HncstYwr5VM81872oUq6gc