Skip to content

fix(pr-pipeline): work a listed bot's thread only behind a trusted @codex request - #11690

Merged
kyle-sexton merged 11 commits into
mainfrom
host-run/8284-codex-requester-check
Oct 31, 2026
Merged

kyle-sexton merged 11 commits into
mainfrom
host-run/8284-codex-requester-check

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Closes #8284

Summary

Anyone can comment @codex on this public repository, and since #10391 address-feedback has worked any thread whose comments are all chatgpt-codex-connector[bot]'s. This change adds the requester check from the issue's refinement: a listed bot's thread that no trusted person directed is worked only when a trusted actor asked for that bot's review. Otherwise the thread is left for a person, and the reason is logged.

A request is either an explicit @codex comment or the event that triggered an automatic review: the PR opening, or marking it ready. The bot stays on review-threads.reviewer-ids, and the standards trusted-actor list is unchanged (Q662).

Fix

address-feedback.mjs adds codexRequest, requestSkip, requestSkipLine and readTriggers. The window runs from the same bot's previous review up to this one.

  • Explicit requests are @codex mentions in issue comments, review comments and review bodies.

    • A trusted request needs @codex as a whole handle from a person trustedHumansFrom lists.
    • From an untrusted author, any @codex counts as a request, even when it is attached to other text. A creation or a last edit inside the window both count.
    • The listed bots' own text never counts. Codex's review help text names @codex review, as the review bodies on fix(app-control): find plugin control skills at manifest-declared paths #10092 show.
  • Automatic reviews. Codex reviews on its own when a PR opens or is marked ready, which is what happened on fix(app-control): find plugin control skills at manifest-declared paths #10092. With no @codex comment, the review counts as asked for by whoever triggered it: the PR's author for the opening, or the actor of each ready_for_review event in the REST issue timeline.

    • The code cannot tell which event triggered the review, so every such event in the window must be by a trusted person or by the lanes App.
    • The lanes App is recognized by the id the code already uses for it, APP_SENDER_ID. Nothing is added to any trust list.
    • Lanes App PRs, which the lanes App opens and readies, and owner PRs are covered. A PR opened or readied by anyone else is skipped.
  • Skip rules (fail closed).

    • An untrusted request or event in the window skips the thread as codex-request-untrusted.
    • No readable request or event skips it as codex-request-not-found. That covers an unreadable timeline and an unreadable review time.
    • The check runs only on threads with no trusted direction. A fix request, or a reply to an escalation, already carries a trusted person's word.
  • One shared path.

    • keepThreads applies the check, so the select job, the reply job's re-read and fix-ci-context.mjs all use it. publish-feedback.mjs passes its log to the re-read.
    • The dispatcher, feedback-dispatch.mjs, applies the same requestSkip in keptAuthors.
    • Reviews and the timeline are read only when an unresolved thread holds a listed bot's comment.
    • The dispatcher's THREADS_QUERY now reads each thread's id and its review's submittedAt.
    • Each log line names the thread id, the kind of request and the account id. No comment body is logged.
  • Docs. The pr-pipeline README's review-threads section, pr-run-activity.md and a changelog fragment describe the rule.

  • Edited and deleted requests. These close the gaps where a stranger removes a request after Codex answered it:

    • A comment or review by anyone other than a trusted person or our own bots, created before the review and edited since the window opened, counts as untrusted whatever it says now. Our own bots are the lanes App and github-actions; the review lanes edit their marker in place.
    • A review body's edit time comes from GraphQL PullRequestReview.lastEditedAt.
    • A deleted comment by such an author counts as untrusted. Deletions are read from GraphQL CommentDeletedEvent.
    • If this history cannot be read, the thread is skipped.

Known limit (UNVERIFIED): whether CommentDeletedEvent also records deleted inline review comments.

