You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The converted-to-draft "draft-dodge" handler previously posted a comment and directly closed PRs, which bypassed the agent action executor's safety stack (global pause, dry-run, per-action autonomy, approval staging, and permission readiness), creating an authorization/behavior mismatch.
The change ensures draft-conversion close attempts obey the same safety and audit semantics as other automated maintainer actions.
Description
Replace the direct createIssueComment + closePullRequest path with a planned close action routed through executeAgentMaintenanceActions so close-specific autonomy, approval staging, dry-run, global/per-repo pause, and permission checks run before any GitHub mutation (src/queue/processors.ts).
Use getInstallation to supply installationPermissions to the executor and build a closePlannedAgentAction including requiresApproval, closeKind, and closeComment so the existing approval/flagging logic applies.
Only record the github_app.draft_dodge_closed audit event when the executor reports a completed close, avoiding misleading audit records when the executor denies, queues, dry-runs, or errors the action.
Add and update unit tests to cover executor error recording, label-only autonomy (close denied when only label is enabled), dry-run/global pause behavior, and staging when close requires approval (test/unit/queue.test.ts).
Testing
Ran the focused unit suite for the converted-to-draft handler: npx vitest run test/unit/queue.test.ts -t "converted_to_draft gate-close", which passed (tests for the block/close branches and new regression cases succeeded).
Type-check verified with npm run typecheck and succeeded.
Lint/checks verified locally with git diff --check (no whitespace/conflict marker issues).
❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.82%. Comparing base (2ea7ed1) to head (1f7d813). ⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.
❌ Your patch check has failed because the patch coverage (77.77%) is below the target coverage (97.00%). You can increase the patch coverage or adjust the target coverage.
Superseded by #1247, which closes the same gap (the draft-dodge close now respects per-repo pause, the global freeze, and agent_dry_run) and also covers the maybeRecloseDisallowedReopen close path, which this PR did not. Your executor-routing approach is cleaner architecturally — routing both direct-close paths through executeAgentMaintenanceActions so they inherit close-autonomy + approval enforcement too is a worthwhile follow-up refactor; filing that separately. Thanks for catching the gap.
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
gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.
1 participant
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.
Motivation
Description
createIssueComment+closePullRequestpath with a plannedcloseaction routed throughexecuteAgentMaintenanceActionsso close-specific autonomy, approval staging, dry-run, global/per-repo pause, and permission checks run before any GitHub mutation (src/queue/processors.ts).getInstallationto supplyinstallationPermissionsto the executor and build aclosePlannedAgentActionincludingrequiresApproval,closeKind, andcloseCommentso the existing approval/flagging logic applies.github_app.draft_dodge_closedaudit event when the executor reports a completed close, avoiding misleading audit records when the executor denies, queues, dry-runs, or errors the action.closerequires approval (test/unit/queue.test.ts).Testing
npx vitest run test/unit/queue.test.ts -t "converted_to_draft gate-close", which passed (tests for the block/close branches and new regression cases succeeded).npm run typecheckand succeeded.git diff --check(no whitespace/conflict marker issues).Codex Task