feat(review): hard-guardrail + owner-PR guard in auto-maintain (rollout-blocker for autonomy) - #1050
Merged
Merged
Conversation
The converged auto-maintain planner had no path awareness: a gate-passing, mergeable, approved PR would auto-merge regardless of which files it touched, and a non-passing PR tripping a noise signal would auto-close — including the repo owner's own PRs. This reproduces the awesome-claude #4196 incident class (a weakened policy script auto-merging because its path wasn't guarded) and violated the standing 'never auto-close the owner's PRs' rule. - change-guardrail.ts: pure glob matcher ported from reviewbot core/change-classifier (`*` within a segment, `**` across `/`). - guardrail-config.ts: resolve per-repo hardGuardrailGlobs from the shared REVIEW_CONFIG KV (operator tuning stays in KV, never in the repo) with a conservative .github/workflows + scripts fallback. - planner: a changed path hitting a guardrail suppresses auto-merge, auto-approve AND auto-close; label + request_changes still run so the PR falls to a human. Owner-authored PRs are never auto-closed (merge still allowed when clean). - wire changedPaths + globs + authorIsOwner from maybeRunAgentMaintenance; bind REVIEW_CONFIG KV; tests for glob semantics + guardrail/owner gating.
|
Note 🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦 💡 Gittensory review — advisory only
💡 Advisory only — no action taken
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1050 +/- ##
===========================================
+ Coverage 71.78% 96.85% +25.06%
===========================================
Files 141 143 +2
Lines 17506 17538 +32
Branches 6334 6347 +13
===========================================
+ Hits 12567 16986 +4419
+ Misses 3785 104 -3681
+ Partials 1154 448 -706 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Jun 22, 2026
JSONbored
added a commit
that referenced
this pull request
Jun 22, 2026
…ke timers) The test drove an async flow — real WebCrypto token-decrypt + async D1/fetch interleaved with one setTimeout(sleep 3000) — via a fake-timer pump loop. Under CI full-shard coverage load the real macrotask lagged the microtask flush the pump relied on, so the scheduled sleep was never fired and the test HUNG → 15s timeout (the CI-only flake that blocked #1050/#1051/#1052/#1056). Fix: drop fake timers entirely. Mock setTimeout so the sleep(3000) backoff fires on a real 0ms tick, then await processSubmitDraft directly — the flow runs to completion on the real event loop (probe 404 → instant backoff → probe 200 → open PR) with no pump, no race, no real 3s wait, no weakened assertions. Verified stable across 6+ consecutive plain + coverage runs locally.
JSONbored
added a commit
that referenced
this pull request
Jun 22, 2026
…ke timers) (#1057) The test drove an async flow — real WebCrypto token-decrypt + async D1/fetch interleaved with one setTimeout(sleep 3000) — via a fake-timer pump loop. Under CI full-shard coverage load the real macrotask lagged the microtask flush the pump relied on, so the scheduled sleep was never fired and the test HUNG → 15s timeout (the CI-only flake that blocked #1050/#1051/#1052/#1056). Fix: drop fake timers entirely. Mock setTimeout so the sleep(3000) backoff fires on a real 0ms tick, then await processSubmitDraft directly — the flow runs to completion on the real event loop (probe 404 → instant backoff → probe 200 → open PR) with no pump, no race, no real 3s wait, no weakened assertions. Verified stable across 6+ consecutive plain + coverage runs locally.
ghost
pushed a commit
that referenced
this pull request
Jun 23, 2026
…hs (#1062) The auto-maintain planner (#1050) suppressed auto-merge/close/approve only when a changed path hit a hard-guardrail glob. But maybeRunAgentMaintenance reads the changed paths from the pull_request_files cache without refreshing, so an empty (fresh PR pre-backfill) or stale (post-synchronize) cache yields changedPaths=[], making guardrailHit=false — letting the automation auto-merge/close a PR that actually touches a guarded path (.github/workflows, scripts, scoring/auth). When guardrails are configured but the changed-file set is unknown (empty), treat it as a hit: we cannot prove the PR is safe, so it must fall through to a human. Repos with no guardrails configured stay permissive. Closes #1061 Co-authored-by: galuis116 <galuis116@users.noreply.github.com> Co-authored-by: ghost <49853598+JSONbored@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Before auto-merge/auto-close autonomy can be enabled on any converged repo, the auto-maintain path needs two safety properties it currently lacks (verified by audit):
agent-actions.ts) is structurally blind to which files a PR touches. A gate-passing, mergeable, approved PR would auto-merge regardless of path — reproducing the awesome-claude feat(review): auto-trigger E2E test generation on the manifest_missing_tests signal #4196 incident class (a weakened policy script auto-merged because its path wasn't guarded). Nothing in gittensory guardedsrc/scoring/**,src/auth/**,scripts/**,.github/workflows/**, etc.What
src/signals/change-guardrail.ts— pure glob matcher ported from reviewbotcore/change-classifier(*within a segment,**across/).src/review/guardrail-config.ts— resolves each repo'shardGuardrailGlobsfrom the sharedREVIEW_CONFIGKV (keyed by repo slug), with a conservative.github/workflows/**+scripts/**fallback. Operator tuning stays in KV, never in this repo — the rich per-repo glob lists are private runtime config; only the mechanism + a generic floor are public.label+request_changesstill run, so the PR simply falls through to a human. Owner-authored PRs are never auto-closed (merge still allowed when clean + passing).maybeRunAgentMaintenancenow loads the PR's changed paths + the repo's globs +authorIsOwnerand feeds them to the planner. Adds theREVIEW_CONFIGKV binding.Fail-safe throughout: no binding ⇒ conservative default globs; config read errors ⇒ default; flag-OFF behavior unchanged (autonomy is
observeeverywhere until separately enabled).Part of the convergence epic #983 (prerequisite for the auto-maintain autonomy rollout). Typecheck clean; full unit suite (3301 tests) green.