Skip to content

dispatch: accept pull_request wherever pull_request_target is accepted (Go part of #9221) #9224

Closed

Description

@waynesun09

Part of #9221. The approach is in #9221 (comment): the per-repo shim moves from pull_request_target to pull_request (same-repo PRs only, as github/gh-aw does), and fork PRs are reviewed through /fs-review.

This issue covers only the Go code, its tests and the docs that describe it. A maintainer adds the workflow and shim-template changes to the same PR during takeover, so do not try to edit them.

Rules for this run

  • Do not sign off commits. No git commit -s, no Signed-off-by trailer.
  • Do not edit anything under .github/workflows/ or internal/scaffold/fullsend-repo/templates/.
  • Do not edit internal/scaffold/cel_route_test.go or internal/scaffold/workflow_call_alignment_test.go: they test the workflow files, which change in the takeover.
  • Backward compatible: every pull_request_target behaviour and test stays as it is. Repos that have not upgraded their shim keep sending pull_request_target. You add pull_request next to it; you never replace it.

Code changes

  1. internal/harnessdispatch/auth.go, IsLifecycleCloseAuthorized: accept event.Source.RawType pull_request as well as pull_request_target. Everything else in the check stays (GitHub system, change proposal, closed or merged, harness role retro). Update the doc comment to name both events.
  2. internal/harnessdispatch/input/ghaevent.go already maps both event names through mapPREvent. No logic change, but make sure raw_type stays the exact event name (pull_request stays pull_request, not normalized).
  3. Comment-only updates that name the event: internal/poll/events.go (the [bot] exception comment near filterBotEvents) and internal/cli/run.go (the PR-shaped env var fallback comment). Say pull_request / pull_request_target.
  4. Search internal/ and cmd/ for any other non-test check of the literal "pull_request_target" and treat "pull_request" the same way there. Report in the PR body what you found (or that there was nothing else).

Tests (add pull_request rows next to the existing pull_request_target rows)

  • internal/harnessdispatch/auth_test.go: lifecycle-close is authorized for a pull_request close and merge with role retro, not for other roles, and not for pull_request opened.
  • internal/harnessdispatch/input/ghaevent_test.go: a pull_request payload maps to the same normalized event as the same pull_request_target payload, except source.raw_type. A table over both event names is fine.
  • internal/cli/review_route_parity_test.go: duplicate the pull_request_target rows for pull_request with the same bash and cel expectations. The bash router in reusable-dispatch.yml will route pull_request exactly like pull_request_target after the takeover adds it.
  • internal/cli/retro_route_test.go and internal/cli/dispatch_route_test.go: retro on a pull_request close or merge routes and is authorized like pull_request_target (writer, triager, read author, App bot).
  • internal/cli/dispatch_botrole_test.go: a bot-authored pull_request opened event behaves like the pull_request_target one.
  • Keep patch coverage at or above the 80% target.

Docs

  • docs/normative/authorization/v1/README.md, section "Lifecycle close" (the pull_request_target.closed exception): the exception covers a pull_request or pull_request_target close. Keep the anchor #lifecycle-close-pull_request_targetclosed working, because docs/guides/user/cel-triggers-reference.md and the same README link to it; if you rename the heading, update both links.
  • docs/normative/authorization/v2/README.md (line about pull_request_target.closed to retro): name both events.
  • docs/normative/normalized-event/v1/README.md (the event_type / pull_request_target paragraph): raw_type is the GitHub Actions event name, pull_request_target or pull_request, never normalized. Leave the example JSON files as they are.
  • Do not edit ADRs, docs/architecture.md or the user guides that describe the shim trigger; the takeover updates them with the workflow change.

Done when

  • make lint and go test ./... pass.
  • All existing pull_request_target tests are unchanged and pass.
  • The PR title uses a fix(dispatch): or feat(dispatch): prefix per COMMITS.md, with no !: nothing breaks for existing callers.

Activity

  1. waynesun09 commented on Nov 9, 2026

    @waynesun09
    MemberAuthor

    /fs-code
    Do not sign off commits. No git commit -s, no Signed-off-by trailer.

  2. fullsend-ai-triage commented on Nov 9, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 8:22 PM UTC · Completed 8:24 PM UTC

    Commit: 96e0c43 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.17

  3. fullsend-ai-coder commented on Nov 9, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Code · ⚠️ Cancelled · Started 8:22 PM UTC · Ended 8:25 PM UTC

    Commit: 96e0c43 · View workflow run →

  4. added
    ready-to-code
    on Nov 9, 2026
  5. fullsend-ai-triage commented on Nov 9, 2026

    @fullsend-ai-triage

    This issue is detailed enough to implement without further input. Notes from triage:

    • Confirmed the lifecycle-close check in internal/harnessdispatch/auth.go is the only non-test literal check of pull_request_target found in internal/ and cmd/; ghaevent.go already maps both event names. The implementer should still report the search result in the PR body as requested.
    • All files named in the issue (code, tests, normative docs) exist in the repository.
    • No open PR currently addresses this issue, and it has no sub-issues. It is part of the umbrella issue for the pull_request_target default block.
    • Workflow and shim-template edits are intentionally out of scope for this issue; a maintainer adds them during takeover, so the code agent should not touch them.

    Proposed test case:

    For each event name in [pull_request, pull_request_target]:
      - close and merge with role retro -> lifecycle close authorized
      - close with any other role -> not authorized
      - opened -> not authorized
    Mapping the same PR payload under either event name yields identical normalized events except source.raw_type (exact event name, not normalized).
    Route parity / retro / bot-role tests: pull_request rows mirror the pull_request_target rows.
    

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  6. fullsend-ai-coder commented on Nov 9, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ⚠️ Cancelled · Started 8:22 PM UTC · Completed 8:24 PM UTC

    Commit: 96e0c43 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high

  7. fullsend-ai-coder commented on Nov 9, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 8:27 PM UTC · Completed 8:48 PM UTC

    Commit: 96e0c43 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $2.66

  8. added a commit that references this issue on Nov 9, 2026
    1592532
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

    bugready-to-code

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions