fix(review): fail auto-maintain guardrail safe on unknown changed paths - #1062
Conversation
The auto-maintain planner (JSONbored#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 JSONbored#1061
|
Note 🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦 💡 Gittensory review — advisory only
💡 Advisory only — PR closed before full evaluation. No late first comment was created.
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 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. |
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1062 +/- ##
=======================================
Coverage 94.89% 94.89%
=======================================
Files 151 151
Lines 18249 18249
Branches 6610 6611 +1
=======================================
Hits 17317 17317
Misses 419 419
Partials 513 513 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
…uardrail-failsafe # Conflicts: # src/settings/agent-actions.ts
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
Summary
The autonomous auto-maintain planner (#1050, the "rollout-blocker for autonomy" guardrail) suppresses the irreversible dispositions (auto-merge / auto-close / auto-approve) only when a PR's changed path hits a hard-guardrail glob (
.github/workflows/**,scripts/**, scoring/auth). But the changed paths are read from thepull_request_filesDB cache with no freshness guarantee, andmaybeRunAgentMaintenancenever refreshes them:The file refresh runs only under the slop/manifest gate condition (
processors.ts:1010), which is off by default and independent of auto-maintain. So when the cache is empty (a fresh PR processed before the async backfill) or stale (asynchronizeadded a guarded file after the cache was populated),changedPaths = []→changedPathsHittingGuardrail([], globs)returns[]→guardrailHit = false→ the automation may auto-merge or auto-close a PR that actually touches a guarded path. The guardrail fails open — exactly the irreversible mis-action on a CI/policy/auth PR that #1050 exists to block.Fix
The guardrail's real contract is "never auto-merge/close a PR that touches a guarded path." If the changed paths are unknown (empty) while guardrails are configured, the automation cannot prove the PR is safe, so it must fall through to a human. Make the planner fail SAFE:
Repos with no guardrails configured stay permissive (unchanged); an empty-diff PR is not a real merge/close target, so suppressing it is harmless. (A complementary refresh-before-read in
maybeRunAgentMaintenancewould avoid merely delaying a legitimate auto-merge on the fresh-PR race; the planner fail-safe alone closes the hole.)Tests
There was no test exercising the empty-paths guardrail case (the existing planner tests pass
changedPathsexplicitly and default it to[], which silently blessed the fail-open). Added regression tests: with guardrails configured andchangedPaths: [], the planner emits nomerge/close/approve(label still runs); and with no guardrails configured, empty paths stay permissive. Planner suite 27/27; broader unit suite green (3363 passed);tscclean.Closes #1061