Verification

  • Tests first. Each new case failed on the code before its change:

    • untrusted and not-found requests;
    • the dispatcher;
    • a stranger-authored PR's automatic review, which is skipped;
    • an owner-authored automatic review, which is worked;
    • a lanes App PR's automatic review, which is worked;
    • a ready flip by a stranger, which is skipped;
    • an unreadable timeline, which is skipped.

    The trusted case and the directed case passed both before and after the change, as they should.

  • Direct suite run. node --test over the address-feedback, feedback-dispatch, fix-ci-context, publish-feedback, verify-notes and adjudicate-feedback suites: 631 pass, 0 fail.

  • Existing tests. The existing Codex fixtures now carry a trusted @codex review comment and a review time, and every existing assertion is unchanged.

  • scripts/check-affected.sh --tests on the committed head: exit 0, 11 passed and 5 skipped. Its test step selected 69 suites and left them to their CI lanes, so the direct node --test run above is the local test evidence.

Related

🤖 Generated with Claude Code

…odex request

Anyone can comment @codex on a public repository, so a thread a
review-threads.reviewer-ids bot opened, with no trusted person's
direction, is worked only when the @codex request behind the bot's
review came from a person on the trusted-actor list. An untrusted
request since the bot's previous review, or no trusted request, leaves
the thread for a person with a logged reason. The select job, the reply
job's re-read, fix-ci-context and the dispatcher share the check.

Refs: #8284

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@kyle-sexton
kyle-sexton marked this pull request as ready for review October 31, 2026 19:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T20:00:45.541376Z 0af5ec0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

A stranger's @codex glued to other text (x.@codex) now counts as an
untrusted request, so a form the bot may also answer cannot slip past
the check; a trusted request still needs a whole handle. The
pr-run-activity keep rule names the requester check.

Refs: #8284

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 090659818a71180180cc60b59566ae869f4aea24: 0 finding(s), 0 as inline comments.

Incremental review (39faa54 → 0906598): no findings.

What changed. codexRequest and requestSkip now take appId where they used to take an ownIds set. The change splits two roles that the old new Set([appId, MARKER_AUTHOR_ID]) mixed together:

  • Automatic-review trigger check (opening and ready_for_review events, address-feedback.mjs#L758): only a trusted person or the lanes App (appId) counts as a trusted trigger now. github-actions[bot] no longer does. This narrows what counts as trusted, which matches the PR description ("every such event in the window must be by a trusted person or by the lanes App").
  • Edited and deleted comment rules (L742, L749): these keep exempting both of our bots through ourBot, the lanes App and MARKER_AUTHOR_ID. That matches the description's note that the review lanes edit their marker in place.

Checked:

  • Call sites. All three (keepThreads, requestSkip's inner call, and feedback-dispatch.mjs keptAuthors) now pass appId. No caller still passes ownIds.
  • Production appId.
    • The address-feedback, fix-ci-context and publish-feedback entry points validate it with positive(...).
    • feedback-dispatch requires APP_SENDER_ID to be set and passes Number(env.APP_SENDER_ID).
    • If that value is not numeric, NaN !== actorId is always true, so the trigger check fails closed.
    • With a defined appId, an event whose actor id is missing is not treated as trusted.
  • New test case (address-feedback.test.mjs:1877). It covers the narrowed rule: a ready flip by github-actions[bot] is skipped as untrusted, and the expected log line names the bot's account id.
  • Docs. The PR description's wording on the trigger and edit/deletion rules matches the new behaviour. No doc file changed in this increment.

I did not run the tests myself. The author's suite results in the PR body are unverified by this lane.

No security concern is raised here. The change is a trust-boundary narrowing, and the security lane owns that review.

Spend: none. This increment changes no lane runs, models, schedules or billing.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-security-review: 1 inline finding(s) on 0af5ec0d7091c1f51c93256cde28ff2c936acccc; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 090659818a71180180cc60b59566ae869f4aea24: 0 finding(s), 0 as inline comments.

Security review: incremental change since 39faa54

Scope. I reviewed .claude-lane/incremental.diff, which changes three files: address-feedback.mjs, its test, and feedback-dispatch.mjs. address-feedback.mjs and feedback-dispatch.mjs are trusted paths, so I read each whole change and the requester check it controls (codexRequest, which requestSkip calls, which keepThreads and keptAuthors call). That check decides whether a Codex review thread with no trusted direction can reach the credentialed feedback lane.

What changed. The diff replaces the ownIds set ({appId, MARKER_AUTHOR_ID}) with an appId parameter and a local ourBot helper.

  • Edited-comment and deleted-comment exemptions: no change. ourBot returns true for the lanes App and for github-actions[bot] (MARKER_AUTHOR_ID = 41898282, address-feedback.mjs#L71). That is the same pair ownIds held before (L742, L749).
  • Automatic-review trigger events (the PR opening and ready-for-review): this is a narrowing. Before, github-actions[bot] counted as a trusted trigger actor. Now only a trusted person or appId passes (L758). Any workflow that can use GITHUB_TOKEN can act as github-actions[bot], so dropping it from the trust set closes a path for untrusted input. The new test case (a ready flip by github-actions[bot] is rejected as untrusted) covers this.
  • Leftover references: none. A search finds no remaining reference to ownIds, and both callers (keepThreads at L916 and keptAuthors at feedback-dispatch.mjs#L276) now pass appId.

Trust controls. This change widens nothing. It does not change who passes the trusted-trigger check, any token's scope, or what untrusted text reaches a lane. Its only effect on the requester check is to tighten it.

Pre-existing, not introduced here. If appId were ever undefined, an event or deletion with no actor id would match it. The old ownIds.has(undefined) behaved the same way, so this diff does not change that exposure. Both callers get appId from the configured APP_SENDER_ID.

No security issues found in the incremental change.

critical-findings: 0

kyle-sexton and others added 2 commits October 31, 2026 16:04
…gger

Codex reviews on its own when a PR opens or is marked ready, with no
@codex comment, so the requester check now reads those triggers: the
PR's author for the opening and the actor of each ready-for-review event
since the bot's previous review. Each must be on the trusted-actor list
or be the lanes App (APP_SENDER_ID); any other actor, or an untrusted
@codex in the window, still skips the thread, and an unreadable trigger
skips it as not found. The select job, the reply job, fix-ci-context
and the dispatcher share the check through requestSkip.

Refs: #8284

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Oct 31, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-security-review: 1 inline finding(s) on b7a3f0b7c4c7fd3fe2756e705ae9d20cb42fdd50; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

Lane-Activity: pr-unblock/resolve-conflicts

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-security-review: 2 inline finding(s) on c3b34b6245a4a80a8f4a09bf0a327768cd1b9263; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head c3b34b6245a4a80a8f4a09bf0a327768cd1b9263. What it wrote, as data:

What it wrote (36 lines)
Summary: Issue #8284 (refined): address-feedback should work an undirected Codex thread only when a
  trusted actor asked for the review. The PR adds codexRequest/requestSkip with tests for the
  trusted, untrusted and not-found cases, and every CI job that ran passed (lint-shell was skipped).
  It still fails on one likely bug. readTriggers calls api.listTimeline, but the diff adds that
  method only to feedback-dispatch.mjs's createGitHubApi. The client in address-feedback.mjs, which
  the select job, the reply job and fix-ci-context use, gets no listTimeline. Before this PR the
  address-feedback test fake had none either, so no existing code path there seems to use it.
  readTriggers swallows errors, so in production those paths would likely always get null triggers.
  Automatic Codex reviews on owner and lanes App PRs would then be skipped as
  codex-request-not-found while the dispatcher counts them workable. The four paths would disagree,
  against the spec's same-check criterion, and the dispatcher would start rounds that the select job
  then escalates.
- Checked: the trusted-actor list, CODEOWNERS and the check-trusted-trigger, check-kill-switch,
  request-lane-token and resolve-config actions are unchanged. No binary files and no credentials
  appear in the diff. The new behaviour only narrows what the lane works, and the lanes App counts
  as a trigger only for automatic reviews, as the owner's host-run comment on #8284 describes.
- .github/scripts/pr-unblock/address-feedback.mjs:110 readTriggers calls api.listTimeline(pr), but
  the diff adds listTimeline only to feedback-dispatch.mjs's createGitHubApi (feedback-dispatch.mjs,
  the listTimeline line added near listReviews). Add listTimeline (GET
  repos/{repo}/issues/{n}/timeline, paginated) to the createGitHubApi in address-feedback.mjs, which
  fix-ci-context.mjs also imports. Without it, select, currentThreads and fix-ci-context probably
  always get triggers=null, so automatic Codex reviews on owner and lanes App PRs are skipped as
  codex-request-not-found while the dispatcher counts them workable. That breaks the spec's
  criterion that the select step, the reply job and the dispatcher apply the same requester check.
- .github/scripts/pr-unblock/address-feedback.mjs:117 readTriggers' bare catch also hides a missing
  client method. Catch only failed reads, or add a test that the real createGitHubApi of
  address-feedback.mjs exposes listTimeline (as feedback-dispatch.test.mjs checks its query), so the
  tests can catch this gap.
- .github/scripts/pr-unblock/address-feedback.mjs:157 restMentions takes no updated_at for review
  bodies, so edits to a stranger's review body are not checked against the window, as they are for
  comments. This is minor: consider passing editedAt for reviews too.
- .github/scripts/pr-unblock/fix-ci-context.mjs:240 keepThreads now gets the real trustedHumans
  instead of an empty set. This may change which human-directed threads become review findings in
  the fix-ci context. It is a side effect beyond the requester check: confirm it is intended.
- Spec criterion that a security-review pass ran at the PR head: upstream-jobs.json has no evidence
  of that lane, though ci-status is success. A person should confirm it before merge.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass at a new commit removes the label.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Oct 31, 2026
kyle-sexton and others added 3 commits October 31, 2026 17:59
A stranger could steer a Codex review with a @codex request, then edit
the mention out or delete the comment before the lane read it, and the
trusted opening would make the review look automatic and trusted. The
check now counts, as untrusted, any comment or review by someone other
than a trusted person or our own bots that was edited since the window
opened, whatever it says now, and any deleted comment of theirs
(GraphQL CommentDeletedEvent). A review body's edit time comes from
GraphQL lastEditedAt, so an edit into a request is seen too. A history
that cannot be read skips the thread even beside a trusted request.

Refs: #8284

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…equester-check

# Conflicts:
#	.github/scripts/pr-unblock/fix-ci-context.mjs
…com/melodic-software/claude-code-plugins into host-run/8284-codex-requester-check

# Conflicts:
#	.github/scripts/pr-unblock/fix-ci-context.mjs

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-security-review: 1 inline finding(s) on 39faa54cffa79d12c797f4497c336a681b3dba13; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 39faa54cffa79d12c797f4497c336a681b3dba13; the summary is in this lane's pull request comment.

claude-lane: claude-review

…gger

The automatic-review check reused one set for two jobs, so
github-actions[bot], kept there only to exempt the review lanes' edited
markers, also counted as a trusted opener or ready-flipper. Trigger trust
is now the trusted people and the lanes App (APP_SENDER_ID) alone, as
the docs state; github-actions[bot] stays exempt only from the edited
and deleted comment rules.

Refs: #8284

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Oct 31, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 2d4d8fd Oct 31, 2026
47 checks passed
@kyle-sexton
kyle-sexton deleted the host-run/8284-codex-requester-check branch October 31, 2026 23:05
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.

chore(trusted-actors): test whether a stranger can make the Codex bot reply before trusting it

1 participant