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

The crew takes direction only from people who can write: a reader's comment never steers or starts a run #694

Closed opened this in answer to
Closed without merging

A new function, mayDirectCrew in src/crew/direct.ts, now decides who can direct the crew on a repository. It allows someone who can write to the repository (canWrite), the crew's own reviewer, or any signed-in user once the owner turns on the per-repository switch "outsiders may trigger the crew".

Notes

stopped closed without shipping deploy 69873ff

opened this

A new function, mayDirectCrew in src/crew/direct.ts, now decides who can direct the crew on a repository. It allows someone who can write to the repository (canWrite), the crew's own reviewer, or any signed-in user once the owner turns on the per-repository switch "outsiders may trigger the crew". The switch is off by default, only an admin can change it, and each change is recorded in the audit as repo.crew_outsiders.

What changed

  • Comments and reviews (src/crew/dispatch.ts): an issue comment, pull comment or commenting review from someone who fails the rule stays on the thread. It does not steer a running agent and queues no run. This also covers an unassigned pull an agent wrote, where agentFor falls back to the pull's author.
  • Other ways to start a run: tell and converge (web, POST …/following/converge, and the MCP converge tool) all check the same rule. The MCP tool used to check only read access and token scope. Assignment and the steering box keep their writer-only checks.
  • The run's prompt (src/crew/brief.ts, src/crew/runner.ts): comments and review comments from people who fail the rule are marked as untrusted input from a reader, never treated as instructions. When there are no such comments, the prompt reads as before.
  • Pages: the run page, the thread, /tell, the change view and the TUI activity screen say that only people who can write here direct the crew. Settings has the outsiders switch.
  • Schema: migration 46 adds repo.crew_outsiders, default 0.

Tests test/crew-direction.test.ts is new and is now in the gate (scripts/gate.ts). It uses a public repository and a non-member account. In it, a reader's comment does not reach a running agent, and a reader's comment and commenting review on an agent's pull queue nothing but stay on the thread. A writer's comment still steers or queues a run. With the switch on, the reader's comment queues a run. It also checks that tell, steering, assignment, and converge in the action, over HTTP and over MCP each refuse a reader. A version of dispatch.ts with the rule removed fails the suite.

One existing test was wrong and is changed: test/oauth-discovery.test.ts picked "its" migration as the last one in the list, which broke once migration 46 was added. It now finds the migration by its content. The rest of the code was not changed for it.

bun x tsc --noEmit is clean, the new suite and the two fixed tests pass, and the rest of the gate passed in the full run.

Not done here

  • Restoring the interim mitigation listed in /data/steward-unassigned-public-2026-10-05.json (agent assignments on public repositories, and vesper and torque on trevato/cs-engine's crew). That should happen after this merges.
  • Readers' comments are marked in the prompt, not dropped, so a writer can still point the agent at a reader's report.

To try it: on a public repository with a crew, comment on an agent's open issue from a non-member account. The comment shows up and nothing runs. Do the same as the owner and a run starts. Then turn on "outsiders may trigger the crew" in Settings and the non-member's comment queues a run.

🤖 Generated with Claude Code

Closes #619

commented

Review (owner's steward): the rule itself is right and comments, reviews, tell, the steering box and converge are closed with good tests. Three changes before this lands:

  1. Autonomy must apply the same rule. The ready list takes every open issue whatever its author, autonomy then assigns a builder, and the brief hands over the issue body as the task. An issue whose author does not pass mayDirectCrew must stay out of the ready list until a person who can write the repository adopts it (assigns it, labels it, or links it into the map). In the brief, mark a body written by someone who cannot direct the crew as untrusted, the way comments already are. Test: a reader opens an issue on an autonomous public repository and nothing is assigned, queued or planned from it; after a writer adopts it, it flows.
  2. Only people who may direct the crew can re-arm it. stalled() counts any comment, and the planner-decline check counts any non-agent comment, so a reader's comment un-parks a stalled issue or answers a decline. Count only authors who pass mayDirectCrew; test both.
  3. Rebase. Conflicts in schema.ts and test/oauth-discovery.test.ts: main already has migration 46, and two open pulls take 47 and 48, so take 49; keep main's version of the oauth test.

Follow-up to file, not for this pull: the crewOutsiders switch is reachable only from the web form; it needs the API and MCP (done means reachable).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs