Skip to content

feat(review): name the review check and its summary comment per automation - #310

Open
eric-factory wants to merge 4 commits into
devfrom
eric/check-name-input
Open

eric-factory wants to merge 4 commits into
devfrom
eric/check-name-input

Conversation

@eric-factory

@eric-factory eric-factory commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Factory Code Review: Web · Desktop

Part of AUT-3177 (one automation per type per repository, with distinct review check names)

Description

Two Factory review automations on one repository both post a check named "Droid Review" today, and the second run adopts the first run's summary comment. GitHub then shows one check and one summary for two different reviews, and a ruleset that requires "Droid Review" can pass on either run. This affects repositories that more than one Factory review automation covers, for example two Factory organizations connected to one GitHub installation.

A new optional input, review_check_name, names the check and keys the summary comment, so each automation keeps its own:

No review_check_name (today's behavior) review_check_name: "Droid Review (ab12cd34)"
Check run name "Droid Review", or "Droid Security Review" for a security-only run "Droid Review (ab12cd34)" for every run of that automation
Summary comment marker <!-- droid-review-summary:v1 --> <!-- droid-review-summary:v1 name=Droid%20Review%20(ab12cd34) -->
Summary comment a run adopts The unnamed one Only the one carrying its own name
review_summary: description block Unnamed delimiters Delimiters carrying the name
Caution on a blocked review "The Droid Review check is blocking this change…" "The Droid Review (ab12cd34) check is blocking this change…"

Without the input, check names, markers and comment adoption stay as they are, with one exception: an unnamed run no longer adopts a summary comment that carries a named marker. A name equal to a default check name ("Droid Review", or "Droid Security Review") counts as unset, so a run that passes the default keeps the pull request's unnamed summary.

Factory's hosted review sets REVIEW_CHECK_NAME directly for github/run-review.sh (the backend change is in the factory-mono PR linked in the ticket). The check's external_id (<run id>:<attempt>) does not change, and Factory finds its checks by that id.

  action.yml, review/action.yml, security/action.yml, prepare/action.yml
+   review_check_name input, passed as REVIEW_CHECK_NAME to the steps that read it
  src/core/review/config.ts
+   reviewCheckNameFromEnvironment(): the trimmed name; blank means unset
  src/core/review/markers/index.ts
~   summaryMarker(name), hasSummaryMarker(body, name), summaryMarkerIn(body),
~   description delimiters per name
  src/github/operations/review-checks.ts
~   reviewCheckName() prefers the configured name
  src/github/operations/review-lifecycle.ts
~   accepts a named check as this run's; summaries and description blocks found per name
  src/github/operations/comments/{common,create-initial}.ts
~   a model's progress update keeps the stored marker; adoption only within one name

Decisions made for this PR:

  • When an automation that has posted under the unnamed marker first runs with a name, it opens a new named summary comment instead of adopting the unnamed one, because the unnamed comment may belong to another automation. Each pull request sees this once.
  • An unnamed CI workflow and a hosted automation named "Droid Review" post the same check name, so hasOtherReviewCheck still counts each other, as today.
  • Inline finding threads, @droid resolve, and the #droid-review-summary anchor stay shared between checks.
  • GitLab is not wired: its merge request status keeps its name.

Potential Risk & Impact

  • Default behavior is unchanged without the input, apart from the adoption rule above. Every existing caller of the summary lookups is scoped by name through one function (hasSummaryMarker), so a missed caller would fall back to today's unnamed behavior rather than mix names.
  • Factory's hosted review only passes a name when the backend change ships. Until this PR reaches the ref the backend runs (main by default), hosted runs ignore the name.

How Has This Been Tested?

  • bun test in CI at 70cc11d: 2,810 pass, 1 fail. The failure, test/github/data/review-artifacts.test.ts ("returns original selected paths without exposing them in prompt artifacts"), fails the same way on dev without this change: on every dev push since c52bf57 (fix(review): explain disabled auto-trigger skips in plain English #287), including the latest, 74950f0. The test check is not required.
  • bun run typecheck and bun run format:check: clean.
  • Each new test fails when its production change is reverted: check name ignored, named check rejected as another run's, security-only flag lost on a named run, lookup not scoped by name, stored marker not kept on a model update, description block not keyed by name, blank name not treated as unset.
  • Live run on GitHub Actions, in a throwaway pull request in a test repository: two jobs ran droid-action from this branch at 70cc11d on the same pull request (workflow run 47430012858). Job default-name passed review_check_name: "Droid Review", and job named passed "Droid Review (live3177)".
    • GitHub showed two checks, "Droid Review" and "Droid Review (live3177)".
    • The pull request still had exactly the two summary comments from the first run: default-name updated the unnamed one in place (its review state moved to the new head), and named updated the one marked name=Droid%20Review%20(live3177). No third summary was created.
    • On the first run, before the default name was passed explicitly, the job without the input created the unnamed summary and the named job created the named one.

eric-factory and others added 3 commits December 4, 2026 20:23
Every run named its check "Droid Review" (or "Droid Security Review")
and adopted the first Droid summary comment on the PR, so when several
automations reviewed one repository the last run to start took the
comment over and the others ended as superseded without posting.

The new review_check_name input, read as REVIEW_CHECK_NAME (the hosted
backend sets the variable directly), names the check as given, for
security-only runs too. The summary marker then carries the name,
percent-encoded so it cannot end the HTML comment
(<!-- droid-review-summary:v1 name=Droid%20Review%20(ab12cd34) -->), and
a run adopts, owns and reads review state only from the comment whose
marker has its name. Description mode's start and end markers carry the
name too. Without a name the marker and lookup are unchanged, except
that an unnamed run no longer adopts a named run's comment.

Refs AUT-3177

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Refs AUT-3177

The validator steps never read REVIEW_CHECK_NAME, so they no longer get it.
Summary markers compare names in their encoded form, which drops a silent
catch around decoding, and the check summary keeps its old fallback text.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Refs AUT-3177

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>

@eric-factory eric-factory left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deep review of the per-automation check name: one Non-Blocking finding (passing the default name "Droid Review" makes a named marker, so the first hosted run starts a second summary comment and drops the stored review state, including @droid pause) and six nits on error messages, tests and docs. The per-name summary marker, the rule that a check never adopts another check's summary, and the three-name lifecycle test are well done.

Comment thread src/core/review/markers/index.ts Resolved
Comment thread src/core/review/markers/index.ts Resolved
Comment thread docs/setup.md Resolved
Comment thread README.md Resolved
@factory-droid

factory-droid Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor Author

@droid resume

@factory-droid

factory-droid Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are enabled again for this PR.

… passed

- Treat REVIEW_CHECK_NAME "Droid Review" or "Droid Security Review" as unset, so a
  run that passes a default name keeps the PR's unnamed summary comment and its
  review state instead of creating a second summary.
- Add DEFAULT_REVIEW_CHECK_NAME and DEFAULT_SECURITY_REVIEW_CHECK_NAME and use
  them for the default check name and the blocking banner.
- Split the summary ownership and check binding guards in
  loadBoundReviewLifecycle into one error per condition, each naming the comment
  or check, the values that disagree, and the REVIEW_CHECK_NAME hint.
- Remove an orphaned doc comment in the markers module.
- Test default names, a before/after name mismatch, pausing under a named check,
  and the named blocking banner. The createInitialComment tests restore
  REVIEW_CHECK_NAME instead of deleting it.
- Document review_check_name as a GitHub workflow input in the Review
  Configuration table, say a default name equals an empty input, and say which
  check to require in branch protection.

Refs AUT-3177

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant