Repository navigation
feat(source-control): add the unattended merge policy readers - #7324
Conversation
…ugin Register lib/parse-concern-value.sh and lib/yaml-subset.awk as copies under plugins/source-control/lib/ so the babysit merge policy can parse docs/conventions/pr-pipeline.yaml with the repository's one YAML reader. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fill babysit_merge_policy.py with the readers the unattended merge path needs, each failing closed: read_config_at (contents API at the base SHA, shared YAML reader with --strict, exit 3 is off), effective_rung, read_kill_switch, read_rung_cap, is_human, read_demotion, resolve_identity, eligibility (with the lane-claim rule) and in_flight. The Python caller resolves bash by lib/exec-bash.mjs's Windows rules. assess() composes them and always returns an inert policy naming the first refusing reader. resolve() stays the inert stub: the existing test pins it to no network, so wiring it waits on that test changing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drive babysit_merge.py --merge end to end with the token acting as the configured merge.agent-identity, read from a real pipeline file through read_config_at and the shared YAML reader over a faked gh transport: it exits 10 before evaluating or writing. resolve is pointed at assess, so the test holds before and after the two are wired. Also state the self_logins contract: callers pass only lane or bot self identities, each treated as non-human per the Design. Co-Authored-By: Claude Opus 5.5 <[email protected]>
resolve() now returns assess(repo): the pipeline config at the default branch head, then the identity, kill switch, rung, demotion and in-flight readers. Every outcome is still inert, and the reason names the first refusing reader. A plain --merge now refuses the agent identity's token from the configured merge.agent-identity. The inert-stub test becomes a fake-backed one (no merge block gives authority-unconfigured, with no real gh call). The main() harnesses in the merge, async and rate-limit suites patch resolve to an inert policy, and engine.test.sh runs its --unattended --merge check with a failing gh first on PATH, so it stays network-free. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Demotion: only the earliest revision stamped at createdAt, with a named author and editor of the same login, is the original body; any other revision, including a second one at createdAt or one with a null author or editor, is judged as an edit. - Claim: a lease comment counts only when the identity's App posted it (comment user is a Bot with the identity's login). - In flight: read merged pull requests page by page until one predates the merged-since floor or the history ends; a history longer than the read bound is not clear. - Tests: the role-label test now asserts no query reads labels; fixtures name the REST timeline actor shape and the createdBy [bot] spelling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…times - in_flight with no merged_since floor is not clear (merged-since-unset) and reads nothing; assess passes no floor yet, so it reports that. - Only a boolean hasNextPage of false ends a paginated read, in both the merged-PR and the demotion-record listings; anything else is unreadable. - A timestamp without an offset raises PolicyReadError, so the demotion, eligibility and in-flight readers return their hold reasons instead of crashing on a naive-versus-aware comparison. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aders A truncated demotion edit history now holds the rung off instead of hiding the record; a non-count max-changed-lines and any value carrying a control or line-separator character read as off; the permission reader is built once per call; and the docs no longer claim resolve() makes no network read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 6m 0s —— View job Claude's review
This repo runs a dedicated security lane ( Scope reviewed: This is a careful, well-tested implementation — the fail-closed discipline is consistent throughout, and several subtle GraphQL quirks (bot login spelling in Finding posted inline ( No security, authorization, or secrets-handling findings — those are scoped to the security lane. claude-lane-summary: lane=claude-review sha=803a1d4921e173f4c1f98dd1bafec9cf63dfaa3e run=38291957487 |
|
Claude finished @kyle-sexton's task in 5m 53s —— View job Security review complete
Reviewed the full diff against One finding posted inline:
claude-lane-summary: lane=claude-security-review sha=803a1d4921e173f4c1f98dd1bafec9cf63dfaa3e run=38291957593 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 803a1d4921
ℹ️ 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".
|
claude-review has reviewed this pull request through f043803; a later push is reviewed from there. |
|
claude-security-review has reviewed this pull request through f043803; a later push is reviewed from there. |
… default branch assess() now refuses a pull request whose work class is above the effective rung (C4 and C5 never pass), hands in_flight() the repository's default branch instead of "main", and the demotion candidate walk stops at ten pages, holding the rung off past it. The Windows PATH fixture uses the <user> placeholder the machine-path check asks for, and the separator pattern keeps its escapes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Claude finished @kyle-sexton's task in 2m 4s —— View job Security review complete
Scope: incremental — only the diff since This diff closes the two findings raised against
No new security issue in this diff: the new ceiling check reads only code-defined constants and a value claude-lane-summary: lane=claude-security-review sha=f04380397d765215a6cc2771de325f6a5cb8a6fe run=38293335675 |
|
Claude finished @kyle-sexton's task in 2m 15s —— View job Reviewing PR #7324 (incremental)
Scope reviewed: the incremental diff since this lane's last review ( This diff closes all three findings raised in this PR's previous review round, cleanly and with tests:
Also noted: a drive-by fix to No new findings. The fail-closed discipline is consistent with the rest of the module, and each fix has a direct regression test. claude-lane-summary: lane=claude-review sha=f04380397d765215a6cc2771de325f6a5cb8a6fe run=38293335529 |
Refs: #6202
Summary
Phase 8 of the auto-merge-safe-prs plan.
babysit_merge_policy.pygains the readers that decide whether an unattended merge could run, andresolve()now uses them. Every result is still inert (enabled=false): no merge path is connected until a later phase.Fix
read_config_at(contents API at a SHA, strict parse, unreadable -> refuse),effective_rung(min of four inputs, unknown -> off),read_kill_switch,read_rung_cap(read only),is_human,read_demotion,resolve_identity,eligibility(incl. the claim rule),in_flight.assess()names the first refusing reader in the inert reason.--mergerefuses (exit 10) when the acting login is the configuredmerge.agent-identityor the policy config cannot be read; tested end to end from a real config fixture.lib/exec-bash.mjs's Windows rules (never System32, Sysnative or WindowsApps).parse-concern-value.shandyaml-subset.awkregistered as shared copies.main()test harnesses gain one inertresolvepatcher insetUp(no assertion changed);engine.test.shkeeps its unreadable-policy check network-free with a failingghon PATH.Verification
uvx --from pytest==9.1.1 pytest -q plugins/source-control/skills/babysit-prs/scripts/tests: 1061 passed (also withghoff PATH);engine.test.sh: 12 PASS;bash scripts/sync-shared-copies.sh --check: 461 match.Related
--unattended, Phase 6), feat(source-control): add the babysit diff risk scorer #7321 (risk scorer, Phase 7)🤖 Generated with Claude Code