Skip to content

fleet-paperwork: cmd_close can close a pull request — no pull_request check on the close path #6900

Closed

Description

@dezren39

Finding

fleet-paperwork close can close a pull request. GitHub's issues API returns pull requests as issues, and cmd_close never checks whether the target number is a PR — it GETs the item, PATCHes state: closed, and the readback "verifies" success, so closing a live PR by number is reported as a verified issue close.

Evidence

  • Source PR: infra: fleet-paperwork — file GitHub issues as the developing.today App #3692 (merged, merge ad1b664351d543575828b2d49ed0800fb30432a9, head 240bab31582b8851ef2717abcd157089ce42a752) — it introduced infra/fleet-paperwork/fleet_paperwork.py.
  • infra/fleet-paperwork/fleet_paperwork.py on current main (4cd2927643453bee47a0f764de534e229220cf88, verified twice via the contents API): cmd_close at line 454 GETs /repos/{repo}/issues/{n}, checks only state == "closed", PATCHes closed, and verifies only the returned state. No pull_request check anywhere in the function.
  • The sibling path proves the hazard was known: find_by_exact_title (line 282) was later fixed to skip items carrying a pull_request key (its docstring says why) and to paginate — cmd_close never got the same treatment.

Why it matters

This tool exists for unattended bulk bookkeeping under the developing.today App, and the outbox/rate-limit workflow (Drew's 2026-11-05 rule) routes real closes through it. Issue and PR numbers share one sequence, so a transposed or stale number closes a live PR instead of an issue — and the tool reports it as a verified success, the failure mode the tool was built to eliminate.

Acceptance criteria

  • cmd_close refuses (nonzero exit, clear message) when the target item carries a pull_request key, before any PATCH — including under --dry-run semantics (dry-run should surface it too).
  • A unit test with a PR-shaped GET payload proves the refusal; an issue-shaped payload still closes and verifies.
  • Existing fleet-paperwork tests still pass.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 7, 2026
  2. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor
  3. added
    priority/normalOrdinary priority (the default)
    effort/xsTrivial: expected under 30 minutes of work
    app/fleet-paperworkPackage/app: fleet-paperwork (infra/ in this repo)
    on Nov 7, 2026
  4. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged (verified) — Agent: queue worker (repo-worker-code), lane code-h — Session/ID: task 11299, repo-queue-worker-shift-h 2026-11-09 run. Task 11299 (triage) for issue #6900: fleet-paperwork cmd_close can close a pull request — no pull_request check on the close path.

    Triage verdict: CONFIRMED on fresh origin/main (f00f023, fetched 2026-11-09). cmd_close in infra/fleet-paperwork/fleet_paperwork.py (now at line 557; the issue cited line 454 on an older main — the function is unchanged in substance) GETs /repos/{repo}/issues/{n}, checks only state == "closed", PATCHes state: closed, and verifies only the returned state. No pull_request key check anywhere in the function — the only pull_request guard in the file is in the search/filter path (line ~403), exactly the sibling-path asymmetry the issue describes. Existing tests live in infra/fleet-paperwork/tests/test_fleet_paperwork.py (with fake_github.py), so the acceptance test (PR-shaped GET payload refuses; issue-shaped payload still closes+verifies) has a home.

    Routing: enqueued as a small_fix follow-up task for the queue (guard in cmd_close before any PATCH, including --dry-run surfacing it, plus the unit test). No held/user/owned/do-not-merge/do-not-auto-edit labels on issue #6900. This triage task completes as triaged; the fix itself is the follow-up task's scope.

  5. added
    status/triagedTriaged and routed (see agent note)
    and removed on Nov 9, 2026
  6. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · PR opened — Agent: queue worker (repo-worker-code), lane code-h — Session/ID: task 14410, repo-queue-worker-shift-h 2026-11-09 run. Task 14410 (small_fix, direct lane) for issue #6900: implemented the cmd_close pull_request guard verified in triage task 11299. PR #8055 (branch queue/14410-6900-close-guard, commit 3c385e8): cmd_close refuses PR-shaped targets before any PATCH, including under --dry-run; new TestCmdClosePullRequestGuard (3 tests). Full fleet-paperwork suite: 32 tests OK; git diff --check clean. Awaiting CI on PR #8055.

  7. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked (CI pending) — Agent: queue worker (repo-worker-code), lane code-h — Session/ID: task 14410, repo-queue-worker-shift-h 2026-11-09 run. Task 14410 (small_fix) for issue #6900: PR #8055 opened and targeted tests pass (32/32 fleet-paperwork suite); basic CI still pending after the 5-minute poll window (scripts-test 3.12/3.14 pass; fleet-search parity + proxy port fallbacks + security still running/queued at park time). Parking task 14410 for 20 minutes; resume condition: re-check PR #8055 checks fresh, disposition any Codex findings, merge when green under the standing criteria.

  8. added
    work/assignedQueue worker lifecycle state
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed on Nov 9, 2026
  9. added a commit that references this issue on Nov 9, 2026
  10. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 agent=repo-worker-code lane=code-k state=done task=14410 - Resumed from prior checkpoint (PR #8055 open, tests green). Fresh verification by this lane: PR #8055 MERGEABLE, diff exactly infra/fleet-paperwork/fleet_paperwork.py + its tests, unittest discover in the laptop worktree at head 3c385e8: 32 tests OK. Codex review failed to run (usage limits, no findings); CodeRabbit rate-limited (no findings) - disposition posted on PR #8055. Merged PR #8055 as c052ccf; issue #6900 closed by the merge. Task 14410 completing as fixed_merged.

  11. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    status/triagedTriaged and routed (see agent note)
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/fleet-paperworkPackage/app: fleet-paperwork (infra/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions