Skip to content

fix(#6201): detect merge-queue membership regardless of labels - #6203

Merged
ifireball merged 2 commits into
mainfrom
agent/6201-merge-queue-label-gate
Aug 16, 2026
Merged

fix(#6201): detect merge-queue membership regardless of labels#6203
ifireball merged 2 commits into
mainfrom
agent/6201-merge-queue-label-gate

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Merge-queue detection in nextwork was gated on the ready-for-merge label, so PRs enqueued through other paths (e.g. manual approval of a requires-manual-review PR) kept reporting stale statuses like needs_review_decision instead of the terminal waiting_merge_queue.

Changes

  • Move the in_merge_queue check to the top of classify_pr() so it fires before any label-specific branch — any PR in the merge queue is now correctly classified as waiting_merge_queue regardless of labels
  • Remove the ready-for-merge label gate from maybe_check_merge_queue() so all PRs are checked against the merge-queue API
  • Narrow the post-classification reclassify loop to trigger on in_merge_queue (actual queue membership) instead of label presence
  • Add tests for merge-queue detection with requires-manual-review label and with no labels at all
  • Update TestMaybeCheckMergeQueue to verify all PRs are checked regardless of labels

Testing

  • All 184 existing tests pass
  • ruff check passes
  • New tests cover the exact scenario from the issue (PR with requires-manual-review label in the merge queue)

Closes #6201

Post-script verification

  • Branch is not main/master (agent/6201-merge-queue-label-gate)
  • Secret scan passed (gitleaks — ed0deb850458a4eb2107b51298a569c7503295db..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

The merge-queue check in nextwork was gated on the ready-for-merge
label in three places: maybe_check_merge_queue(), classify_pr(),
and the post-classification reclassify loop in main(). PRs enqueued
through other paths (e.g. manual approval of a requires-manual-review
PR) were never checked and kept reporting stale statuses like
needs_review_decision instead of the terminal waiting_merge_queue.

Move the in_merge_queue check to the top of classify_pr() so it
fires before any label-specific branch. Remove the ready-for-merge
gate from maybe_check_merge_queue() so all PRs are checked. Narrow
the reclassify loop to only re-run classification for PRs actually
found in the merge queue (in_merge_queue=True) rather than gating
on a label.

Note: pre-commit could not run (sandbox network block); the
post-script runs it authoritatively.

Closes #6201
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner August 13, 2026 18:48
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Agent PR ready for human review label Aug 13, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 13, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:49 PM UTC · Completed 7:02 PM UTC

Commit: 7688cb2 · View workflow run →

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

ralphbean
ralphbean previously approved these changes Aug 13, 2026
@ralphbean
ralphbean dismissed their stale review August 13, 2026 18:58

Waiting for fullsend-ai-review[bot]

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review

Findings

Medium

  • [protected-path] skills/nextwork/scripts/nextwork.py, skills/nextwork/scripts/nextwork_test.py, skills/nextwork/SKILL.md — All changed files are under the skills/ protected path. The PR links to issue nextwork: detect merge-queue membership regardless of ready-for-merge label #6201 and the description explains the rationale for the change. Human approval is always required for protected-path changes, regardless of context.
Previous run

Review

Findings

High

  • [stale_limitation] skills/nextwork/SKILL.md:231 — The Limitations section states “Merge-queue membership is only checked for PRs labeled ready-for-merge” and “Other PRs never report in_merge_queue.” Both statements are now incorrect — this PR removes the label gate so merge-queue membership is checked for all open PRs. The stale documentation would actively mislead readers into believing the limitation still exists.
    Remediation: Update the limitation bullet to: “Merge-queue membership is checked for all open PRs; the check uses the PR’s baseRefName when available (not only the repo default branch).”

Medium

Low

  • [incomplete_description] skills/nextwork/SKILL.md:116 — The ready_to_merge status description mentions “not yet enqueued” as a condition. While technically still accurate (the early merge-queue check classifies enqueued PRs as waiting_merge_queue before reaching this branch), the behavioral context has changed — merge-queue membership is now checked for all PRs earlier in classification, not just ready-for-merge labeled ones.

  • [docstring-precision] skills/nextwork/scripts/nextwork.py:1932 — The updated docstring “Second pass: check merge-queue membership for all open PRs” loses precision about the external API call relative to other docstrings in this file that specify the system interaction (e.g., “hits the merge-queue API”).
    Remediation: Revise to: “Second pass: hits the merge-queue API for all open PRs.”


Labels: PR fixes a bug in the nextwork skill's merge-queue detection logic


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@ralphbean ralphbean left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ifireball

Copy link
Copy Markdown
Member

/fs-fix the AI review comments

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 7:54 AM UTC · Completed 8:00 AM UTC

Commit: 7688cb2 · View workflow run →

- Update SKILL.md Limitations section to reflect that merge-queue
  membership is now checked for all open PRs (not just ready-for-merge)
- Improve docstring precision in maybe_check_merge_queue()

Addresses review feedback on #6203
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (human-triggered)

Addressed 4 review findings: fixed 2 (stale SKILL.md limitation text, imprecise docstring), disagreed with 2 (protected-path is informational only, ready_to_merge description is still technically accurate). All 184 tests pass.

Fixed (2):

  1. stale_limitation: SKILL.md Limitations section says merge-queue only checked for ready-for-merge PRs (skills/nextwork/SKILL.md): Updated the limitation bullet to state merge-queue membership is checked for all open PRs, removing the stale reference to the ready-for-merge label gate and the 'Other PRs never report in_merge_queue' sentence
  2. docstring-precision: maybe_check_merge_queue docstring lost precision about API call (skills/nextwork/scripts/nextwork.py): Revised docstring from 'check merge-queue membership for all open PRs' to 'hits the merge-queue API for all open PRs' to match the precision style of other docstrings in the file

Disagreed (2):

  1. protected-path: both changed files are under skills/ protected path: This is an informational notice that human approval is required for protected-path changes, not a code change request. The PR already modifies these files as its core purpose.
  2. incomplete_description: ready_to_merge status description mentions 'not yet enqueued': The 'not yet enqueued' condition in the ready_to_merge status description is still technically accurate — the early merge-queue check (moved to the top of classify_pr) classifies enqueued PRs as waiting_merge_queue before reaching the ready_to_merge branch, so any PR reaching ready_to_merge is by definition not yet enqueued. No text change needed.

Tests: passed

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 8:01 AM UTC · Completed 8:13 AM UTC

Commit: 6e60f3b · View workflow run →

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review August 16, 2026 08:13

Superseded by updated review

@fullsend-ai-review fullsend-ai-review Bot added the requires-manual-review Review requires human judgment label Aug 16, 2026
@ifireball
ifireball added this pull request to the merge queue Aug 16, 2026
Merged via the queue into main with commit 53456d4 Aug 16, 2026
17 checks passed
@ifireball
ifireball deleted the agent/6201-merge-queue-label-gate branch August 16, 2026 08:30
@fullsend-ai-retro

fullsend-ai-retro Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 8:32 AM UTC · Completed 8:45 AM UTC

Commit: 6e60f3b · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #6203 — detect merge-queue membership regardless of labels

This workflow went well. The end-to-end pipeline (triage → code → review → fix → re-review → merge) completed cleanly with only one fix iteration, addressing documentation updates the code agent missed.

Timeline

Time (UTC) Event
Aug 13 18:34 ralphbean filed #6201
Aug 13 18:35–18:39 Triage agent (run 31731491468) correctly identified all 3 root-cause locations in nextwork.py, applied labels, marked ready-to-code
Aug 13 18:39–18:48 Code agent (run 31731900220) produced a correct fix with tests (100% patch coverage per Codecov)
Aug 13 18:48–19:03 Review agent (run 31732655079) identified 4 findings: 1 High (stale SKILL.md), 1 Medium (informational protected-path), 2 Low (docstring precision, description wording)
Aug 13 18:58 ralphbean initially approved, then self-dismissed 28s later with "Waiting for fullsend-ai-review[bot]" — waited for the review agent before re-approving
Aug 13 19:43 ralphbean re-approved with "LGTM" after reviewing the agent's findings
Aug 16 07:52 ifireball approved
Aug 16 07:53 ifireball triggered /fs-fix the AI review comments
Aug 16 07:54–08:00 Fix agent (run 31935049636) fixed 2 findings (stale SKILL.md, docstring precision), disagreed with 2 (informational protected-path, technically-accurate description wording)
Aug 16 08:00–08:13 Post-fix review (run 31935333224) confirmed all actionable findings resolved
Aug 16 08:30 Merged by ifireball

What went well

  • Fast, accurate triage: 4 minutes, correctly identified all root-cause locations.
  • Code agent produced a correct fix on the first attempt: Well-scoped changes to 3 files, proper test coverage, all 184 tests passing.
  • Review agent caught a real documentation drift: The High-severity stale SKILL.md finding was legitimate — the Limitations section still claimed merge-queue checks were gated on ready-for-merge, which was no longer true.
  • Fix agent demonstrated good judgment: Fixed the two legitimate findings, appropriately pushed back on the two informational ones.
  • Low rework rate: Only 1 fix iteration, purely for documentation updates.
  • Human reviewer showed trust-but-verify behavior: ralphbean self-dismissed an early approval to wait for the review bot's analysis before re-approving.

Evidence for existing issues (no new proposals needed)

  • Code agent missing SKILL.md update: The code agent changed behavior but didn't update the SKILL.md Limitations section that described the old behavior. This is already covered by fullsend-ai/fullsend#4866 ("Code agent should verify agent-facing docs match new behavior after feature changes"). This PR provides another data point for that issue.
  • Review agent informational protected-path finding: The Medium-severity protected-path finding was not actionable — it's a policy gate notice, not a code defect. The fix agent had to process and disagree with it. This is already covered by fullsend-ai/agents#663 and related issues (OIDC mint: defense-in-depth follow-ups from PR #503 review #741, feat(#609): ship default AGENTS.md in scaffold #680).
  • Autonomy readiness for tested bug fixes: The review agent's findings fully covered what human reviewers caught, and humans effectively delegated to the agent's findings (ifireball triggered /fs-fix rather than identifying issues independently). This class of change (prescriptive bug fix with tests) is already tracked by fullsend-ai/agents#104.

Agents repo: fullsend-ai/agents at 89d35ec899c5824b4d98d01e579cffe3a5962928.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug component/skills ready-for-review Agent PR ready for human review requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nextwork: detect merge-queue membership regardless of ready-for-merge label

2 participants