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
2 changes: 1 addition & 1 deletion docs/agents/prioritize.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Scores a GitHub issue using the RICE framework (Reach, Impact, Confidence, Effor

Triggered on a schedule (the prioritize scheduler polls the project board for unscored issues) or on-demand via `/fs-prioritize`.

The prioritize agent fetches the issue and all its context, then evaluates it across the four RICE dimensions. It can invoke customer-research skills to gather additional signal about reach and impact. The output is a structured JSON result with per-dimension scores and written reasoning. The post-script always publishes the RICE reasoning comment; when a project number is supplied, it also updates the project board.
The prioritize agent fetches the issue and all its context, then evaluates it across the four RICE dimensions. It can invoke customer-research skills to gather additional signal about reach and impact. The output is a structured JSON result with per-dimension scores and written reasoning. The post-script always publishes the RICE reasoning comment; when a project number is supplied, it also updates the project board. Every run posts a new reasoning comment. On GitHub, the bot's own earlier reasoning comments on the issue are then minimized as outdated: they collapse, and a reader can still expand them.

## How it helps

Expand Down
7 changes: 5 additions & 2 deletions docs/agents/review.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ The review agent is triggered when a PR is opened or updated, subject to the syn
1. **Pre-script** validates inputs and fetches PR metadata.
2. **Sandbox** — the agent runs the `pr-review` orchestrator skill. The orchestrator triages the change, then dispatches specialized sub-agents in parallel — each covering a distinct review dimension (correctness, security, intent & coherence, style & conventions, docs currency, and optionally cross-repo contracts). Sub-agents run concurrently and return structured findings. The orchestrator collects, deduplicates, and synthesizes findings across dimensions, runs PR-level checks (scope authorization, protected paths), and produces a structured JSON review result. The agent cannot push files, edit code, or push — it is strictly read-only.
3. **Validation loop** — the output is checked against a schema, with up to 2 retry iterations if the output is malformed.
4. **Post-script** posts the review on the PR. Findings that include a file path and a line in the change diff are also posted as inline comments on that line (GitHub review comments; GitLab merge-request discussions). Findings that cannot be positioned — file-level notes, lines outside the diff, or a GitLab diff version whose `head_sha` no longer matches the reviewed commit — stay in the review comment, and on GitLab as general MR notes. Every run posts a new review comment at the end of the thread. Once the review comment is posted, a failure to submit the forge's native review (GitHub PR review or GitLab approval) is logged as a warning and does not fail the run — the review comment is the authoritative record of the verdict.
4. **Post-script** posts the review on the PR.
- **Inline findings.** Findings that include a file path and a line in the change diff are also posted as inline comments on that line (GitHub review comments; GitLab merge-request discussions). Findings that cannot be positioned — file-level notes, lines outside the diff, or a GitLab diff version whose `head_sha` no longer matches the reviewed commit — stay in the review comment, and on GitLab as general MR notes.
- **Re-runs.** Every run posts a new review comment at the end of the thread. On GitHub, the bot's own earlier review comments are then minimized as outdated: they collapse, and a reader can still expand them. A new risk-assessment comment does the same to the earlier risk-assessment comments. A request-changes review stays visible until a later review replaces it; stale-head and failure notices minimize nothing. Minimizing is best effort: if it fails, the run logs a warning and the earlier comments stay visible. GitLab cannot minimize comments, so earlier results stay visible there.
- **Native review.** Once the review comment is posted, a failure to submit the forge's native review (GitHub PR review or GitLab approval) is logged as a warning and does not fail the run — the review comment is the authoritative record of the verdict.

If a prior review exists (e.g., re-review after fixes), it is injected into the sandbox so the agent can assess whether previous findings were addressed.

Expand All @@ -38,7 +41,7 @@ write or higher.
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.
On GitHub, a fork PR is reviewed automatically under the same rules (a bot author is checked like any other author), through the managed `fullsend-fork-pr.yaml` workflow (see [Fork pull requests](../guides/getting-started/repo-management.md#fork-pull-requests)); the `ready-for-review` label does not start a fork PR review. Dependabot PRs are not reviewed automatically. On either, someone with triage access or higher (or an OWNERS approver or reviewer) can comment `/fs-review`.
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 a new PR-visible `fullsend:review-skip` status comment for each skip, linking the previous approved review, and never edits an earlier skip note in place on that publish path; a later full review supersedes each skip note once, in place, naming the commit that superseded it. 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.
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. For each skip, the guard posts a new PR-visible `fullsend:review-skip` status comment that links the previous approved review, and minimizes the bot's earlier skip notes as outdated. A later full review edits each skip note once, in place, to name the commit that superseded it. 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
2 changes: 1 addition & 1 deletion docs/agents/triage.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Inspects a GitHub issue, assesses information sufficiency, asks clarifying quest

The triage agent is triggered when a new issue is opened or when an existing issue is updated. On GitLab, opening an issue also dispatches triage when the issue author has Developer access or higher (see [Commands](#commands)). The webhook fast path starts this dispatch, and events-mode cron polling backstops it when a webhook delivery is missed. It fetches the issue content — title, body, labels, comments — and reads repository context (architecture docs, existing issues, PRs) to understand the landscape. It then decides whether the issue has enough information to act on, or whether clarification is needed.

The agent runs in a read-only sandbox. It cannot modify issues, push code, or interact with external services. Its only output is a structured JSON triage result consumed by the post-script, which applies labels and posts a summary comment.
The agent runs in a read-only sandbox. It cannot modify issues, push code, or interact with external services. Its only output is a structured JSON triage result consumed by the post-script, which applies labels and posts a summary comment. Every run posts a new comment at the end of the thread. On GitHub, the bot's own earlier triage results on the issue are then minimized as outdated: they collapse, and a reader can still expand them. Minimizing is best effort; if it fails, the earlier results stay visible. GitLab and Jira cannot minimize comments, so earlier results stay visible there.

## How it helps

Expand Down
5 changes: 4 additions & 1 deletion docs/guides/dev/behaviour-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ Each stub error is a `*drivers.NotImplementedError` (package `pkg/behaviourtest/
1. Implement `scm.Driver` in `pkg/behaviourtest/drivers/scm/<vendor>/`.
Also implement the optional `scm.PullRequestHeadSHAReader` interface
(`GetPullRequestHeadSHA`). Dummy-agent fixtures that use the
`<pr_head_sha>` placeholder need it.
`<pr_head_sha>` placeholder need it. If your forge can minimize
comments, also implement `scm.CommentMinimizedReader`
(`ListCommentMinimizedStates`). The minimized-comment assertion steps
require it.
2. Register the driver in `behaviourtest.RunSuite` when `BEHAVIOUR_SCM=<vendor>`.
3. Document the env var value here.
4. Add `@skip:<vendor>` tags on scenarios that cannot run until the driver is complete.
Expand Down
2 changes: 2 additions & 0 deletions docs/guides/dev/behaviour-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ once `the pull request head branch matches` has found it.
| `the last comment on the issue contains "<text>"` | The last (newest) comment on the issue contains the text |
| `the last comment on the issue containing "<marker>" contains "<text>"` | The newest comment on the issue carrying the marker (an agent's result marker) contains the text |
| `a comment on the issue other than the last contains "<text>"` | Some comment before the last on the issue contains the text |
| `the pull request has <n> visible comments containing "<text>"` | Exactly <n> comments on the pull request contain the text and are not minimized (issue form: `the issue has <n> visible comments containing "<text>"`). Requires an SCM driver that implements the optional `scm.CommentMinimizedReader`. The GitHub driver does. |
| `every comment on the pull request containing "<text>" other than the last is minimized` | At least two comments on the pull request contain the text, all of them except the newest are minimized, and the newest is not. This is what an agent re-run leaves behind (issue form: `every comment on the issue containing ...`). Requires `scm.CommentMinimizedReader`. |
| `the pull request body contains "<text>"` | The PR body contains the text. `<issue>` expands, so `"Closes #<issue>"` checks the closing reference |
| `an issue with label "<label>" and title containing "<text>" exists` | An open issue other than the scenario's own carries the label and has a matching title, such as an issue an agent filed. `<issue>` expands; use it in the title so a leftover from an earlier run cannot match. The matched issue is closed at cleanup |

Expand Down
43 changes: 43 additions & 0 deletions e2e/behaviour/features/review/review-re-run-minimize.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Every agent run appends its result as a new comment (#9334). On a re-run,
# the bot's earlier results are minimized as outdated (#9957): post-review
# minimizes the earlier review comments, and post-comment the earlier
# risk-assessment comments. This scenario reviews the same pull request
# twice and asserts that the review and the risk assessment each have one
# visible comment, and that the first run's comments are minimized.
#
# An on-demand review trigger (as in review-cel-route.feature) keeps the
# pull-request-opened event from starting a review before the dummy agent
# is set: its result names the pull request's head SHA (<pr_head_sha>),
# so it can only be written once the pull request exists, and a result
# naming any other commit is discarded as stale-head.
# @skip:gitlab because GitLab cannot minimize a comment: there, earlier
# results stay visible.
@skip:gitlab
Feature: Re-running review folds the earlier results as outdated

Scenario: A second review run minimizes the first review and risk-assessment comments
Given the enrolled test repository
And the repository agents are configured with:
"""
review:
trigger: >
event.transition.kind == "comment_added"
&& has(event.entity.linked_change_proposal)
&& has(event.transition.comment.command)
&& event.transition.comment.command == "/fs-review"
&& event.actor.kind == "human"
"""
When the write actor opens a pull request
And a dummy agent that would:
| description | op | args |
| Emit review JSON | write_fixture | output/agent-result.json, fixtures/review/comment-with-risk.json |
And the write actor posts "/fs-review" on the pull request
Then the harness "review" workflow completes successfully
And the pull request has 1 visible comment containing "<!-- fullsend:review-agent -->"
And the pull request has 1 visible comment containing "<!-- fullsend:risk-assessment -->"
When the write actor posts "/fs-review" on the pull request
Then the harness "review" workflow completes successfully
And every comment on the pull request containing "<!-- fullsend:review-agent -->" other than the last is minimized
And every comment on the pull request containing "<!-- fullsend:risk-assessment -->" other than the last is minimized
And the pull request has 1 visible comment containing "<!-- fullsend:review-agent -->"
And the pull request has 1 visible comment containing "<!-- fullsend:risk-assessment -->"
12 changes: 12 additions & 0 deletions e2e/behaviour/fixtures/review/comment-with-risk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"action": "comment",
"pr_number": 1,
"repo": "owner/repo",
"head_sha": "<pr_head_sha>",
"body": "Behaviour smoke: the review result for this run.",
"risk_assessment": {
"score": 1,
"level": "low",
"rationale": "Behaviour smoke: a one-line text change."
}
}
2 changes: 1 addition & 1 deletion e2e/behaviour/github-emulator/shards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ e 2 4 features/dispatch/fork-bash-routing.feature:16 features/dispatch/dispatch.
f 2 4 features/dispatch/owners-auth.feature:43 features/dispatch/base-dispatch.feature:7 features/dispatch/reaction-notifications.feature:10 features/dispatch/runner-secret-overlay-guard.feature:54
g 2 4 features/platform/bot-actor-authorization.feature:163 features/dispatch/fork-dispatch.feature:134 features/dispatch/url-dispatch.feature:64 features/dispatch/runner-secret-overlay-guard.feature:23
h 2 4 features/code/branch-namespace.feature:31 features/triage/triage.feature:6 features/triage/triage-re-run-append.feature:14 features/runtime/agent-settings.feature:13 features/dispatch/owners-auth.feature:55
i 2 4 features/dispatch/triage-prioritize-cel-route.feature:13 features/platform/actor-authorization.feature:55 features/platform/mint-status.feature:32
i 2 4 features/dispatch/triage-prioritize-cel-route.feature:13 features/platform/actor-authorization.feature:55 features/platform/mint-status.feature:32 features/review/review-re-run-minimize.feature:18
j 2 4 features/dispatch/retro-cel-route.feature:13 features/dispatch/dispatch.feature:31 features/dispatch/triage-prioritize-cel-route.feature:36 features/dispatch/retro-cel-route.feature:57 features/dispatch/jira-transport-bounds.feature:48
k 2 4 features/dispatch/fork-dispatch.feature:17 features/dispatch/dispatch.feature:6 features/dispatch/url-dispatch.feature:7 features/dispatch/retro-cel-route.feature:38 features/dispatch/jira-transport-bounds.feature:34 features/dispatch/jira-poll-dispatch.feature:40
l 2 4 features/platform/bot-actor-authorization.feature:115 features/dispatch/fork-dispatch.feature:94 features/dispatch/owners-auth.feature:73 features/dispatch/jira-poll-dispatch.feature:31 features/dispatch/jira-poll-dispatch.feature:24
Expand Down
25 changes: 23 additions & 2 deletions internal/cli/postcomment.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ import (
"github.com/fullsend-ai/fullsend/internal/ui"
)

// supersedingResultMarkers are the agent result markers whose newest
// comment replaces the earlier ones on the thread. When a comment with one
// of them is posted, the poster's earlier comments with the same marker are
// minimized as outdated (#9957). The review result and review-skip note
// are posted by post-review and review-dedup; triage, prioritize and the
// risk assessment are posted through post-comment by the agents' post
// scripts. Other markers (notices, custom agents) are left visible.
var supersedingResultMarkers = map[string]bool{
reviewMarker: true,
reviewSkipMarker: true,
"<!-- fullsend:risk-assessment -->": true,
"<!-- fullsend:triage-agent -->": true,
"<!-- fullsend:prioritize-agent -->": true,
}

func newPostCommentCmd() *cobra.Command {
var (
repo string
Expand Down Expand Up @@ -39,6 +54,11 @@ the thread itself is the history.
The --marker flag identifies this agent's comments. Each agent should
use a unique marker (e.g. "<!-- fullsend:triage-agent -->").

For the triage, prioritize and risk-assessment result markers, the
poster's earlier comments with the same marker are minimized as
outdated once the new comment is posted, so only the newest result
stays expanded.

The --result flag accepts a file path or "-" for stdin.`,
RunE: func(cmd *cobra.Command, args []string) error {
printer := ui.New(os.Stdout)
Expand Down Expand Up @@ -69,8 +89,9 @@ The --result flag accepts a file path or "-" for stdin.`,
printer.Header("Post Comment")

cfg := sticky.Config{
Marker: marker,
DryRun: dryRun,
Marker: marker,
DryRun: dryRun,
MinimizeSuperseded: supersedingResultMarkers[marker],
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
}
_, err = sticky.Post(cmd.Context(), client, owner, repoName, number, body, cfg, printer)
return err
Expand Down
Loading
Loading