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

A standing rule per repository: decisions here go to me, the decider, or the decider telling me the unsure ones #1736

Closed opened this
Closed without merging

A repository now has a standing rule for its hand-overs. Hand-overs on a repository ruled "decider" are answered on a timer, with nobody tapping. The new tests pass, along with asks, asks-expiry, check-list, hand-decider and settings and the schema and repo suites, and tsc is clean.

Notes

stopped closed without shipping deploy 0f302fb

opened this

A repository now has a standing rule for its hand-overs. Hand-overs on a repository ruled "decider" are answered on a timer, with nobody tapping. The new tests pass, along with asks, asks-expiry, check-list, hand-decider and settings and the schema and repo suites, and tsc is clean. I did not run the whole suite.

What changed

  • The rule: Each repository has a "Decisions here" select with three choices: me (the default), the decider, or the decider telling me the unsure ones. It sits in the autonomy form under Crew settings and saves with it, stored in a new repo.decisions_by column. The form refuses any other value, and an agent can't change the rule.
  • The sweep: src/crew/standing.ts runs on the existing asks tick for ruled repositories. It looks at each parked hand-over once per park, so an unsure answer, or a card you undid, is not asked again. At most 5 model calls per sweep.
  • The two rule modes:
    • "the decider": its set-aside stands whatever its confidence.
    • "the decider, and tell me": it sets a card aside only at 70% or more, and the unsure ones stay on your board with an "asked" ledger row.
  • Shelved repositories: A hand-over there closes with no model call. The ledger row is written by rule and has the same context and the same one-day undo.
  • MCP: asks_decide now takes by: "decider". Any other value is refused. I took "MCP decide" to mean this tool, since it is the only one that hands a card to the decider.
  • Tests: test/standing-rule.test.ts is new and added to GATE in scripts/gate.ts. It covers each of the above, plus the "me" default and the settings form.

Left out

  • Shelved: The repo has no archive flag, so I defined "shelved" as the repository's crew being off (autonomy = off). If you want a real archive state, it needs its own issue, and standing.ts is the one place to change.
  • No other doors: The rule can only be set from the settings form, not from the JSON API or MCP.
  • No board line: The "closed 4, deferred 2, asked you about 1" line on today's card is not in this pull.

To try it: On a repository's Settings → Crew page, set "Decisions here" and save. The next asks tick (within about two minutes) answers its parked cards. The reasons and the context the decider saw appear in the decision ledger. Without a decider set up on the forge, only the shelved-repository path acts.

🤖 Generated with Claude Code

Closes #1605

4 earlier comments · 1 event
commented

This pull now merges cleanly into main. The check failed on conflicts in src/core/schema.ts and src/main.ts, and I pushed the fix.

  • src/core/schema.ts: main added a release table as migration 83 (#1662), so the decisions_by column on repo is now migration 84. It keeps the me / decider / decider_tell values and the me default, and runs after the release table.
  • src/main.ts: both new imports stay, sweepStanding and releaseEnv.

tsc --noEmit is clean. The standing, schema and migration test files pass (51 tests). I did not run the full bun test, because it ran past the 10-minute limit here. The forge's check runs the whole suite on this push.

Nothing else changed. To try it, set a repository's standing rule and check that decisions go to the owner, the decider, or the decider with unsure ones told to the owner.

Changes requested — before the latest push

The core is sound. The rule is stored with a CHECK constraint, an agent cannot change it (actions/repos.ts), the settings form validates it with isDecisionsBy, the sweep spends at most 5 model calls per tick, it does not re-ask a card that was already answered or undone, and a shelved repository closes its card by rule with no model call. Each of these has a test. I found no security problem: identity, writes and escaping all go through the existing paths.

The change is only half-built across the doors, so I am requesting changes:

  1. Fix this first: MCP and the terminal cannot read or set the standing rule. Only the web settings form can. The new by argument on asks_decide accepts only "decider", which is already what the tool does without it, so it changes nothing. Add a way to read and set decisionsBy over MCP, shaped like the existing outsiders tool: without a value it says how the rule is set; with a value it plans by default, and only an admin token that is not an agent can set it. Accept it on PATCH /api/v1/repos/:owner/:name and return it in repoJson. Give the terminal (src/tui) the same read/set. Test the MCP path and the terminal path.
  2. README. It does not mention the setting. Extend the "Let the decider" section: what the three choices do, that a shelved repository closes its card without a model call, and how to set the rule on each door.
  3. Smaller: decideAsk, the manual "let the decider" button, still calls letDeciderHandle with the default decider_tell mode. On a repository ruled decider, a tap therefore behaves differently from the sweep. Either pass repo.decisionsBy or document that a tap is always cautious.

I could not reach the preview or the screenshots from my sandbox, so I judged this from the diff and the code on main alone.

commented

This update answers @sentinel's three points. The standing rule (me, decider, decider_tell) can now be read and set over MCP, the API and the terminal, as well as the web form. The tsc type check and the tests for the changed areas pass: decisions-by-doors, standing-rule, mcp, outsiders-switch, the TUI workspace and On-you suites, and check-list. I did not run the whole check.

What changed

  • MCP: a new decisions_by tool is shaped like outsiders.
    • Without by it says how the rule is set.
    • With by it plans unless dryRun: false.
    • Only a person who is an admin, with an admin token, can set it. Agents and non-admins are refused, including on a dry run.
    • I removed the by argument from asks_decide, and docs/MCP.md lists the new tool.
  • API: PATCH /api/v1/repos/:owner/:name accepts decisionsBy, and an unknown value returns 422. repoJson already carried the field, and a test now reads it back. The new setDecisionsBy in actions/repos.ts gives MCP and the terminal the same admin-only, never-an-agent path.
  • Terminal: R in a repository's workspace cycles me → decider → decider_tell. It shows only to a repository admin, and the toast names the new rule.
  • Manual tap: decideAsk now passes repo.decisionsBy, so a tap behaves like the sweep. I fixed it rather than documenting the difference.
  • README and settings hint: the "Let the decider" section now has a "The standing rule" paragraph covering what the three choices do, and that "shelved" means autonomy off. It says shelved repositories close parked cards by rule with no model call, and how to set the rule on each door. The settings hint says the same.

Tests

  • New test/decisions-by-doors.test.ts covers the API, MCP and terminal paths, including refused callers. I added it to scripts/gate.ts.
  • I replaced the old MCP test in standing-rule.test.ts, because it exercised the by argument I removed. The new test checks that a tap follows the rule: an unsure answer stays on the board under decider_tell and is set aside under decider.

Left out

  • The terminal cycles the rule with one key rather than opening a picker.
  • There is no separate activity event for a rule change beyond the existing repo.settings_updated, which lists decisionsBy as changed.
commented

I couldn't find the cause of the failed check, so this push is a guess. The log you sent stops at the check command and never shows a failure, so I tried to reproduce it by merging the current main into the branch and running the checks locally.

The merge was clean and the type check passes. The shard run printed one failure, the chromium capture test the look > a real capture through the grant door. It is environmental: it needs /usr/bin/chromium, which is unrelated to this change. All six shards were also killed with exit 143 when the local run timed out, so not every test ran. The tests I ran directly pass (the standing-rule, MCP and check-list tests, the outsiders switch, the docs and OpenAPI tests, and the TUI and studio suites). The pushed merge is cacf4591, so the forge's check will now run against a tree that includes the latest main.

If the check fails again, send me the failing test's name or the full log.

This is still the pull description:

What changed

  • The standing rule (me, decider, decider_tell) can now be read and set over MCP, the API and the terminal, as well as the web form.
  • A new decisions_by MCP tool is shaped like outsiders.
    • Without by it says how the rule is set.
    • With by it plans unless you send dryRun: false.
    • Only a person who is an admin, with an admin token, can set it. Agents are refused.
    • asks_decide no longer takes the empty by argument.
  • PATCH /api/v1/repos/:owner/:name accepts decisionsBy. An unknown value returns 422, and the repository JSON returns the field.
  • In the terminal, R in a repository's workspace cycles the rule. It shows only to a repository admin.
  • The manual "let the decider" tap now passes repo.decisionsBy, so it behaves like the sweep.
  • The README, docs/MCP.md and the settings hint explain the three choices. They say a shelved repository (autonomy off) closes its parked cards by rule with no model call, and how to set the rule on each door.

Tests

  • test/decisions-by-doors.test.ts is new and is in the gate list.
  • standing-rule.test.ts now checks that a tap follows the rule. It replaces the old test of the removed by argument.

Left out

  • There is no terminal picker, only the cycle key.
  • There is no separate activity event for a rule change beyond the existing repo.settings_updated.

Try it

  • Run PATCH {"decisionsBy":"decider"} on a repository with an admin token.
  • Call the MCP tool decisions_by {repo}.
  • Press R in a repository's workspace in the terminal.
commented

This pull gives each repository a standing rule for who answers the decisions it would otherwise ask its owner. The rule can be read and set over MCP, the API and the terminal, and the tap follows it.

The merge conflict with main is fixed. Both branches had added migration 84 in src/core/schema.ts. main's placements table (#652) keeps 84, and the repo.decisions_by column is now migration 85. The default is me, so repositories behave as before. The other values are decider and decider_tell.

The new merge commit passed 67 tests across the MCP, schema, migration and standing-rule suites, and bun x tsc --noEmit is clean on the merged tree. The full bun test run took longer than the two-minute shell limit, so I didn't see it finish. I'm leaving the whole check to the forge.

To try it, open the preview and set a repository's decisions rule. Then check that a new decision is routed to the owner or the decider as the rule says.

commented

Parked by the crew: main moved under it 2 times and the branch could not be brought up to date (src/main.ts)

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs