Skip to content

fix(agent-approval-queue): recheck legacy heuristic closes with unknown mergeable-state justification#2987

Merged
gittensory-orb[bot] merged 1 commit into
mainfrom
fix/agent-approval-queue-legacy-close-recheck
Jul 4, 2026
Merged

fix(agent-approval-queue): recheck legacy heuristic closes with unknown mergeable-state justification#2987
gittensory-orb[bot] merged 1 commit into
mainfrom
fix/agent-approval-queue-legacy-close-recheck

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Follow-up to fix(agent-actions): recheck non-ci staged closes #2902 (already merged as 706d1c1), which added an accept-time live-disposition recheck for conflict-justified heuristic closes but scoped it with a strict closeRequiresMergeableState === true check.
  • That strict comparison meant any auto_with_approval close row staged before closeRequiresMergeableState existed (field is undefined, not false) silently skipped the live recheck and executed unchecked, even if originally staged for a base conflict that has since cleared.
  • Scopes the recheck to closeRequiresMergeableState !== false instead: a known non-conflict close (false, always explicit for freshly planned closes) is still excluded, but an unknown/legacy justification (undefined) now fails toward revalidating rather than silently skipping.

Scope

  • src/services/agent-approval-queue.ts: broaden shouldRecheckLiveDisposition's close-side predicate and update the two comments describing it.
  • test/unit/agent-approval-queue.test.ts: two new regression tests covering both branches of the legacy (undefined) case, plus an update to a pre-existing unrelated test fixture (accept downgrades a staged heuristic close to a needs-human-review label when the close breaker engaged (#2127)) to explicitly set closeRequiresCiState/closeRequiresMergeableState so it isn't accidentally treated as an unknown-justification legacy row by this change.

Validation

  • npm run typecheck
  • npx vitest run test/unit/agent-approval-queue.test.ts test/unit/agent-actions.test.ts test/unit/agent-action-executor.test.ts — 346 passed
  • npx vitest run test/unit/agent-approval-queue.test.ts --coverage --coverage.include='src/services/agent-approval-queue.ts' — 100% statements/branches/functions/lines on the changed file

Safety

  • No secrets, wallets, hotkeys, trust scores, or reward values touched.
  • Preserves the existing invariant that a known non-conflict close (closeRequiresMergeableState: false, duplicate/slop/blocker-only) is still never touched by the recheck.

…wn mergeable-state justification

closeRequiresMergeableState was compared with a strict === true check, so any
pending close row staged before this field existed (closeRequiresMergeableState
undefined) silently skipped the accept-time live conflict recheck and executed
unchecked, even if it was originally staged for a base conflict that has since
cleared. Scope the recheck to !== false instead, so only an explicit false
(a known non-conflict duplicate/slop/blocker close) is excluded and an unknown
legacy justification fails toward revalidating rather than skipping.
@gittensory-orb gittensory-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.5x multiplier. label Jul 4, 2026
@gittensory-orb

gittensory-orb Bot commented Jul 4, 2026

Copy link
Copy Markdown

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-04 08:40:47 UTC

2 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This broadens the accept-time live disposition recheck for heuristic close actions from only explicit conflict rows to legacy rows with an unknown mergeable-state requirement, while preserving the explicit false escape hatch. The changed predicate matches the PR intent: undefined now revalidates, true still revalidates, and false remains excluded. The new regression coverage exercises the clean stale-disposition path and the dirty proceed path, and the updated CI-close fixture avoids accidental legacy-row classification.

Nits — 4 non-blocking
  • nit: test/unit/agent-approval-queue.test.ts:913 should assert that fetchLivePullRequestMergeState was actually called in the dirty legacy-row test, because the accepted/completed outcome alone would also pass if the live recheck were accidentally skipped.
  • nit: src/services/agent-approval-queue.ts:177 has a very long inline rationale in the hot path; consider moving the legacy-row explanation to the type doc or a small helper comment and keeping the predicate comment shorter.
  • test/unit/agent-approval-queue.test.ts:913: add an explicit call assertion for fetchLivePullRequestMergeState in the second regression test so it proves the recheck ran, not just that closing still succeeds.
  • src/services/agent-approval-queue.ts:187: consider extracting the close-side predicate into a named helper such as shouldRecheckHeuristicCloseDisposition so the true/false/undefined contract is centralized next to the comment.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 60 registered-repo PR(s), 51 merged, 421 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 60 PR(s), 421 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 60 PR(s), 421 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.06%. Comparing base (706d1c1) to head (b9f477e).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2987   +/-   ##
=======================================
  Coverage   96.06%   96.06%           
=======================================
  Files         260      260           
  Lines       28687    28687           
  Branches    10436    10436           
=======================================
  Hits        27558    27558           
  Misses        493      493           
  Partials      636      636           
Files with missing lines Coverage Δ
src/services/agent-approval-queue.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gittensory-orb gittensory-orb Bot added the gittensor Gittensor contributor context label Jul 4, 2026

@gittensory-orb gittensory-orb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@gittensory-orb gittensory-orb Bot merged commit aec5045 into main Jul 4, 2026
11 checks passed
@gittensory-orb gittensory-orb Bot deleted the fix/agent-approval-queue-legacy-close-recheck branch July 4, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.5x multiplier. gittensor Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant