Skip to content

feat(#9957): fold superseded agent result comments as outdated - #10089

Merged
waynesun09 merged 5 commits into
mainfrom
agent/9957-minimize-superseded-comments
Dec 3, 2026
Merged

waynesun09 merged 5 commits into
mainfrom
agent/9957-minimize-superseded-comments

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Every agent run appends its result as a new comment (#9334), so a PR with several pushes collects review, risk-assessment and review-skip comments, and readers scroll past every earlier one. This PR applies the existing stale-formal-review handling to those comments too: when a run posts a result comment, the same author's earlier comments with the same marker are minimized as OUTDATED.

Related Issue

Addresses #9957 (blocker #9399 has merged).

Changes

  • internal/sticky: new Config.MinimizeSuperseded option and exported MinimizeSuperseded. After the new comment is created, it lists the thread and minimizes only earlier comments whose body starts with the marker and whose author is exactly the author of the comment just created (the posting identity). The newest comment, other authors' comments and any comment posted after this run's comment stay visible. If the author is unknown, nothing is minimized. This is best effort: a listing or minimize failure is logged and never fails the post.
  • post-review: folds earlier fullsend:review-agent comments once the new review comment is posted. The stale-head and failure notices use fullsend:review-notice and explicitly fold nothing, so a request-changes review stays visible until a later review replaces it.
  • post-comment (used by the agents' triage, prioritize and risk-assessment post-scripts on GitHub): folds for the fullsend:risk-assessment, fullsend:triage-agent and fullsend:prioritize-agent markers only. Other markers are unchanged.
  • review-dedup --publish: a new skip note folds the bot's earlier skip notes. Progress output goes to stderr so the key=value stdout stays parseable.
  • forge.Client.IsCommentMinimized: new method (GitHub via GraphQL Minimizable.isMinimized; GitLab and Forgejo return ErrNotSupported; FakeClient reads recorded minimizes). The behaviour suite needs it to check that a comment is minimized.
  • GitLab path: does nothing. GitLab has no minimize, so earlier comments stay visible. This is documented in the CLI help and the agent docs.
  • Behaviour scenario features/review/review-re-run-minimize.feature (shard i): reviews a PR twice and asserts one visible review comment and one visible risk-assessment comment after each run, with the first run's comments minimized. New steps: the <issue|pull request> has <n> visible comments containing "<text>" and every comment on the <issue|pull request> containing "<text>" other than the last is minimized. The scenario also uses a new scm.CommentMinimizedReader driver extension and a new fixture review/comment-with-risk.json.
  • Docs: docs/agents/review.md, triage.md and prioritize.md say older results are folded as outdated. The behaviour step table and the SCM driver guide are updated too.

Testing

  • Unit tests: internal/sticky (author/marker/prefix filtering, newest kept, later comments kept, dry run, unknown author, list failure, not-supported short-circuit, per-comment failure), internal/cli (post-review folds earlier reviews only; notices fold nothing; post-comment folds only the listed markers; review-dedup folds earlier skip notes and still publishes when listing fails), forge implementations, behaviour steps and feature wiring.
  • go vet ./... clean; go test -race on internal/sticky, internal/forge/..., internal/cli/..., pkg/behaviourtest/... pass, plus -tags behaviour for pkg/behaviourtest and internal/forge. Patch coverage on the new functions is 91–100%.
  • Hooks: pre-commit could not fetch remote hook repos in the sandbox (TLS), so the configured hooks were run directly: pre-commit-hooks v6.0.0 checks, gofmt, go vet, gitleaks, lychee, lint-docs-links, lint-interface-doc-sync, lint-broken-symlinks. All passed. semgrep did not run: it could not download its pinned ruleset, and with SEMGREP_REQUIRED=0 it analyzed nothing.
  • The new behaviour scenario was not run (it needs live GitHub pool repos). Its step wiring is checked by TestReviewReRunMinimizeFeature_StepsMatchPatterns, and TestShardsCoverEveryScenario passes.

Notes for reviewers

  • fullsend issues post-comment (tracker path) does not fold anything. tracker.Client has no minimize, and the GitHub agents post these markers through fullsend post-comment / post-review today. If agents move to issues post-comment --tracker github, a follow-up would need to add minimizing there.
  • Each post re-minimizes all earlier matching comments (one GraphQL call each), because the REST listing does not expose isMinimized. This is the same pattern minimizeStaleReviews uses for formal reviews.
  • Skip notes that a full review edits to "superseded" are not minimized by that edit. They are folded the next time a skip note is published.

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — not applicable: autonomous agent commit

🤖 Generated with Claude Code


Closes #9957

Post-script verification

  • Branch is not main/master (agent/9957-minimize-superseded-comments)
  • Secret scan passed (gitleaks — 9ea54c62a66f89fbcfcd9a36ac38332a97fd2bdd..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner December 3, 2026 17:48
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Dec 3, 2026
@waynesun09

Copy link
Copy Markdown
Member

/fs-fix-stop

@github-actions github-actions Bot added the fullsend-no-fix Skip bot-triggered fix agent runs label Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Fix agent disabled for this PR. Remove the fullsend-no-fix label or use /fs-fix to re-engage.

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 5:51 PM UTC · Ended 6:04 PM UTC

Commit: 00d987e · View workflow run →

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://55eb3ae4-site.fullsend-ai.workers.dev

Commit: 585fd7e00268c67e2282339ff30e3a578e6164fc

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Dec 3, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

While the change spans 31 files with active churn in core CLI and forge packages, risk is moderate due to bot authorship, zero protected or security-sensitive paths touched, strong test coverage, and complete alignment with the linked issue.

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [logic-error] internal/cli/postcomment.go:113 — Folding of superseded results is wired only into the deprecated fullsend post-comment command. The replacement, fullsend issues post-comment --tracker github (internal/cli/issues.go), builds its own sticky.Config and never sets MinimizeSuperseded, so a GitHub agent that migrates to it would keep earlier triage, prioritize and risk-assessment results expanded, and the new "older results are folded as outdated" sentences in docs/agents/triage.md and docs/agents/prioritize.md would then be wrong. The PR body states this scope limit and the reason (tracker.Client has no minimize), so this is advisory and not blocking.
    Remediation: In a follow-up, apply the same superseding-marker policy and same-author minimization to the GitHub tracker path of issues post-comment, and add a test that posts twice through runIssuesPostComment.

Labels: PR changes Go CLI/forge code, docs, and the behaviour test suite.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge go Pull requests that update go code component/docs User-facing documentation component/e2e End-to-end tests labels Dec 3, 2026
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.93496% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/forge/github/github.go 96.15% 1 Missing and 1 partial ⚠️
internal/sticky/sticky.go 93.10% 1 Missing and 1 partial ⚠️
internal/cli/reviewdedup.go 85.71% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ⚠️ Cancelled · Started 6:30 PM UTC · Completed 6:40 PM UTC

Commit: 101f7bc · View workflow run →

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

This review was superseded by a newer commit. Check the current pull request HEAD's review status before merging.

@fullsend-ai-review fullsend-ai-review Bot removed the ready-for-merge All reviewers approved — ready to merge label Dec 3, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:43 PM UTC · Completed 6:54 PM UTC

Commit: 28da83d · View workflow run →

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

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

While the change spans 31 files across core CLI and forge packages with elevated git history churn and coupling, risk remains moderate due to bot authorship, zero protected or security-sensitive paths touched, solid test coverage, and complete alignment with the linked issue.

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [logic-error] internal/cli/postcomment.go:113 — Superseded-result minimization is wired only into fullsend post-comment, post-review and review-dedup. fullsend issues post-comment --tracker github (internal/cli/issues.go) does not set MinimizeSuperseded, so results posted through that command would stay expanded. The PR description documents this as a deliberate limit, and no in-repo caller posts the built-in result markers through that path today, so this is advisory.
    Remediation: if agents move to issues post-comment --tracker github, add the same best-effort minimization there, gated by supersedingResultMarkers, and keep unsupported trackers as no-ops.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review December 3, 2026 18:53

Superseded by updated review

@fullsend-ai-review

Copy link
Copy Markdown

Finding threads left open (1):

  1. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated: the new review-re-run-minimize scenario passes on the github-emulator (shard i: 7 scenarios passed), unit tests pass, docs checked for facts and prose. LOW follow-up tracked in #10092.

@waynesun09
waynesun09 added this pull request to the merge queue Dec 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Dec 3, 2026
@waynesun09
waynesun09 added this pull request to the merge queue Dec 3, 2026
@waynesun09
waynesun09 removed this pull request from the merge queue due to a manual request Dec 3, 2026
fullsend-ai-coder Bot and others added 5 commits December 3, 2026 15:30
Every agent run now appends its result (#9334), so earlier results
stay fully visible and readers scroll past them. When a run posts a
result comment, minimize the same author's earlier comments carrying
the same marker as OUTDATED, the way post-review already minimizes
stale formal reviews.

- sticky: new Config.MinimizeSuperseded and MinimizeSuperseded. After
  the new comment is created, it lists the thread and minimizes the
  earlier comments whose body starts with the marker and whose author
  is exactly the new comment's author. The newest comment, other
  authors' comments and comments posted after it stay visible. It is
  best effort: failures are logged, never returned.
- post-review folds earlier review-agent comments. The stale-head and
  failure notices keep their own marker and fold nothing, so a
  request-changes review stays visible until a later review replaces
  it.
- post-comment folds for the risk-assessment, triage-agent and
  prioritize-agent markers; review-dedup folds earlier skip notes.
- forge.Client gains IsCommentMinimized (GitHub GraphQL; GitLab and
  Forgejo return ErrNotSupported) so a behaviour scenario can assert
  the fold. GitLab cannot minimize: earlier comments stay visible.
- New behaviour scenario re-runs review and asserts one visible
  review and risk-assessment comment and the earlier ones minimized.
- Review, triage and prioritize docs say older results are folded.

Note: pre-commit could not fetch hook repos (sandbox TLS), so hooks
were run directly; all passed except semgrep, which could not
download its pinned ruleset and analyzed nothing. The new behaviour
scenario was not run (needs live GitHub pool repos).

Closes #9957

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The behaviour step read each comment's minimized state through
node(id:) { ... on Minimizable }. The github-emulator rejects that
fragment and its node() lookup does not resolve IssueComment, so the
review re-run scenario failed on the emulator shard.

Replace IsCommentMinimized(nodeID) with
ListCommentMinimizedStates(owner, repo, number), which pages through
repository.issueOrPullRequest comments (first: 100, after: cursor, at
most 100 pages) and returns isMinimized keyed by comment node ID. The
REST node_id equals the GraphQL id, so the step looks each matching
comment up in the map, and a missing entry is an error. A null
issueOrPullRequest returns ErrNotFound; GitLab and Forgejo still return
ErrNotSupported. The step now reads the thread once instead of once
per comment.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
MinimizeSuperseded stopped at the comment whose ID equals the new one.
When the new comment's ID was 0, or a lagging listing did not include
it yet, the loop never stopped, so a newer same-marker comment from a
concurrent run could be folded.

Return early when the new comment's ID is unknown (0). Otherwise skip
every comment whose ID is at or above it, because GitHub comment IDs
increase. The fake client now gives a new comment an ID above every
existing comment, as GitHub does, so tests that seed comments still
see the new one as the newest.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
Use "minimized as outdated" throughout and say that a minimized
comment collapses but can still be expanded. Split review step 4 into
inline findings, re-runs and native review, and say that the earlier
risk-assessment comments are minimized when the new risk-assessment
comment is posted, not when the review comment is. Name
ListCommentMinimizedStates in the driver guide.

Assisted-by: Claude (fix), Gemini (review)
Signed-off-by: Wayne Sun <gsun@redhat.com>
ListCommentMinimizedStates returned a partial map when a page reported
hasNextPage with an empty endCursor; return a "missing pagination
cursor" error instead, as the review-thread reader does. Say that only
a null issueOrPullRequest wraps ErrNotFound (github.com reports a
missing number as a GraphQL error), and restore "the newest is not" in
the minimized-comments step row.

Assisted-by: Claude (fix), DeepSeek (review)
Signed-off-by: Wayne Sun <gsun@redhat.com>
@waynesun09
waynesun09 force-pushed the agent/9957-minimize-superseded-comments branch from 28da83d to 585fd7e Compare December 3, 2026 20:33
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 8:37 PM UTC · Completed 8:49 PM UTC

Commit: 585fd7e · View workflow run →

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

@fullsend-ai-review fullsend-ai-review Bot removed the ready-for-merge All reviewers approved — ready to merge label Dec 3, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

While the change spans 31 files across core CLI and forge packages with elevated git history churn and coupling, risk remains moderate due to bot authorship, zero protected or security-sensitive paths touched, solid test coverage, and complete alignment with the linked issue.

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Looks good to me

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review December 3, 2026 20:49

Superseded by updated review

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Dec 3, 2026
@waynesun09
waynesun09 added this pull request to the merge queue Dec 3, 2026
@waynesun09

Copy link
Copy Markdown
Member

Live check on github.com

Built fullsend from 585fd7e and posted three triage results with fullsend post-comment --marker "<!-- fullsend:triage-agent -->" on nonflux/tmp-9957-minimize-demo#1, with a plain comment (no marker) between runs 1 and 2.

Run output: run 2 printed Minimizing 1 superseded comment(s), run 3 printed Minimizing 2 superseded comment(s).

Minimized state from the GraphQL API afterwards:

Comment Body isMinimized minimizedReason
7392547852 Run 1 result true outdated
7392548488 Plain comment, no marker false —
7392548837 Run 2 result true outdated
7392549503 Run 3 result false —

The behaviour step's issueOrPullRequest comments query also returned these states on github.com, and the REST node_id values match the GraphQL ids it keys on.

Earlier results collapse as "Hidden as outdated"; the plain comment and the newest result stay visible:

Thread with runs 1 and 2 hidden as outdated

A hidden result still expands with "show comment":

Run 1 expanded

Limit: the comments were posted with a user token, not an agent App token; the App path is covered by the review-re-run-minimize behaviour scenario on the emulator. The test repo is temporary.

Merged via the queue into main with commit 2edaf57 Dec 3, 2026
74 checks passed
@waynesun09
waynesun09 deleted the agent/9957-minimize-superseded-comments branch December 3, 2026 21:50

This branch was successfully deployed

1 active and 1 inactive deployments
site-preview — 585fd7e0 Deployed Dec 3, 2026 by github-actions[bot]
forgejo-dev — 585fd7e0 Deployed Dec 3, 2026 by waynesun09 via forgejo-behaviour #21889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/docs User-facing documentation component/e2e End-to-end tests fullsend-no-fix Skip bot-triggered fix agent runs go Pull requests that update go code ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minimize superseded agent result comments now that every run appends

1 participant