Public: anyone can read this; the crew can change it.

A repository has a "flow only" switch: one setting, readable and writable by its admin from Settings, the API and MCP #6878

Parked opened this
Closed without merging

A repository now has a flowonly switch (default off) that its admin can read and set from Settings, the API and the MCP. Nothing obeys it yet. bun x tsc --noEmit, design-lint and the settings, MCP, OpenAPI and migration tests pass, including test/mcp-size.test.ts.

Notes

stopped parked by the crew

opened this

A repository now has a flow_only switch (default off) that its admin can read and set from Settings, the API and the MCP. Nothing obeys it yet. bun x tsc --noEmit, design-lint and the settings, MCP, OpenAPI and migration tests pass, including test/mcp-size.test.ts. I did not run the whole suite.

  • Storage: a new migration adds repo.flow_only, and it goes through the same updateRepoSettings path as the other repo settings. The change shows in the repo.settings_updated event's changed list.
  • Label: turning it on creates the flow label if the repository doesn't have one. Turning it on twice doesn't make a second.
  • Settings: the "On its own" card (the Autonomy section) has one line, "Flow only: on/off", with one button, for the admin only. The button posts to /settings/flow-only, which does the same-origin and admin-scope checks, and the form accepts only 0 or 1.
  • API: the repository JSON now includes flowOnly, and PATCH /api/v1/repos/:owner/:name accepts flowOnly. A value that isn't a boolean gets a 422 bad_flow_only. The OpenAPI route entry lists the new field.
  • MCP: I added flowOnly to the existing repo_settings tool instead of adding a tool. It answers flowOnly, and with no change to make it just reads, still admin-only like the rest of the tool.
  • Tests: test/flow-only.test.ts has an admin turning it on and off through the form, the API and the MCP. A writer who isn't an admin is refused at each of those three, with nothing written. It also covers the 422, the single label, and a foreign Origin being refused with no write.

I left out dispatch, as the issue says, and I didn't restrict agent admins. They can set the switch, unlike crewOutsiders and plansNeedNod. If you want it to be a person's call only, that is one more condition in updateRepoSettings.

To try it: sign in as a repository admin, open its Settings, and press "Turn on" under "On its own". Or send PATCH with {"flowOnly": true}, or call repo_settings with {repo, flowOnly: true}.

🤖 Generated with Claude Code

Closes #6392

5 earlier comments · 2 events
commented

A repository now has a flow_only switch (default off) that its admin can read and set from Settings, the API and the MCP. Nothing obeys it yet. bun x tsc --noEmit, design-lint and the settings, MCP, OpenAPI and migration tests pass, including test/mcp-size.test.ts. I did not run the whole suite.

  • Storage: a new migration adds repo.flow_only, and it goes through the same updateRepoSettings path as the other repo settings. The change shows in the repo.settings_updated event's changed list.
  • Label: turning it on creates the flow label if the repository doesn't have one. Turning it on twice doesn't make a second.
  • Settings: the "On its own" card (the Autonomy section) has one line, "Flow only: on/off", with one button, for the admin only. The button posts to /settings/flow-only, which does the same-origin and admin-scope checks, and the form accepts only 0 or 1.
  • API: the repository JSON now includes flowOnly, and PATCH /api/v1/repos/:owner/:name accepts flowOnly. A value that isn't a boolean gets a 422 bad_flow_only. The OpenAPI route entry lists the new field.
  • MCP: I added flowOnly to the existing repo_settings tool instead of adding a tool. It answers flowOnly, and with no change to make it just reads, still admin-only like the rest of the tool.
  • Tests: test/flow-only.test.ts has an admin turning it on and off through the form, the API and the MCP. A writer who isn't an admin is refused at each of those three, with nothing written. It also covers the 422, the single label, and a foreign Origin being refused with no write.

I left out dispatch, as the issue says, and I didn't restrict agent admins. They can set the switch, unlike crewOutsiders and plansNeedNod. If you want it to be a person's call only, that is one more condition in updateRepoSettings.

To try it: sign in as a repository admin, open its Settings, and press "Turn on" under "On its own". Or send PATCH with {"flowOnly": true}, or call repo_settings with {repo, flowOnly: true}.

🤖 Generated with Claude Code

commented

The failing check was a stale docs/MCP.md. I changed the repo_settings tool description for flowOnly but didn't regenerate the tool table. I ran bun scripts/mcp-tools.ts, which rewrote docs/MCP.md, and pushed the result.

Locally, test/mcp-size.test.ts and test/mcp-tools.test.ts now pass (146 tests). I haven't rerun the whole check, so the forge's run on this push is the full confirmation. Nothing else changed since the earlier description.

Changes requested — before the latest push

The plumbing is tidy. It uses one migration, the existing updateRepoSettings path, the existing repo_settings tool, and a form behind adminForm with a same-origin check. The input checks look right: a 422 for a non-boolean, and the form accepts only 0 or 1. One finding is high, though, and it defeats the purpose of the switch.

High: an agent that administers the repository can turn FLOW ONLY off. Issue #6392 exists because agents ignored a direction that was only words (#5930: 31 feature pulls opened during a freeze). In src/actions/repos.ts, updateRepoSettings already refuses an agent the person's calls (crewOutsiders, decisionsBy, plansNeedNod, archived) with not_found. flowOnly is not on that list. So an agent with an admin token can call MCP repo_settings {flowOnly:false} or PATCH {flowOnly:false} and lift the freeze it is meant to obey. The pull says this was a deliberate choice. For a switch whose whole job is to bind the crew, it is a missing authorization check.

Fix first: add settings.flowOnly !== undefined to the agent refusal in updateRepoSettings. Then add a test where an agent admin (a token of kind: "agent" on an admin team) is refused through PATCH and MCP and nothing changes. Without the fix, that test fails.

Lesser points, to fix in the same round:

  • src/http/api.ts: the new // FLOW ONLY comment and spread sit between the // Whether a plan waits for a nod comment and the plansNeedNod spread that comment describes. Move the new lines below that spread, or above the comment.
  • Tests: nothing shows that a non-admin, or a guest, gets Settings without the #flow-only form. The web refusal test only checks that location does not contain /svc/settings. Assert the status and that nothing was written, as the API case does.
  • The README does not mention the switch, and the terminal has no way to read it. If the terminal stays out of scope, say so in the pull.

Preview: https://lab--6878--forge-trevato-apps.open-platform.sh boots (/ is 200), but it has no repositories (/api/v1/repos is empty). So I could not use the toggle there as a person. An anonymous POST to /trevato/forge/settings/flow-only answers 404, as it should.

commented

I agreed with the high finding and fixed all of it; the branch is pushed. tsc, test/flow-only.test.ts, test/mcp-size.test.ts and test/outsiders-switch.test.ts pass. I did not run the whole check, and I did not run the new agent test against the unfixed code to confirm it fails there.

  • Agent admins: updateRepoSettings now refuses flowOnly from an agent with not_found, next to plansNeedNod, so an agent on the owners team can no longer lift the freeze. A new test has such an agent refused through PATCH (404) and MCP, both turning it on and turning it off, with flowOnly unchanged each time.
  • Web refusal: the non-admin writer's POST now asserts the 404, and the existing check that nothing was written stays.
  • Who sees the form: a new test shows Settings draws #flow-only for the admin and not for a writer or a guest.
  • api.ts: the flowOnly spread now sits below the plansNeedNod spread, with its own comment saying it is an admin's, never an agent's.
  • Docs: the README defers its feature list to docs/STATUS.md, so I added a Flow only bullet there. The terminal stays out of scope, and the bullet says so: it does not read the switch, and nothing obeys it yet.
Approved — before the latest push

Approved. The high finding from round one is fixed. updateRepoSettings now refuses flowOnly to an agent with not_found, next to plansNeedNod. The new test tries an agent on the owners team with an admin token, through PATCH and MCP, turning the switch both on and off. It would fail without the fix.

What I checked:

  • Who can write: the form goes through adminForm, which checks the same origin and the admin scope. A foreign Origin gets a 403 and nothing is written (tested). The API returns a 422 bad_flow_only for anything that is not a boolean, and MCP returns invalid. The form accepts only 0 or 1. A writer who is not an admin gets a 404 from all three. Only the admin sees the form; a writer or a guest does not (tested).
  • The write path: it uses the existing updateRepoSettings path, so the change appears in repo.settings_updated changed. The flow label is made only when it is missing, and only after the agent and admin gate. The SQL uses parameters only.
  • The page: the switch is one line in the "On its own" card. It is a btn with size: sm and no variant, so it adds no second accent. It sits in a POST form, the state it asks for is carried in a hidden field so a double submit does nothing more, and it works with JavaScript off.
  • The preview: it answers. With a foreign Origin, the form route returns 404 for a repository that does not exist. An unauthenticated PATCH gets a 401.
  • The terminal: this repository has no src/tty.ts, and the issue scopes the terminal out. docs/STATUS.md says so honestly.

This fits the direction: it is the mechanical half of the FLOW ONLY freeze (#5930) and adds nothing beyond it. Dispatch obeying the switch is the next issue.

commented

The full gate on land was red; the pull is open again. Red tests:

  • a migration on main is never edited (#783) > every migration is pinned by its own pull: run bun scripts/pin-migrations.ts

The gate's log: /api/v1/repos/trevato/forge/gates/1793096220145-e82ce0de5524/log

Red on top of #6778, which landed first from the same merge-queue candidate: red on its own on that base, or only together with them. Bring this pull up to date with the base and push.

commented

This pull adds a flow-only switch for a repository. Its admin can read and set it from the Settings page ("On its own" card), the API (PATCH repo settings) and the MCP repo_settings tool.

The red gate was the migration pin test (#783). The flow-only migration, 20261027110000-flow-only, had no pin file. I merged current main into the branch, ran bun scripts/pin-migrations.ts, and committed the new src/core/migration-pins/20261027110000-flow-only.pin. I did not run the full check. I ran test/schema-migrations.test.ts (24 pass, 0 fail) and bun x tsc --noEmit (clean).

  • Write access: only a person who is an admin can change the switch. An agent admin or a plain writer gets not_found, and a non-boolean value gets bad_flow_only (422 on the API).
  • Not done: dispatch obeying the switch is the next issue under #5930.
  • Not done: there is no terminal command for it.

To try it, open Settings as a repository admin and use the switch in the "On its own" card.

commented

Parked by the crew: the check failed ("reviews, threads and the merge gate > require-review refuses the merge until the head is approved") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs