Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .github/workflows/fullsend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
# Routes events to agent workflows via reusable-dispatch.yml.
# All agent execution happens in this repository's context.
#
# Security: pull_request_target runs the BASE branch version of this workflow,
# preventing PRs from modifying it to exfiltrate credentials.
# This shim never checks out PR code, so it is not vulnerable to "pwn request"
# attacks.
# Security: pull request events use pull_request, not pull_request_target
# (GitHub blocks pull_request_target by default in public repositories;
# ADR 0164). On pull_request this workflow runs from the PR's own
# copy and forwards the repository secrets, so the dispatch job runs only for
# same-repo PRs, whose authors already have write access. Fork PRs are skipped
# here and again in reusable-dispatch.yml (a fork cannot edit the upstream
# copy; a vendored copy runs from the PR); a maintainer comments /fs-review
# to review one. In private repositories keep "Send secrets to workflows
# from pull requests" and "Send write tokens to workflows from pull
# requests" (Settings > Actions > General) turned off.
# reusable-dispatch.yml checks out the base side for pull request events.
#
# Routing: this shim forwards the raw event context to reusable-dispatch.yml,
# which determines the stage and runs the agent inline (ADR 62).
Expand All @@ -23,7 +30,7 @@ on:
types: [opened, edited, labeled]
issue_comment:
types: [created]
pull_request_target:
pull_request:
types: [opened, synchronize, ready_for_review, closed, labeled, unlabeled]
pull_request_review:
types: [submitted]
Expand All @@ -33,8 +40,10 @@ permissions: {}
jobs:
dispatch:
if: >-
(github.event_name != 'pull_request_target' && github.event_name != 'pull_request_review'
(github.event_name != 'pull_request' && github.event_name != 'pull_request_review'
|| github.event.pull_request.head.ref != 'fullsend/scaffold-install')
&& (github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.id == github.repository_id)
&& (github.event_name != 'issue_comment'
|| startsWith(github.event.comment.body, '/fs-'))
permissions:
Expand Down
166 changes: 114 additions & 52 deletions .github/workflows/reusable-dispatch.yml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .github/workflows/reusable-prioritize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
# checkout@v7 blocks fork PR checkouts on pull_request_target by default.
# Safe here: only .fullsend/ config is read, no fork code is executed,
# and credentials are not persisted.
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.sha }}
ref: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request') && github.event.pull_request.base.sha || github.sha }}
persist-credentials: false
allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' }}

Expand All @@ -116,7 +116,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
ref: ${{ (github.event_name == 'pull_request' && job.workflow_sha == github.sha && github.event.pull_request.base.sha || job.workflow_sha) }}
path: .defaults
fetch-depth: 1
sparse-checkout: |
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
jira-client-id: ${{ fromJSON(inputs.event_payload)._normalized_event.source.system == 'jira' && secrets.FULLSEND_JIRA_CLIENT_ID || '' }}
jira-client-secret: ${{ fromJSON(inputs.event_payload)._normalized_event.source.system == 'jira' && secrets.FULLSEND_JIRA_CLIENT_SECRET || '' }}
runner_secrets: ${{ secrets.FULLSEND_GITHUB_RUNNER_SECRETS }}
version: ${{ inputs.fullsend_version || job.workflow_sha }}
version: ${{ inputs.fullsend_version || (github.event_name == 'pull_request' && job.workflow_sha == github.sha && github.event.pull_request.base.sha || job.workflow_sha) }}
fullsend-dir: .fullsend
mint-url: ${{ inputs.mint_url }}
gcp_wif_provider: ${{ secrets.FULLSEND_GCP_WIF_PROVIDER }}
Expand Down
11 changes: 6 additions & 5 deletions docs/agents/retro.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ Performs retrospectives on agent workflows — analyzes what happened, identifie
## How the agent works

The retro agent is triggered after a workflow completes when the event actor
has write access and closes or merges its PR. Users with write access can also
start it
with `/fs-retro`. It reconstructs the full workflow graph — [triage](triage.md),
has write access and closes or merges a same-repository PR. Users with write
access can also start it with `/fs-retro`. It reconstructs the full workflow graph — [triage](triage.md),
[code](code.md), [review](review.md), [fix](fix.md), and human interactions —
by fetching issue and PR timelines, agent run logs, and review threads.
GitLab merge requests use the same write-level requirement: the actor who
Expand Down Expand Up @@ -48,8 +47,10 @@ to focus on:
- `/fs-retro figure out why the review agent approved this and make sure it never happens again`
- `/fs-retro the code agent spent 30 minutes on a 2-line fix, what went wrong`

The retro agent also runs automatically when a PR is closed (merged or not) by
an actor with write access. Merge-queue events follow the same rule: the event
The retro agent also runs automatically when a same-repository PR is closed
(merged or not) by an actor with write access. Fork PRs get no automatic
retro; a user with write access can run `/fs-retro` on a closed or merged fork PR.
Merge-queue events follow the same rule: the event
sender must have write access. Other automated senders without repository
write access do not start retro; a write-authorized user can run `/fs-retro`
afterward. On GitLab, merged or closed MRs also start retro only when the actor
Expand Down
5 changes: 3 additions & 2 deletions docs/agents/review.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ Requires triage-level repository permission or higher (triage, write,
maintain, or admin). Mutation stages such as `/fs-fix` still require
write or higher.

The `/fs-review` command does not accept arguments and always forces a review. The review agent also runs automatically when a PR is opened,
The `/fs-review` command does not accept arguments and always forces a review. The review agent also runs automatically on a same-repository PR when it is opened,
when its effective diff changes on a synchronize event, or when it is moved out of draft by a user with triage-level repository permission or higher.
For GitHub `pull_request_target` synchronize events, the review is skipped when the complete effective diff matches the previous app-verified approved review. The guard posts or updates one PR-visible `fullsend:review-skip` status comment linking the previous approved review. GitLab diff metadata uses the same normalized model, but the GitLab poller does not consume this marker yet and continues to review synchronized merge requests.
Fork and Dependabot PRs are not reviewed automatically; someone with triage access or higher (or an OWNERS approver or reviewer) can comment `/fs-review` on them.
For GitHub `pull_request` synchronize events (and `pull_request_target` from shims that have not been upgraded), the review is skipped when the complete effective diff matches the previous app-verified approved review. The guard posts or updates one PR-visible `fullsend:review-skip` status comment linking the previous approved review. GitLab diff metadata uses the same normalized model, but the GitLab poller does not consume this marker yet and continues to review synchronized merge requests.
The deduplication check runs before final Bash/CEL stage selection, so CEL-selected review routes participate as well. File modes are part of the compared effective diff identity, so executable-bit changes cannot be hidden by an otherwise identical textual patch.
The guard fails open and runs the review when there is no prior diff hash, the prior review cannot be verified, a required hash/head or base/head tree-mode API call fails,
the file listing is incomplete or truncated, or any file has no representable patch (for example, a binary or rename-only change).
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sole supported installation model
- Event-source routing for status notifications: the notification destination for run-status comments and reactions is dynamically determined by event provenance — a Jira-triggered run posts status to Jira, a GitHub-triggered run posts to GitHub — rather than being hardwired to the code-output forge. Status notifications route through `tracker.Client`; reactions are an optional `tracker.Reactor` capability (Jira Cloud supports comment reactions but not issue reactions, so `Reactor` is not implemented for Jira currently) ([ADR 0093](ADRs/0093-tracker-routed-status-notifications.md)).
- Installation model: the CLI installs per repository only (`fullsend github setup <owner/repo>`, `fullsend admin install <owner/repo>` (deprecated), `fullsend repos install`); per-org CLI installation was removed ([ADR 0044](ADRs/0044-deprecate-per-org-installation-mode.md)). The concrete layers of the ordered layer stack (vendor-binary, secrets, inference, and the per-org workflows layer) were removed along with per-org mode; `internal/layers` keeps only the `Layer` interface and shared helpers, and the CLI no longer orchestrates a layer stack ([ADR 0006](ADRs/0006-ordered-layer-model.md)).
- Dispatch: each repository's `.github/workflows/fullsend.yaml` shim calls the upstream `reusable-dispatch.yml` via `workflow_call`; that workflow mints OIDC tokens exchanged at a central token mint (GCP Cloud Function or Cloudflare Worker) for scoped GitHub App installation tokens per agent role. App PEM secrets are stored in Secret Manager (GCF mint), Worker secrets (CF mint), or the local filesystem (standalone mint), not the config repo ([ADR 0008](ADRs/0008-workflow-dispatch-for-cross-repo-dispatch.md)).
- Shim workflow security (target state): the shim's PR events run on `pull_request`, only for same-repo PRs (head repository id equals the base repository id); fork PRs are reviewed when someone authorized for `/fs-review` (triage access or higher, or an OWNERS approver or reviewer) comments it. Same-repo authors already have write access and are trusted with the secrets the PR-branch shim receives; fork runs get no secrets; the dispatch workflow takes the base side for every checkout and runs no PR code. The mint accepts only OIDC tokens whose `job_workflow_ref` names an allowed workflow host repository ([ADR 0164](ADRs/0164-run-the-shim-on-pull-request-for-same-repo-prs.md), superseding the `pull_request_target` shim of [ADR 0009](ADRs/0009-pull-request-target-in-shim-workflows.md)).
- Shim workflow security: the shim's PR events run on `pull_request`, so the shim runs from the PR's own copy and forwards the repository's secrets. Its dispatch job therefore runs only for same-repo PRs (head repository id equals the base repository id), whose authors already have write access; fork and Dependabot PRs get no automatic run and are reviewed when someone authorized for `/fs-review` (triage access or higher, or an OWNERS approver or reviewer) comments it. `reusable-dispatch.yml` refuses those PRs again (a fork cannot edit the upstream copy; a vendored copy runs from the PR, so vendored installs rely on GitHub not sending secrets to fork PR runs), takes the base side for every checkout (base SHA, or the default branch where a checkout used the event default), runs no PR code, and still accepts `pull_request_target` from shims that have not upgraded, with a warning. The mint accepts only OIDC tokens whose `job_workflow_ref` names an allowed workflow host repository ([ADR 0164](ADRs/0164-run-the-shim-on-pull-request-for-same-repo-prs.md), superseding the `pull_request_target` shim of [ADR 0009](ADRs/0009-pull-request-target-in-shim-workflows.md)).
- Installer scaffold: per-repo installs deploy content from an embedded scaffold (`internal/scaffold/`), keeping deployable files as real files under version control rather than Go string constants. The per-org dispatch, repo-maintenance, and enrollment-reconciliation scaffolds were removed with the rest of per-org mode ([ADR 0044](ADRs/0044-deprecate-per-org-installation-mode.md)).
- Reusable workflows: each repository's `fullsend.yaml` shim calls the upstream `reusable-dispatch.yml` (`fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml`), which runs every agent stage as an inline job; the only standalone stage workflow is `reusable-prioritize.yml`, called by the explicit prioritize thin caller. The per-org thin stage callers and `reusable-{code,fix,review,retro,triage}.yml` were removed with per-org mode (the per-org architecture described in the linked ADRs is historical and deprecated). Infrastructure patches ship once upstream and propagate to all repositories without re-install ([ADR 0031](ADRs/0031-reusable-workflows-for-action-installed-distribution.md)). **Vendoring** (`vendor: true` in `repos.yaml` for `repos install`, `--vendor` for `github setup`; [ADR 0047](ADRs/0047-vendored-installs-with-vendor-flag.md)) commits workflows and agent content at install time; layered installs (default) fetch upstream at runtime.
- Event-driven stage dispatch: eliminate `workflow_dispatch` + `gh workflow run` fan-out from the (now removed per-org) `dispatch.yml` in favor of synchronous `workflow_call` so the dispatched run stays linked to the caller ([ADR 0041](ADRs/0041-synchronous-workflow-call-event-dispatch.md)).
Expand Down Expand Up @@ -900,7 +900,7 @@ ADR 0002: [Building block 7](ADRs/0002-initial-fullsend-design.md#7-test-artifac

### 8. code agent runtime

Implements changes, runs local/CI-equivalent tests, handles check failures, and opens or updates a PR. Review dispatch is triggered automatically by `pull_request_target` events today; the decided target state is same-repo `pull_request` events ([ADR 0164](ADRs/0164-run-the-shim-on-pull-request-for-same-repo-prs.md)).
Implements changes, runs local/CI-equivalent tests, handles check failures, and opens or updates a PR. Review dispatch is triggered automatically by `pull_request` events on same-repo PRs ([ADR 0164](ADRs/0164-run-the-shim-on-pull-request-for-same-repo-prs.md)).
ADR 0002: [Building block 8](ADRs/0002-initial-fullsend-design.md#8-implementation-agent-runtime).

### 9. PR sandbox / CI mirror
Expand Down Expand Up @@ -943,7 +943,7 @@ ADR 0002: [Building block 13](ADRs/0002-initial-fullsend-design.md#13-observabil

Retrospective analyst — examines completed or in-progress agent workflows,
identifies improvement opportunities, and files proposals as GitHub issues.
Runs automatically on PR close (merged or rejected) when the event actor has
Runs automatically on same-repo PR close (merged or rejected) when the event actor has
write access, including for merge-queue events. GitLab MR close and merge use
the same threshold, expressed as Developer access. Users with write access can
also start it with `/fs-retro`; a custom retro harness role cannot lower this
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/ci-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Jobs triggered by `pull_request_target` that check out and execute PR-head code

When all five components are present, any code the PR author controls can read and exfiltrate every secret in that step's environment.

**ADR-0009 and the shim distinction:** ADR-0009 documents why `pull_request_target` is safe for the shim workflow — the shim never checks out PR code, so components 2–3 are absent. This safety reasoning does **not** transfer to jobs that check out and execute PR-head code (e.g., the behaviour and playback jobs in `e2e.yml`).
**ADR-0009 and the shim distinction:** ADR-0009 documents why `pull_request_target` was safe for the shim workflow — the shim never checks out PR code, so components 2–3 are absent. The shim has since moved to `pull_request` for same-repo PRs ([ADR 0164](../ADRs/0164-run-the-shim-on-pull-request-for-same-repo-prs.md)); `reusable-dispatch.yml` still accepts `pull_request_target` from shims that have not upgraded. This safety reasoning does **not** transfer to jobs that check out and execute PR-head code (e.g., the behaviour and playback jobs in `e2e.yml`).

### Credential blast radius

Expand Down
Loading
Loading