Skip to content

feat(policy): control-plane-by-default AGENTOWNERS + pre-worktree preflight - #4

Merged
corrm merged 2 commits into
mainfrom
feat/agentowners-coverage
Jun 21, 2026
Merged

feat(policy): control-plane-by-default AGENTOWNERS + pre-worktree preflight#4
corrm merged 2 commits into
mainfrom
feat/agentowners-coverage

Conversation

@corrm

@corrm corrm commented Jun 20, 2026

Copy link
Copy Markdown
Owner

What

Two related governance changes (BEFLOW-10 roadmap), both reusing the existing policy engine — no new evaluator, no schema change.

BEFLOW-3 — recommended control-plane AGENTOWNERS

tests/, CI (.github/), and the gate config were treated as ordinary app code, so an agent could edit them within an otherwise-allowed path. Control-plane should be protected by default.

  • Ship a compiled-in recommended AGENTOWNERS: require_approval on tests/** and .github/** (which covers CI and the AGENTOWNERS file itself).
  • beflow setup scaffolds it into each configured project repo's .github/AGENTOWNERS, never overwriting an existing file, and prints a one-step activation hint (policy.evaluator = "agentowners") — it never mutates config.
  • The shipped default is verified by test to parse through the real evaluator as require_approval rules.

BEFLOW-11 — conservative pre-worktree preflight

The AGENTOWNERS gate only runs post-diff — after an agent may have spent 30–40 min building in a worktree. Infra tasks are the expensive miss.

  • New fail-fast gate beside the decision/thin-issue gates: derive the coarse file paths the issue declares (body + title), run the same resolved policy before any worktree exists.
  • Short-circuits to Needs Input only on a confident block; require_approval/allow proceed, and an issue declaring no paths proceeds. The post-diff gate over the real diff stays authoritative.
  • Resolver lifted and shared (one definition, two call points); the AGENTOWNERS file reader is injectable in both gates.

Tests

bun run check (oxfmt + oxlint + tsc + bun test): 1032 pass / 0 fail. Preflight tests assert: blocks → Needs Input with no worktree created, agent never runs; proceeds on require_approval/allow; proceeds conservatively when no paths are declared even under a block rule; skipped when the evaluator is off or the job isn't an autonomous implement.

Honest caveat (BEFLOW-11)

A preflight is only as sharp as the paths the issue declares — it catches a whole infra module/repo cleanly, but file-level precision still needs the real diff. Fail-fast, not a replacement.

corrm added 2 commits June 21, 2026 03:19
…flight

BEFLOW-3 — recommended control-plane AGENTOWNERS:
- Ship a compiled-in recommended AGENTOWNERS (require_approval on tests/**
  and .github/**, which covers CI and the AGENTOWNERS file itself).
- `beflow setup` scaffolds it into each configured project repo's
  .github/AGENTOWNERS, never overwriting an existing file, and prints the
  one-step activation hint (policy.evaluator = "agentowners") without
  mutating config.
- The shipped default is verified to parse through the real evaluator.

BEFLOW-11 — conservative pre-worktree policy preflight:
- New fail-fast gate beside the decision/thin-issue gates: derive coarse
  file paths the issue declares (body + title) and run the SAME resolved
  policy before any worktree is built.
- Short-circuits to Needs Input ONLY on a confident block; require_approval
  and allow proceed, and an issue declaring no paths proceeds. The post-diff
  gate over the real diff stays authoritative.
- Resolver lifted and shared (one definition, two call points); the
  agentowners file reader is injectable in both the preflight and post-diff
  gates for symmetry.

bun run check: 1032 pass / 0 fail.
- add append() to the RunStoreFs test-doubles (cli/scaffold/setup) now
  that the interface requires it on main
- derivePreflightPaths: reject schemeless hostname-like tokens
  (example.com/x.html) so domains aren't mis-derived as repo paths;
  conservative — a rejected token simply proceeds to the post-diff gate
- scope the ambient *.default module declaration to */agentowners.default
@corrm
corrm force-pushed the feat/agentowners-coverage branch from de62c27 to b74f23d Compare June 21, 2026 00:23
@corrm
corrm merged commit 8573f81 into main Jun 21, 2026
1 check passed
@corrm
corrm deleted the feat/agentowners-coverage branch June 21, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant