Skip to content

feat(pr-verify): mark a pass stale when the standards trusted list changes - #18785

Merged
kyle-sexton merged 5 commits into
mainfrom
ci/verify-spec-changed-trusted-actors-blob
Nov 24, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
ci/verify-spec-changed-trusted-actors-blob

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #18784

Summary

A pr-verify pass judged with an older standards trusted-actor list kept counting after the list changed. This implements the owner's option (c) for that staleness (owner decision row 383 in docs/owner-decisions.md, accepted as A2 of the 2026-11-24 standards track-main accept; owner, verbatim: "/session-flow:go-with-recommendations"): the verdict records the list's blob, the gate compares blobs exactly, and the resolver and the lost-run reconciler compare the pass start with the list's last standards commit time.

Fix

  • lib/trusted-actors.mjs: listBlob (git's blob id of the bytes) and listChangedAt, one commits API read (repos/melodic-software/standards/commits?path=components/trusted-actors/trusted-actors.json&sha=<run standards sha>&per_page=1, .commit.committer.date; "" when no commit touches the list; a malformed answer or SHA throws) through the caller's rate-guarded client.
  • write-verdict.mjs: with STANDARDS_DIR, the verdict records trusted_actors_blob, equal to git rev-parse HEAD:components/trusted-actors/trusted-actors.json of the run's standards checkout; a malformed value throws.
  • resolve-pr.mjs: specChanged takes listChangedAt; resolvePull reads it lazily (only when passes exist) through trustedListChangedAt; main reads it at STANDARDS_SHA.
  • reconcile.mjs: one memoized read a run, shared by prefilterSpec (a head whose passes all started before it is kept; an unreadable time keeps every head) and the judgeSpec resolver.
  • babysit_verify_evidence.py _pass_refusal / _list_changed: for a repository whose team YAML opts in to the standards list (the same standards_repository _read_trusted_list reads), a recorded blob that is not the live list's blob refuses verify:spec-changed; no recorded blob stands while .github/standards/trusted-actors/trusted-actors.json is at the branch tip and refuses once it is gone. A repository on its copy compares no blob. The live blob is computed from the list the gate already reads, so no new API call there except the copy-presence read for a pass without a blob.
  • Workflows: STANDARDS_SHA on the resolver step and STANDARDS_DIR on Write the verdict in pr-verify.yml (all three legs, via node scripts/sync-credential-legs.mjs, --check clean), STANDARDS_SHA on the reconciler's plan step.
  • docs/conventions/pr-pipeline/README.md (verdict JSON, spec-changed rule, gate item) and changelog fragments for pr-pipeline and source-control.

Verification

  • Gate: TheTrustedListMustBeTheJudgedOne (blob changed: stale; same list: fresh; malformed blob: stale; no blob + copy present: fresh; no blob + copy gone: stale; repository not opted in: no comparison; git_blob matches git's ids).
  • Agreement: TheResolverAndTheGateAgreeOnTheList builds one standards history in a real git repository and runs the writer's listBlob (checked against git rev-parse), the gate, and resolve-pr's specChanged with the git log -1 --format=%cI -- <list> time: list changed after the pass, stale to both; another standards file changed, fresh to both; no blob with the copy present, fresh to both.
  • Resolver: list change after the pass gives spec-changed, before gives already-judged, no time read without passes; main reads the exact commits path at STANDARDS_SHA.
  • Reconciler: prefilterSpec keeps or drops on the list time (null keeps); a full reconcile run re-runs the passed checks only when the list changed after the pass, with exactly one commits read shared by the pre-filter and the resolver.
  • Writer: buildVerdict records and validates the field; main records git hash-object of the list, none without STANDARDS_DIR, throws on a missing list. Workflow test asserts the env on all three legs.
  • Ran: node --test over pr-verify/*.test.mjs, pr-verify/probe/*.test.mjs, maintenance-reconcile-lost-runs/*.test.mjs, lib/trusted-actors.test.mjs, scripts/sync-credential-legs.test.mjs (all pass); pytest 9.2.0 over test_babysit_verify_evidence.py (493) and the spec-trust, verify-index, rules-sync and merge-unattended suites (all pass); scripts/run-ruff.sh check clean; scripts/check-changelog-fragments.sh --check valid.

Related

  • #18697: the gate reads the trusted list from standards for opted-in repositories.
  • Hold paths: lib/trusted-actors.mjs (floor class trust), resolve-pr.mjs and write-verdict.mjs (enforcement), pr-verify.yml and maintenance-reconcile-lost-runs.yml (gate); diff-check.path-holds is false (docs/conventions/pr-pipeline.yaml), so they raise no path hold on this pull request.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 24, 2026 09:27
…anges

pr-verify's verdict records trusted_actors_blob, the git blob id of the
standards trusted-actor list the run judged with. The merge gate refuses a
pass verify:spec-changed when that blob is not the live list's, for a
repository that reads the list from standards; a pass with no blob counts
while the .github/standards/trusted-actors/ copy is at the tip and is stale
once it is gone. resolve-pr's specChanged and the reconciler's
prefilterSpec weigh the pass start against the committer time of the
newest standards commit touching the list at the run's standards SHA, one
commits API read a run, so the head is judged again.

Closes #18784

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 24, 2026 14:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T14:32:34.646257Z 2631e08 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2631e083de

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed fffa23ecba5cb4194a05b8b30e6c7b7d9d58ed36: read 18 of 18 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18785 at fffa23e

No security issues found. This lane already reviewed an earlier head of this PR, so this review was blocking only: it reports CRITICAL and IMPORTANT findings, and no SUGGESTION findings.

I read every hunk of all 18 changed files in the full diff.

What changed

The PR adds a check: a pr-verify pass goes stale when the standards trusted-actor list changes after the pass judged it.

  • The verdict now records trusted_actors_blob, the git blob id of the list the run judged with.
  • The merge gate refuses a pass whose recorded blob is not the live list's blob.
  • The resolver and the lost-run reconciler re-judge a head when the list's last commit came after the pass started.

What I checked

  • Merge gate (babysit_verify_evidence.py): narrowed, not widened. _pass_refusal L5375 adds one return SPEC_CHANGED after the existing refusals and removes no path.
    • The opt-in comes from the team YAML at the base branch tip. A pull request author cannot change that tip.
    • An opted-in repository whose standards list is absent raises _Unreadable.
    • A PolicyReadError becomes _Unreadable.
    • A malformed recorded blob (None, 7, upper case) compares unequal, so the pass is refused.
    • If standards_file returns text whose re-encoding differs from the raw bytes, the blob comparison fails and the pass is refused. That outcome is a refusal, not a pass.
    • A record with no blob stands only while .github/standards/trusted-actors/trusted-actors.json exists at the tip. Such records were accepted the same way before this PR, so nothing is weakened.
    • Verdict artifacts are written by the trusted .base copy of write-verdict.mjs. Pull request code does not write them.
  • trusted-actors.mjs:
    • listChangedAt accepts only a full SHA (/^[0-9a-f]{40}$/). It builds the API path from constants and that SHA, so no input can inject into the path.
    • A malformed answer throws.
    • listBlob is a read-only hash (SHA-1 used as git's object id, not as a security hash).
    • Neither touches who is trusted.
  • resolve-pr.mjs, write-verdict.mjs:
    • A list change can only move a head to spec-changed, which means it gets judged again. It never makes a skipped head pass.
    • A failed read throws and fails the job closed.
    • trusted_actors_blob is checked against SHA before it is recorded.
  • reconcile.mjs: a failed list read keeps every head (listAt === null). passRateLimit still passes rate-limit stops through. The reconciler only triggers re-runs and does not gate the merge.
  • Workflows: the only change in pr-verify.yml and maintenance-reconcile-lost-runs.yml is new env entries (STANDARDS_SHA and STANDARDS_DIR) set from steps.standards.outputs.*, a trusted step's output. No trigger, permissions: block, token request or run: interpolation changed.
  • Trust controls: none is widened. The trusted-actor list contents, the trusted-trigger check, the token scope, the kill switch and every merge hold are unchanged or stricter.
  • Fixture: fixtures/standards-list-commits.json is a captured public commits API response. It contains a public PGP signature and no secret or token.
  • Manifests and instruction surfaces: none changed.
  • Spend: each resolver run and each reconciler run makes one extra REST read, using existing API quota. No billing impact.

PR context

It contains no text that tries to direct the review.

Earlier findings

The prior summary comment (head 8d31fb7) reported 0 findings, so nothing is carried forward.

critical-findings: 0

@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 2631e083de871444ebcc3d724d4825abb336de3a; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed fffa23ecba5cb4194a05b8b30e6c7b7d9d58ed36: read 18 of 18 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #18785 at fffa23ec

No blocking findings. This lane already reviewed an earlier head (blocking only: yes), so this review reports blocking findings only.

Scope. I read every hunk of all 18 changed files in .claude-lane/pr.diff. For context I also read:

  • babysit_verify_evidence.py _pass_refusal at head (lines 5335–5387), to see where _list_changed sits.
  • babysit_merge_policy.py: _file_at, standards_file, opts_in_to_standards, team_yaml_at and checkout_file_at.
  • The Download standards / Resolve the pull request / Write the verdict steps of each job in pr-verify.yml.

What I checked

  • The writer's blob matches the gate's blob. The writer hashes the raw bytes of the checkout file (listBlob). The gate hashes text.encode() of a strict UTF-8 decode of the contents-API base64 (_file_at), which gives the same bytes back. Both use the git blob <len>\0 header.
  • The workflow env is wired. Each of the three legs (check-intent, -subscription, -fallback) has its own id: standards step. So STANDARDS_DIR on Write the verdict and STANDARDS_SHA on the resolver are never empty, and a verdict will not quietly drop trusted_actors_blob. steps.standards.outputs.sha is an existing output of that step, already used throughout the repo.
  • Placement in the gate. _list_changed runs after the closing-set and spec-kind checks and before the intent and trusted-spec checks. A read failure becomes _Unreadable, so the gate fails closed. An opted-in repository whose standards list is missing also raises.
  • The previous finding is still fixed. reconcile.mjs still wraps the shared listChanged promise in listChangedOrNone for judgeSpec. So a failed commits read no longer stops issue-edit re-runs, and the regression test is still there.

Closing issue #18784 acceptance criteria. I checked these against the diff; I did not run the tests.

  • A changed list refuses the pass in the gate, and the resolver and reconciler re-judge the head: met. Tested by test_a_changed_list_is_stale_and_the_same_list_fresh, the resolver's spec-changed test and the reconciler's [601] re-run test.
  • Another standards file leaves the pass fresh in all three: met. The agreement fixture covers the gate and the resolver. The reconciler reads the list's own commit path, so the "list changed before the pass" case covers it.
  • No recorded blob is fresh while the copy is present and stale once it is gone: met. Tested by test_no_recorded_blob_stands_only_while_the_copy_is_there.
  • One fixture shows the resolver and the gate agree: met by TheResolverAndTheGateAgreeOnTheList, which uses a real git history.

The PR description's test results are the author's claim; I did not verify them.

Spend (not a hold). When the standards trusted list changes, pr-verify lane runs re-judge heads whose passes started earlier. Each resolver and reconciler run also adds one GitHub commits API read. Both use prepaid or subscription capacity only.

Loosened checks. The wrapper sent no loosened_check_* lines, so I used the default fail verdict with no consumer patterns. I did not check the decision-record citation requirement. Nothing here loosens a check:

  • The gate refuses more passes.
  • prefilterSpec keeps more heads.
  • The FakeGitHub contents change only serves a base64 payload as well as the raw one.

Loosened checks would be marked: fail (plugin default; no wrapper settings lines); patterns: 0

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 3 commits November 24, 2026 09:46
… env dict

The fixture-git-isolation gate could not see GIT_CONFIG_GLOBAL and
GIT_CONFIG_NOSYSTEM through `self.env | {...}`; a dict spread of the bound
env carries both, so the gate reads the git calls as isolated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A failed read of the standards trusted list's last change was saved as a
rejected promise and handed to every resolvePull, which threw it, so one
5xx left every passed head unchecked and stopped issue-edit re-runs. The
resolver now gets undefined for the list time on a non-rate-limit
failure and judges the head on its other spec times.

The commits API answer the list-time tests feed is now a capture from
melodic-software/standards, shared by the trusted-actors, resolver and
reconciler tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit d87b77d Nov 24, 2026
59 checks passed
@kyle-sexton
kyle-sexton deleted the ci/verify-spec-changed-trusted-actors-blob branch November 24, 2026 16:27
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark a pr-verify pass stale when the standards trusted-actor list changes

1 participant