Skip to content

feat(review): wait for pushes to settle before reviewing a push - #56

Open
cipherstash-agent wants to merge 9 commits into
feat/52-review-push-ready-prfrom
feat/53-settle-before-review-push
Open

cipherstash-agent wants to merge 9 commits into
feat/52-review-push-ready-prfrom
feat/53-settle-before-review-push

Conversation

@cipherstash-agent

@cipherstash-agent cipherstash-agent commented Nov 30, 2026 •

Copy link
Copy Markdown

Summary

A push to a ready pull request now waits before it is reviewed, so a burst of pushes gets one review, of the last push. The wait is the new settle-minutes input (default 5, 0 for no wait, at most 30). After the wait, the pull request is read once. If it is still open, still ready and its head is still the pushed commit, the review goes ahead. Otherwise the run ends green with the skip superseded, draft or closed. Comment commands never wait.

Stack position: this is the second pull request in a stack. Its base is feat/52-review-push-ready-pr (#55), which is itself based on main. Nothing is stacked above it. It is ticket #53 under #50.

Changes

  • Workflow (.github/workflows/): a new settle job runs between decide and fire, only for a Push fire. It holds only pull-requests: read, uses no secrets and has no concurrency group, so a superseded run ends as a skip and never as a cancelled run. The fire job fires a Push request only on the settle result. Every other kind still fires on the decision alone. The fire and react jobs start with !cancelled(), so a skipped settle job does not stop a comment command or its reaction. The workflow also outputs settle-decision, the settle job's own decision.
  • Step (steps/settle.py): waits, then reads the pull request once with the job's own token. Anything but a clear answer from GitHub (error status, redirect, timeout, dropped connection, non-JSON, wrong shape, answer over 1 MiB), a bad wait value or a missing step file is the skip settle-check-failed with one error annotation.
  • Self-test (.github/workflows/self-test.yml, steps/verify.py): passes settle-minutes: 1. A push skipped as superseded, draft or closed passes as "Push not reviewed" only when the settle job made that skip. A skip from the decide job still fails.
  • Tests (tests/): test_settle.py (local HTTP stub), test_settle_job.py (job structure), plus additions to the permission, decision-file, Python-step, own-caller and verify tests. pyproject.toml lists the two new test files for mypy.
  • Docs (README.md, CONTEXT.md, examples/): describe the input, the new skip reasons, the runner cost on private repositories (about 5 billed minutes per push at the default) and the self-test's 1-minute wait. The glossary defines Push and the settle wait. The example caller's header and its byte-for-byte copy carry the same change.

Verification

Run locally, with the real results:

  • python3 -m unittest discover --start-directory tests: passed, 296 tests OK, on Python 3.13 only (CI runs 3.10, 3.12 and 3.14). Run after merging the base branch.
  • ruff check (version pinned in .github/python-checks/requirements.txt): passed. Used --output-format=concise because the sandbox refused the github format command.
  • mypy: passed, no issues in 24 source files.
  • request-decision/test-runner: passed.
  • request-decision/test: passed, 103 cases, 0 failed.
  • actionlint v1.7.12 (prebuilt binary, run over the workflows and examples/claude-review.yml): passed, no findings. go run [email protected] was refused by the sandbox.
  • zizmor 1.32.0 --persona=regular: passed only with --offline --format=plain (no findings, 3 ignored, 17 suppressed). The online run failed with HTTP 401 through the proxy, so the online audits did not run.
  • .github/scripts/check-lock: not run. gh actions-lock is not installed here. Left to CI.

Acceptance criteria (#53)

  • Step harness tests with the local HTTP stub cover every case in Spec: review the commits pushed to a ready pull request #50's settle testing decisions. Met: tests/test_settle.py covers head unchanged, the superseded, draft and closed skips, each failure to get a clear answer (error status, redirect, timeout, non-JSON, not a pull request, oversized) as settle-check-failed with an error, and a wait of 0.
  • Workflow structure tests show the settle job holds only pull-requests: read, no secrets, the shared checkout settings, and runs only for a Push fire. Met: test_settle_job.py, test_permissions.py and test_python_steps.py.
  • Two pushes within the wait on one of this repository's ready pull requests give one stub reply, for the second push; the first run ends green as superseded. Open. Not verified end to end. It needs the self-test on a real push to a ready pull request, and this pull request is a draft. The superseded path and the verify mapping are covered by unit tests only.
  • A comment command posted during a Push wait is sent without waiting for it. Met by structure tests, not end to end: the fire job fires every other kind on the decision alone, the settle job has no concurrency group, and a Push fire has its own concurrency group (tests/test_own_caller.py). A comment command's run neither waits for nor queues behind a Push wait.
  • README and glossary describe the input, the skip reasons and the cost. Met.
  • The repository's checks pass. Met locally except online zizmor and check-lock, which could not run (see Verification). CI is the gate for both.

Related

Refs #53 and #50. The base is not the default branch, so a Closes #53 line does not link this pull request; it is linked to #53 separately. Stacked on #55.

Review notes

Start with steps/settle.py, then the settle and fire jobs in the reusable workflow. The branch is stacked, so it is not re-signed by rebase. This sandbox has no allowed-signers file, so git log %G? shows N for all four commits; GitHub's own verification badge is the check to trust.

🤖 Generated with Claude Code

https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo

A Push request fired at once, so a busy branch got a review, and a
Claude session, for every push. A burst of pushes should get one
review, of the last push.

A new settle job runs between decide and fire, only for a Push fire. It
waits for the new settle-minutes input (default 5, 0 for no wait, at
most 30), then reads the pull request once with the job's own token.
It passes the request on only if the pull request is still open, still
ready and its head is still the commit after the push; otherwise it
ends green with the skip superseded, draft or closed. Anything but a
clear answer from GitHub, a bad wait value or a missing step file is
the skip settle-check-failed with an error annotation. The check is
steps/settle.py, run from the self-checkout like the other steps.

The job holds only pull-requests: read and no secrets, and has no
concurrency group, so a superseded request ends as a skip, never as a
cancelled run, and a comment command never waits for it. The fire job
needs the settle job and fires a Push request only on its result;
every other kind still fires on the decision alone. Because GitHub
skips a job with no status function once any job before it was
skipped, the fire and react conditions now start with !cancelled().
The workflow's decision output is the settle job's decision for a
push, so the run summary and callers see the final decision; the
decide job's summary line for a push now says it is waiting.

The self-test passes a one-minute wait, and its verify step passes a
push that the settle wait skipped, since the newer push's run is the
one tested. The job-condition evaluator moves into the test harness
so the reusable workflow's conditions are tested too.

Refs #53
Refs #50

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
A maintainer turning on Push reviews needs to know that a push waits
before it is reviewed, how to change the wait, what the new skips mean
and what the wait costs on a private repository, without reading the
workflow. The README gains the settle-minutes input, the settle job,
the superseded and settle-check-failed skips, the runner cost and how
the self-test treats a superseded push. The example caller's header,
and this repository's byte-for-byte copy of it, say the same in short.
The glossary defines the settle wait.

Refs #53

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo

Copy link
Copy Markdown
Author

@cipherstash-agent review

Draft pull request for #53, stacked on #55. Please review the whole pull request against its base feat/52-review-push-ready-pr.


Generated by Claude Code

…le wait made it

The self-test passed any push whose final decision was a superseded, draft
or closed skip, on the reasoning that only the settle wait can make those
for a push it tests. But the decide job also skips draft and closed pull
requests, and the review workflow's final decision does not say which job
wrote it. A regression in the request decision that skipped a ready push
as draft would have passed as "Push not reviewed" instead of failing.

The review workflow now also outputs the settle job's own decision as
settle-decision, empty when the settle job did not run. The verify step
passes a push's superseded, draft or closed skip only when that output is
the same skip; a skip from the decide job fails, naming its reason, as it
did before the settle wait.

Refs #53

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo

Copy link
Copy Markdown
Author

@cipherstash-agent review

Head a1b9dc9. Please review the whole pull request against its base feat/52-review-push-ready-pr.


Generated by Claude Code

…y-pr

The base branch now gives Push requests a fire concurrency group of their
own, so a push cannot replace a waiting comment command or requested
reviewer request. Merged so the settle wait is tested against it.

Refs #53

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo

Copy link
Copy Markdown
Author

@cipherstash-agent review

Please review this draft pull request (ticket #53, stacked on #55). Start with steps/settle.py, then the settle and fire jobs in the reusable workflow.


Generated by Claude Code

… no push is reviewed

The settle wait skips an earlier push as superseded and carries nothing
forward, so the last push's request names only its own before..after
range: an earlier push's commits are context, not changes to review. A
newer push also supersedes when its own request is itself skipped, such
as a bot's push, so then no push is reviewed. The README and glossary
said the newer push's request always goes on; they now state both limits,
which the ticket must still decide whether to change in behaviour.

Also correct the contributor steps that named a renamed test and left
the settle job out of the checkout-consistency test's jobs.

Refs #53

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo

Copy link
Copy Markdown
Author

@cipherstash-agent review

Head 92e3d77. Please review the whole pull request against its base feat/52-review-push-ready-pr.


Generated by Claude Code

…ith the next push

Updates the settle wait's docs: the one review of a burst now covers the earlier pushes' commits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo
@cipherstash-agent
cipherstash-agent marked this pull request as ready for review December 5, 2026 01:02

Copy link
Copy Markdown
Author

integration-test: received ready request from https://github.com/cipherstash/workflows/actions/runs/47458695851/attempts/1


Generated by Claude Code

@cipherstash-agent cipherstash-agent left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Review attestation

Reviewed 62dce47 · posted from Claude Code · claude-opus-5-5 · effort medium (code-review)
Sources: code-review (medium) · claude-opus-5-5; mattpocock-skills:code-review, Standards and Spec axes · model unknown (sub-agents); findings verified at 62dce47 by review-cross-check sub-agents · model unknown
Skills: code-review, mattpocock-skills:code-review, company-skills:rust-security (loaded; the PR has no Rust files, so no rule applied), company-skills:review-cross-check, company-skills:review-post

Findings (11): 1 major, 10 minor. 10 inline, 1 below. Seven of the minor findings are code-smell judgement calls from the Standards axis, not hard violations. No documented repository standard was found to be broken.

  • general minor No self-test run at 62dce47 shows the two live acceptance criteria from #53: two pushes within the wait giving one reply, with the first run superseded; and a comment command sent during a wait. The body still says this pull request is a draft, but it is now ready, so both can be shown live; please link the runs. Source: mattpocock-skills:code-review, Spec axis · model unknown

Not posted inline: questions for the team (verification could not settle them from the code)

  • README.md:69 says that a missing or invalid commit after the push asks for a review of the whole pull request. settle.py:61-63 skips it as settle-check-failed (pinned by test_settle.py:204-208). No real synchronize event reaches this case, so the docs and the decision.jq comment are what disagree.
  • A bot push that supersedes a person's push means neither is reviewed until the next push is sent (documented as intended at README.md:72). Is that the behaviour you want?
  • The 30-minute cap on settle-minutes, and the new settle-decision output, were not asked for in #53. Keep them?
  • Should the self-test pass draft and closed settle skips, or only superseded?
  • Should "requested" in the run summary mean "decided to request" or "sent"? It is written before fire runs, as it is for every other kind.

Refuted during verification: the settle step's missing summary line after an unexpected exception (no caller can produce one), and the whole-PR fallback for a push with no commit id being lost at runtime (GitHub always sends that id).


Generated by Claude Code

Comment thread steps/verify.py Resolved
Comment thread steps/verify.py Resolved
Comment thread .github/workflows/claude-review.yml Resolved
Comment thread steps/verify.py


def requested_pull_request(decision: str, sent: str, name: str, action: str) -> tuple[int, dict[str, Any]]:
def parsed(text: str) -> Any:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

minor Possible Duplicated Code: the same "json.loads or None" logic is also hand-written at settle.py:51-54, settle.py:89-92, report.py:23-26, lookup.py:59-62 and verify.py:209-212. This PR moved text and summary into helpers.py; parsed could go there too.

Source: mattpocock-skills:code-review, Standards axis · model unknown


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.


Generated by Claude Code

Comment thread steps/settle.py

from helpers import Unreachable, error, github_headers, output, report_summary, send, summary

FAILED = '{"decision":"skip","reason":"settle-check-failed"}'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

minor Possible Duplicated Code: the settle-check-failed literal is also at claude-review.yml:246 and :286, and tests/test_settle.py:270 exists only to keep the three equal. Some copying is unavoidable because a workflow expression cannot import Python, so this is a judgement call.

Source: mattpocock-skills:code-review, Standards axis · model unknown


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.


Generated by Claude Code

Comment thread tests/test_settle.py
}


def compact(value):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

minor Possible Duplicated Code: compact() is copied here and in tests/test_settle_job.py:30, and it already exists in tests/test_report.py:23. Move it into tests/harness.py.

Source: mattpocock-skills:code-review, Standards axis · model unknown


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.


Generated by Claude Code

Comment thread steps/settle.py
decision = json.loads(value)
except ValueError:
decision = None
if not isinstance(decision, dict) or decision.get("decision") != "fire" or decision.get("kind") != "push":

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

minor Possible Repeated Switches: the "fire and kind push" check is also in report.py:44 and in the workflow's settle and fire conditions. The two Python copies could share one helper in helpers.py.

Source: mattpocock-skills:code-review, Standards axis · model unknown


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.


Generated by Claude Code

Comment thread steps/helpers.py
return value if isinstance(value, str) else json.dumps(value)


def summary(decision: dict[str, Any], requested: str = "requested") -> str:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

minor Possible Mysterious Name: requested holds any status phrase, such as report.py:45's "waiting for pushes to settle". A name like status says what it holds.

Source: mattpocock-skills:code-review, Standards axis · model unknown


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.


Generated by Claude Code

Comment thread steps/verify.py Resolved
Comment thread steps/settle.py
Comment on lines +57 to +60
pull_request = decision.get("pull_request")
number = pull_request.get("number") if isinstance(pull_request, dict) else None
if isinstance(number, bool) or not isinstance(number, int) or number < 1:
raise CheckFailed("The Push request names no pull request")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

minor Possible Primitive Obsession: the pull request number is extracted and checked by hand here, at verify.py:169-172 and at helpers.py:69-70. A shared decision parser in helpers.py would remove the copies.

Source: mattpocock-skills:code-review, Standards axis · model unknown


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not changed. This is a judgement call from the Standards pass, not a broken repository standard, and refactoring shared helpers is out of scope for this pull request. It could be a follow-up.


Generated by Claude Code

…e-review-push

# Conflicts:
#	.github/workflows/claude-review.yml
#	.github/workflows/code-review.yml
#	CONTEXT.md
#	README.md
#	examples/claude-review.yml

Copy link
Copy Markdown
Author

integration-test: received push request from https://github.com/cipherstash/workflows/actions/runs/47460205006/attempts/1


Generated by Claude Code

The review of 62dce47 found that the self-test passed any superseded,
draft or closed skip the settle job wrote, so a settle wait that skipped
every push stayed green. The verify step now reads the pull request and
passes only when its head moved on, it is a draft, or it is closed, as
the skip says. A settle job that ran but left no output, such as one
whose runner was lost, now gives the settle-check-failed skip rather
than the decide job's fire.

Refs #53, #50

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Jmn7ojtaMx4z52zJA33Fo

Copy link
Copy Markdown
Author

integration-test: received push request from https://github.com/cipherstash/workflows/actions/runs/47461054909/attempts/1


Generated by Claude Code

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.

2 participants