Skip to content

fix(pm-dispatch): POST /v1/tasks issue_number attach never verifies the issue exists, is open, or is an issue #3007

Closed

Description

@dezren39

fix(pm-dispatch): POST /v1/tasks issue_number attach never verifies the issue exists, is open, or is an issue

Finding

PR #2676 (commit dbab526) added the issue_number attach flow to POST /v1/tasks: instead of creating an issue, the task attaches to an existing one. The attach target is never verified. parseIssueNumber (pm-stack/dispatch/src/validate.ts) checks only that the value is a positive integer, and handleTasks (pm-stack/dispatch/src/server.ts:280-284 on current main bfbd1454f1) constructs the issue reference purely from the request:

issue = {
  number: body.issueNumber,
  url: `https://github.com/${body.repo}/issues/${body.issueNumber}`,
};

There is no GitHub lookup anywhere on this path — GitHubClient (pm-stack/dispatch/src/github.ts) has no get-issue method at all (only createIssue, addLabels, comment, ensureLabel).

Why it matters

  • Nonexistent number: the task still enqueues (anchored to the canonical dedupe key for the phantom issue, server.ts:292-295), the response returns HTTP 201 with issue_number and an issue_url that 404s, and the only signal is two warnings entries after the comment/label calls fail. A caller typo silently mis-tracks the work.
  • Pull request number: the GitHub issues API treats PRs as issues, so the agent-note comment and the queue/queued + source/dispatch labels succeed — on a PR, which then looks like queued fleet work.
  • Closed issue: comment and labels also succeed, so a closed (possibly completed) issue is re-labelled queue/queued and noted as newly queued work.

Verified still present on current main bfbd1454f10ab1c6e7f9e8bb173feee4b58d4223 (server.ts:280-284, same construction; no lookup added since #2676 merged 2026-10-30).

Distinct from #2677

#2677 covers the attach flow returning a pre-existing dedupe-collided task as if new. This issue is the missing existence/state verification of the attach target itself; neither fix substitutes for the other.

Acceptance criteria

  • Before enqueueing, the attach path verifies via the GitHub App (or the gh fallback) that issue_number in repo exists, is an issue (not a pull request), and is open; a failed check returns a 4xx naming the problem and enqueues nothing.
  • For repos where the GitHub App is not installed (attach currently warn-skipped), the response makes the unverified state explicit rather than returning the same issue_url shape as a verified attach.
  • Tests (stubbed GitHub client) cover: nonexistent number, PR number, closed issue, and the happy path of an open issue.

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
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    effort/sSmall: expected under 2 hours of work
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Oct 31, 2026
  2. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 31, 2026
  4. 16 remaining items

  5. added and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 31, 2026
  6. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  7. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Oct 31, 2026
  8. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  9. added a commit that references this issue on Oct 31, 2026
  10. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    Fixed and merged via PR #3149 (merge commit c92aa62).

    The attach path now verifies issue_number before enqueueing: the target must exist, be an issue (not a PR), and be open; invalid targets return 4xx and enqueue nothing; GitHub lookup failures are distinguishable (5xx/retryable); app-not-installed repos return an explicitly unverified attach state. The one Codex P2 (matching a bare 404 digit scan in gh error text) was fixed in 291030a and replied to on its thread; Codex's fresh round on 291030a completed with no findings. Targeted tests on the laptop at the merged head: bun test in pm-stack/dispatch — 68 pass / 0 fail (215 expect calls), including the new stubbed-GitHub attach tests (nonexistent, PR number, closed issue, open-issue happy path). No substantive GitHub Actions workflow triggers for this path (only the jules-daily workflows that fail on every push, including main — unrelated infra).

    Queue task 4532 completed as fixed_merged by lane C.

  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
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/sSmall: expected under 2 hours 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 jobtask/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