Skip to content

feat(code): auto-assign PRs created by code agent to triggering human #1880

Description

@ifireball

What happens

When the code agent opens a pull request, the PR author is the fullsend-ai-coder GitHub App. GitHub does not allow assigning that app user on PRs in our repos (replaceActorsForAssignable fails for app/fullsend-ai-coder and fullsend-ai-coder[bot]).

The PR therefore stays unassigned unless someone assigns it manually. In practice, many agent PRs sit in the backlog with no assignee, which makes ownership unclear for review and triage.

This is separate from #1838, which proposes assigning the issue to the coding agent. This issue is about assigning the PR to a human using the same ownership signals we use when triaging manually.

What should happen

After post-code.sh creates or updates a PR for issue #N, the post-script should assign the PR to a human GitHub user using this precedence (first match wins):

  1. Person who invoked /fs-code on the issue (when the run was triggered by that slash command)
  2. Issue assignee (first human assignee, if any)
  3. Issue reporter (human issue author)

Rules:

  • Never assign bots or GitHub Apps (app/*, *[bot], dependabot, etc.).
  • If no human matches the precedence chain, leave the PR unassigned (do not guess from unrelated PRs or retro context).
  • When updating an existing PR branch (PR already exists), apply the same assignment logic if the PR has no assignees yet.
  • Assignment must be best-effort: log and continue if gh pr edit --add-assignee fails (e.g. user lacks permission), without failing the workflow.

Context

Manual triage on fullsend-ai/fullsend (2026-06-04) used this precedence on ~30 unassigned PRs. Human-authored PRs map cleanly to their authors; bot-authored PRs need the chain above. Examples that worked well:

Cases that should remain unassigned under this policy: retro-only issues with no human author, assignee, or /fs-code invoker (e.g. issues filed by app/fullsend-ai-retro with no human comment).

Implementation notes (for implementers)

This should be implementable deterministically in post-code.sh (no LLM), immediately after gh pr create / when reusing an existing PR:

  • post-code.sh already has ISSUE_NUMBER, REPO_FULL_NAME, PUSH_TOKEN, and gh access.
  • Issue assignee and author are available via gh issue view "${ISSUE_NUMBER}" --json assignees,author.
  • /fs-fix already plumbs TRIGGER_SOURCE from dispatch through reusable-fix.yml into its post-script; /fs-code does not set TRIGGER_SOURCE today even though dispatch has COMMENT_USER_LOGIN for issue_comment events. Consider mirroring the fix-agent plumbing (dispatch.ymlreusable-dispatch.ymlreusable-code.ymlharness/code.yaml runner_env) so label-triggered runs fall through to assignee/reporter only.
  • For ready-to-code label triggers, precedence steps 2–3 apply; step 1 is N/A unless TRIGGER_SOURCE is also set for authorized label appliers in a follow-up.

Relevant files:

  • internal/scaffold/fullsend-repo/scripts/post-code.sh (PR create path ~section 8)
  • internal/scaffold/fullsend-repo/harness/code.yaml (runner_env)
  • internal/scaffold/fullsend-repo/.github/workflows/dispatch.yml (/fs-code routing)
  • .github/workflows/reusable-code.yml and reusable-dispatch.yml

Add shell tests in post-code-test.sh for the resolver (bot filtering, precedence, no-op when all candidates are bots).

Metadata

Metadata

Assignees

Labels

agent/codeCode agentcomponent/dispatchWorkflow dispatch and triggerscomponent/harnessAgent harness, config, and skills loadingfeatureFeature-category issue awaiting human prioritizationpriority/mediumNormal priority, plan for next cycletriagedTriaged but awaiting human prioritizationtype/featureNew capability request

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions