Repository navigation
ci(security-review): reconcile ci-gate statuses when CI completion delivery is lost - #155392
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 27, 2026, 4:26 PM ET / 20:26 UTC (Revision 10). ClawSweeper reviewWhat this changesAdds a ten-minute Security Review pass that finds completed CI runs with missing, stale, or pending gate statuses, schedules the existing review, and documents and tests that recovery. Merge readiness⛔ Blocked before merge - 8 items remain Current main has no scheduled recovery for lost CI-completion delivery, so this PR remains useful. The new scheduled path can publish a pending gate status after its selected PR closes or moves; final-effect proof and independent SecOps review also remain outstanding. Priority: P2 Review scores
Verification
How this fits togetherSecurity Review turns PR events and CI results into a required commit status. Its resolver selects PR heads, and the review job checks CI and security approvals before publishing the final gate result. flowchart LR
A[Completed CI runs] --> C[Scheduled resolver]
B[PR heads and status history] --> C
C --> D{Review needed?}
D -->|Yes| E[Security review job]
E --> F[Required commit status]
D -->|No| G[Keep settled status]
Decision needed
Why: The protected workflow requires independent code-owner judgment; the PR body's account of team direction is not a recorded approval. Before merge
Findings
Agent review detailsSecurityNeeds attention: The scheduled resolver adds no third-party execution, but its pending status write can outlive the PR authority checked during selection. PR surfaceTests +550, Docs +91, Config +22, Other +187. Total +850 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep reconciliation in the existing Security Review owner, revalidate each selected PR immediately before its status write, and land only with final-effect evidence and independent SecOps approval. Do we have a high-confidence way to reproduce the issue? No deterministic current-main reproduction of a dropped GitHub event is available. The documented stale gate on #155085 and current main's event-only resolver establish the failure path. Is this the best way to solve the issue? The existing Security Review owner is the right place for recovery. The proposed path needs a live-PR check immediately before each new status write. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 000d03942c87. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
…livery is lost Recover lost CI completion deliveries through scheduled and manual trusted reconciliation. Overlap completion windows with the five-minute grace period, use a three-hour creation margin and ten-page warning ceiling, and serialize reconciliation resolvers. Paginate combined statuses before treating a ci-gate context as missing. Preserve main's event filters, checkout recovery, and status loop breaker.
ff465bd to
4dc0a04
Compare
…s and provisional statuses Fail scheduled reconciliation before publishing when the CI listing hits its page ceiling, preserving the last successful window for retries. Keep provisional pending heads eligible until review publishes a settled result or its exact wait status, with CLI regressions and reconciler documentation.
…hout manual dispatch Restrict reconciliation to scheduled events and retry missing, older, or pending gate statuses after CI completion. Slice the twelve-hour recovery window by creation range to stay below GitHub search limits, failing closed on overfull small slices. Document recovery for older reruns and prolonged outages, with entry-point regressions and live read-only API proof.
…nciliation passes Use the newest Actions-owned gate status and reject incomplete or capped CI listings before publishing review work. Select at most 100 oldest PR heads per pass and fail truncated workflows after review so scheduled reconciliation retains its anchor and continues the backlog.
|
Merged via squash.
|
…livery is lost (openclaw#155392) Lost CI-completion deliveries can leave the required ci-gate status pending after CI finishes. Add scheduled reconciliation through the existing trusted Security Review resolver and enforcement job. Preserve overlapping completion windows, reject incomplete listings before publication, keep provisional statuses eligible, and trust only Actions-owned gate statuses. Bound each pass to the oldest 100 heads and retain the successful window anchor while a backlog remains. Reruns whose original creation time predates the three-hour listing margin retain the documented existing recovery path through a push or Security Review rerun. Validation: exact-head CI passed, focused entry-point and workflow regressions passed, and live read-only GitHub transport proof completed. Production scheduled recovery remains post-merge proof.
What Problem This Solves
The required
openclaw/ci-gatecommit status is published by the Security Review workflow. It goespendingonpull_request_targetand is expected to flip when theworkflow_run(CI completed) event arrives. GitHub does not guarantee that delivery. When it is dropped, the status stays stale and the PR cannot reliably reflect its completed CI until another Security Review event arrives.Since #156293, PR title and body edits no longer rerun the guard, so the accidental recovery that unstuck #155085 is gone. A lost delivery now requires a new push, an approval-command comment, or a manual rerun. This PR restores automatic recovery with a small scheduled reconciler inside
security-review.yml, reusing the existing run-to-PR resolver and enforcement job.Every ten minutes, the resolver lists completed pull-request CI runs in a contiguous window and schedules normal Security Review for current PR heads whose gate is missing, older than CI completion, or pending. The existing enforcement script still verifies CI and applicable security approvals before publishing the final status.
Evidence
Observed on #155085 on September 21, 2026 (head
7ff70a1cc297): CI run 35637803422 completed successfully at 18:35:31Z, but no Security Review completion event ran afterward. The required commit status stayed pending until a PR body edit at 19:13:59Z triggered review and recovery. That edit path no longer triggers the guard on main.A September 26 census of 166 PR heads whose CI finished one to eight hours earlier found no currently stuck gate. Over six hours, 766 CI completions produced 792 Security Review completion runs; delivery loss is rare. Completed PR CI runtime over one day was p50 13 minutes, p99 57 minutes, and maximum 119 minutes, supporting the three-hour creation margin.
Design notes
schedule, from default-branch workflow code. Manual Security Review dispatch is removed because a branch-selected dispatch could execute branch workflow code with status-write permission. The event script rejects it before any API request. Existing automatic events, CI release-gate completion handling, andresolve.ifare unchanged./commits/{sha}/statuses, paging until the newest case-insensitiveopenclaw/ci-gateentry fromgithub-actions[bot]with creator typeBotis found. Other publishers are ignored entirely. This uses the same publisher identity trusted by unchangedreadSecurityReviewHistory.f6974fb3550f.truncated=truecauses the permissionlessreconcile-backlogjob to fail after the review jobs finish. That preserves the successful-window anchor; fresh statuses on reviewed heads let the next scheduled pass select the remainder. An untruncated pass emitstruncated=false.Review responses
201total with100/100/0now fails before any POST or matrix output. A listing growing from150to100/100/5succeeds; ten full pages fail closed.openclaw-secopsmember and team maintainer, and the SecOps maintainer directs this landing under the team ruleset exemption. This work order stops after push, CI, and re-review; no merge or admin bypass is authorized.Proof
All focused test commands use
pnpm test <file> --maxWorkers=1:test/scripts/security-review-event.test.tstest/scripts/security-review-workflow.test.tstest/scripts/security-review-script.test.tsThe twelve selected round-4 regression cases failed against the previous implementation (8.40 s wall), then passed after the repair. No new test files or production test hooks were added. Existing subprocess fixtures preserve the real CLI's environment/event routing, API requests, status publication, and matrix output; those contracts explain the event suite's local cost above thirty seconds. The unchanged enforcement suite retains its existing coverage and cost.
Actionlint, the configured zizmor hook,
pnpm check:workflows, scoped oxlint, oxfmt, andgit diff --checkpassed. The backlog job'spermissions: {}passed workflow validation.resolve.ifand the prohibited files remain unchanged. The diff againstf6974fb3550fforguard-shared.mjsandsecurity-review.mjsis empty.Live read-only proof, September 27, 2026, 19:44:52–19:45:32 UTC:
The temporary preload passes every GET's arguments and response unchanged to real fetch and intercepts every non-GET without sending it. Its trace records only method, path with twelve-character SHA prefixes, and HTTP status; summary counters record selection. No current PR was selected, so no selected-head stale-state verification was needed. This proves live listing and Actions-owned status-history transport, not an observed production recovery publication. Recursive splitting and capped backlog behavior are covered by the entry-point regressions.
Autoreview (Codex engine, local candidate against
f6974fb3550f, maximum priority P2) returned scoped-clean, with no accepted/actionable P0–P2 findings. The line-cap ratchet also passed.Round-4 head:
ca8bf2172c33, one new commit on top ofee1928aab9bc; no amend or rebase. Exact-head results are recorded below. No merge or auto-merge is authorized.Round-4 CI and ClawSweeper result
CI run 36346309604 completed success on head
ca8bf2172c33: 63 jobs completed, no failures or pending jobs. The nativeopenclaw/ci-gatecheck run 108698444620 succeeded at 20:12:44 UTC, and the Actions-ownedopenclaw/ci-gatecommit status 55037636894 succeeded at 20:13:25 UTC with “CI and applicable security review requirements passed” (Security Review run 36347188949). No manual CI reruns were needed. The prior head's transient core test-type failures did not recur.The event and workflow suites passed in
checks-node-compact-small-1(job 108696894650); enforcement passed inchecks-node-compact-small-2(job 108696894654). Their measured CI times are in the table above.ClawSweeper automatically started the exact-head review at 20:05:15 UTC and reviewed at 20:09:17 UTC; its published review was updated at 20:10:30 UTC. It reports Findings: None for code and says the prior findings appear resolved, but its overall verdict remains needs-human / blocked, with five checklist items covering two remaining themes:
These requests are reported without another fix or proof round. The coordinator's production-proof and team-exemption decisions remain recorded above. No manual re-review comment was needed. The PR remains open and unmerged, with auto-merge disabled.