feat(agent): DB-backed global kill-switch (instant freeze, no redeploy)#1243
Merged
Conversation
Re-ports reviewbot's instant global freeze that the convergence dropped (audit §5.2). The only global brake was the env var AGENT_ACTIONS_PAUSED, which needs a Worker redeploy/secret push to flip, and the /status isFrozen field was a hardcoded `false` stub. Adds a singleton global_agent_controls row an operator can flip with one SQL statement (no redeploy). The action-mode resolver now folds the DB freeze into globalPaused at all three call sites (executor, the queue re-gate sweep, and the MCP activation preview), so a freeze halts every agent write action within one evaluation cycle. /status now reports the real freeze state. The read fails OPEN (the env var remains the hard backstop) so a transient D1 hiccup can't by itself halt the fleet. The per-PR SubmissionLock / consumer-concurrency piece of §5.3 is a larger Durable-Object port and the audit rated its race refuted-to-low (the planner is deterministic and all side-effect writes are idempotent upserts keyed by repo#pr, with the merge SHA-pin from #1227 as the hard backstop); deferred.
Contributor
|
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 #1243 +/- ##
=======================================
Coverage 94.96% 94.96%
=======================================
Files 177 177
Lines 19783 19793 +10
Branches 7114 7118 +4
=======================================
+ Hits 18787 18797 +10
Misses 397 397
Partials 599 599
🚀 New features to boost your workflow:
|
Closed
12 tasks
7 tasks
JSONbored
added a commit
that referenced
this pull request
Jun 24, 2026
…1247) The readiness review for re-enabling autonomous review found two autonomous PR-close paths that call closePullRequest DIRECTLY, bypassing the executor chokepoint — so they honored neither the per-repo pause, the global freeze (#1243), nor agent_dry_run: - maybeRecloseDisallowedReopen (reopen-reclose) consulted none of them. - The draft-dodge auto-close honored agentPaused but not the freeze or dry-run. Both now resolve the agent action mode (the same env-brake || global-freeze || per-repo-pause || dry-run logic the executor uses) and gate the GitHub close on it: paused/frozen → no action, dry-run → audit the would-be close without touching GitHub, live → close as before. This closes the kill-switch coverage gap (frozen=1 is now a COMPLETE stop) and makes agent_dry_run a true no-op for these paths — a prerequisite for safely re-enabling review in dry-run first.
This was referenced Jul 2, 2026
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.
Summary
Re-ports reviewbot's instant global freeze that the convergence dropped (audit §5.2). The only global brake was the env var
AGENT_ACTIONS_PAUSED— which needs a Worker redeploy/secret push to flip — and the/statusisFrozenfield was a hardcodedfalsestub.global_agent_controlsrow (migration0059) an operator flips with one SQL statement, no redeploy.resolveAgentActionMode'sglobalPausednow folds in the DB freeze at all three call sites (the executor, the queue re-gate sweep, the MCP activation preview), so a freeze halts every agent write action within one evaluation cycle./statusnow reports the real freeze state (defaultOpsHealthDeps.isFrozenreads the row).Deferred (documented): the per-PR
SubmissionLock/ consumer-max_concurrencypiece of §5.3 is a larger Durable-Object port, and the audit rated its race refuted-to-low — the planner is deterministic and every side-effect write is an idempotent upsert keyed byrepo#pr, with the merge SHA-pin from #1227 as the hard backstop. Out of scope here.Scope
0059_global_agent_controls.sql(contiguous); no wrangler binding changeValidation
npm run test:ci— full gate green;db:migrations:checkOK (contiguous 0001..0059)npm audit --audit-level=moderate— 0 vulnerabilitiesisGlobalAgentFrozen/defaultOpsHealthDeps.isFrozenreport live state and fail open on a read errorSafety
site//CNAME/lovable