Skip to content

fix(ci): preserve Periphery findings after delayed draft events - #138665

Merged
steipete merged 1 commit into
mainfrom
steipete/periphery-publication-admission-20260904
Sep 5, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/periphery-publication-admission-20260904

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Related: #138571 — passive draft events displacing useful ancillary validation; this completes the separately recorded Periphery publication follow-up.

Related: #138572 — merged concurrency-admission repair. Its group-key behavior is preserved, not duplicated here.

Additional instructions

This is a same-repository branch that maintainers can push to.

What Problem This Solves

Resolves a problem where contributors and maintainers can lose useful iOS or macOS Periphery findings after a delayed passive draft event. In the reproduced same-head ordering, a completed ready run with a valid unused-function report is suppressed solely because a passive draft run has a higher run number. The passive callback then replaces existing findings with a draft-or-out-of-scope message even though the live pull request is non-draft.

The ordering is a synthetic feasible counterexample, not recovered webhook attribution or a claim about the cause of a particular production cancellation.

Why This Change Was Made

The source workflows now record a closed publication intent through GitHub's existing run-name / display_title contract: report, explicit draft cleanup, passive draft, or manual. The shared commenter uses that same producer-owned fact for both publication admission and supersession. It no longer reconstructs draft intent from ambiguous job conclusions or treats every newer run as a publisher.

One canonical live-PR predicate checks open state, repository, exact head, and draft state before artifact work and immediately before writing. Explicit converted_to_draft cleanup remains eligible only while the PR is draft. A report-admitted run that successfully detects no native scope still clears stale findings, with a reason that does not falsely claim draft status. Eligible newer runs and attempts still supersede, including pending runs whose admission metadata is available.

This removes undifferentiated newer-run supersession, the ambiguous draft-or-scope cleanup message, and duplicated live-PR validation. A consumer-only skipped-job exception would lose intentional cleanup and still lack the original admission fact. No new job, artifact, dependency, configuration option, runner, permission, or concurrency-group change is introduced. ZIP/report bounds, rendering sanitization, bot ownership, action pins, and comment-write/403 handling are preserved.

User Impact

Useful Periphery findings survive delayed passive draft callbacks for both native apps. Intentional draft and no-scope cleanup still work, and stale-head, newer-attempt, and changed-live-state protections remain intact.

Rollout: runs without recognized admission metadata are logged no-ops and cannot publish or supersede. A new source event after updating the workflow is needed; rerunning an old unmarked run cannot recover its original admission intent. CI documentation explains this boundary and rollout behavior.

Evidence

Red/green publication proof

The original actual embedded commenter reproduction used ready run 201 / number 10, passive run 202 / number 11, an open non-draft same-head PR fixture, fake GitHub APIs, and real ZIP bytes containing a valid Periphery JSON unused-function finding. Before repair, run 201 wrote nothing and run 202 replaced the existing report with the incorrect skip message.

New regressions against unchanged production produced 40 failures / 49 passes. The expanded final commenter/scope suites passed 119 tests, and broader commenter/scope/shared-intersection/test-routing proof passed 571 tests. Red and final totals differ because producer-expression and additional boundary cases were added after the initial red pass.

Integration on current main, including the already-landed concurrency change, passed 281 tests:

node scripts/run-vitest.mjs test/scripts/ios-periphery-comment-workflow.test.ts test/scripts/periphery-scope-workflows.test.ts test/scripts/ancillary-workflow-concurrency.test.ts

The tests execute the actual producer YAML expressions and embedded commenter, exercise both callback orders with shared comment state for iOS and macOS, preserve explicit and delayed draft cleanup, genuine later/pending runs and attempts, exact-head and final live-state validation, scope cleanup, missing metadata, unavailable reports, artifact limits, and token/ownership behavior.

An independent integrity-verified @actions/[email protected] evaluator passed 36 producer-title cases. It was temporary proof tooling, not a new repository dependency. Parsed producer YAML is unchanged apart from run-name; the commenter's permissions, trigger, runner, source guard, and action pin are unchanged. The existing archive parsing/bounds, finding escaping, comment size cap, bot ownership, and write/403 handling were also compared byte-for-byte.

Local gates

Complete changed-scope checks passed, including root test types, script/test lint, formatting, and repository guards:

node scripts/check-changed.mjs -- .github/workflows/ios-periphery-comment.yml .github/workflows/ios-periphery.yml .github/workflows/macos-periphery.yml docs/ci.md test/scripts/ios-periphery-comment-workflow.test.ts

Workflow sanity passed, including actionlint, Zizmor, Git-owner consistency, composite-action interpolation, and conflict markers:

node --import ./scripts/tsx.mjs scripts/check-workflows.mts

git diff --check passed. Fresh independent Codex autoreview of the integrated candidate was scoped-clean through P2. Exact-head hosted CI and the native landing gates are checked before merge.

Proof limits and ownership

The publication-order proof is synthetic and makes zero live GitHub requests. It does not establish historical webhook ordering, GitHub-server execution of the candidate commenter, or globally atomic comment writes. The privileged workflow_run commenter executes its default-branch definition, so the unmerged candidate cannot be exercised there merely by opening this PR; no delayed-webhook injection or manual workflow dispatch is claimed. Automatic PR runs can verify the producer metadata separately.

GitHub documents run-name and its display_title representation, but does not explicitly guarantee immediate populated metadata for queued runs. Unknown titles remain no-ops rather than guessed intent. Final PR revalidation narrows races; separate REST calls remain non-atomic.

Shared OpenClawKit has no consumer in this commenter and is unchanged. No restricted CODEOWNERS path was needed. The pre-existing associated-PR selection is not redesigned: GitHub's run pull_requests array describes matching head/branch associations, not necessarily the triggering PR. Source-bound triggering-PR identity remains a separate investigation; no live wrong-PR publication is asserted here.

Size: operational production workflow YAML +46/−33 (net +13); tests +388/−206 (net +182); docs +6/−2. Production growth supplies the missing cross-workflow admission contract while consolidating repeated validation. Runtime application code, dependencies, and changelog are unchanged.

Record producer publication intent and admit matching runs in the shared iOS/macOS commenter. Preserve useful findings across passive draft callbacks while retaining explicit draft and no-scope cleanup.

Related: #138571 (ancillary validation follow-up), #138572 (merged concurrency admission repair).
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete steipete self-assigned this Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 22:16
@steipete

steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Exact-head pre-land verification for 5a84a4308a0053d04b8e8c6b3b38b9937020a2dd is green.

The shared commenter now uses producer-recorded intent for both admission and supersession, then revalidates the live PR before writing. The original synthetic ordering is repaired for both iOS and macOS: ready run 201 publishes its useful finding, and later passive run 202 neither supersedes it nor erases the comment. Explicit draft cleanup, real scope loss, newer eligible runs/attempts, and artifact/permission boundaries remain protected. Operational production delta is +46/−33 (net +13), supplying the missing cross-workflow fact while consolidating validation; tests are +388/−206.

Hosted proof at this head:

  • Main CI 33924804106 succeeded, including the required Actions-owned openclaw/ci-gate.
  • macOS Periphery 33924804051 succeeded.
  • iOS Periphery 33924804972, attempt 2 succeeded. Attempt 1 was deliberately canceled only after confirming the scan was queued on Blacksmith with runner_id=0 and no executed steps. The failed-job retry acquired the existing macos-26 route. This was capacity recovery, not a draft-event collision; no runner expression, source file, timeout, or workflow-dispatch input changed.
  • Automatic draft-origin runs iOS 33924662524 and macOS 33924662426 recorded [passive]. The ready runs recorded [report], retained on the iOS retry. This verifies the producer metadata on GitHub separately from the synthetic callback-order proof.

Local integrated proof: 281 tests passed, including the landed concurrency regressions. Original red proof was 40 failures/49 passes; expanded commenter/scope proof was 119 passes, with broader 571-test routing/sibling coverage and 36 official expression-evaluator cases. Fresh independent Codex autoreview was scoped-clean through P2. Complete changed checks, workflow sanity, and whitespace validation passed.

node scripts/run-vitest.mjs test/scripts/ios-periphery-comment-workflow.test.ts test/scripts/periphery-scope-workflows.test.ts test/scripts/ancillary-workflow-concurrency.test.ts
node scripts/check-changed.mjs -- .github/workflows/ios-periphery-comment.yml .github/workflows/ios-periphery.yml .github/workflows/macos-periphery.yml docs/ci.md test/scripts/ios-periphery-comment-workflow.test.ts
node --import ./scripts/tsx.mjs scripts/check-workflows.mts

Proof limits remain explicit: the delayed ordering is synthetic, not observed webhook attribution; the unmerged privileged commenter cannot execute as the default-branch workflow. Unrecognized historical/transient titles are no-ops, and REST revalidation/write is not atomic. The existing first-associated-PR selection remains a separate investigation. Native review artifacts are validated for this exact head. ClawSweeper has now published its exact-head review; its merge-risk items are addressed below. No review or CI enforcement bypass is requested.

Published ClawSweeper review: risk resolution

Reviewed the completed exact-head ClawSweeper review. It reports no correctness or security findings and recommends retaining the producer-owned design. Its three merge-risk items are addressed as follows; no code change or review-enforcement bypass is needed.

  1. Historical-run rollout: use the review's recommended documented cutoff. Old runs lack the fact needed to distinguish passive draft admission from intentional cleanup, so they remain logged no-ops. A fresh source event is the supported recovery path; rerunning an old unmarked run does not recreate the missing intent. This intentional operational tradeoff is documented in the PR and CI guide, not hidden behind a compatibility guess.
  2. Queued title observation: the retained live API snapshot captured at 2026-09-04T22:18:26Z showed the exact-head iOS report run with status: queued and the expected title, before it acquired a runner. The relevant fields are reproduced below. This is an observed API-queued state, not proof of GitHub's internal concurrency pending slot or a universal zero-latency guarantee. Missing/transient metadata deliberately remains ineligible to suppress useful findings rather than guessing its intent; that boundary is accepted and documented.
  3. Reviewer network limitation: maintainer-side verification successfully reread GitHub's run-name documentation, the official REST schema, and both exact-head run API records. The schema describes display_title as the event-specific title or the configured run-name; the workflow docs permit github/inputs expressions. Neither is represented as an immediate-availability promise. Current readback confirms both report runs succeeded and the iOS attempt-2 title remains unchanged. This supplies independent platform/readback evidence without altering the reviewer's network restrictions or overstating synthetic callback proof.
{
  "id": 33924804972,
  "head_sha": "5a84a4308a0053d04b8e8c6b3b38b9937020a2dd",
  "run_attempt": 1,
  "status": "queued",
  "display_title": "iOS Periphery Dead Code [report]"
}

The required CI gate remains green at the reviewed/prepared head. The completed bot review now satisfies the native completion-receipt guard; normal native merge checks will be revalidated before any merge.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 7:54 PM ET / 23:54 UTC.

ClawSweeper review

What this changes

Records why each iOS or macOS dead-code workflow started, then uses that information to prevent delayed passive draft runs from suppressing or replacing useful PR findings.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful, distinct publication fix: current main and v2026.9.1 retain the faulty supersession path, while the earlier merged concurrency repair explicitly excluded it. No introduced blocking correctness or security defect was found.

Priority: P2
Reviewed head: 5a84a4308a0053d04b8e8c6b3b38b9937020a2dd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with useful two-platform regressions, preserved security controls, and an explicitly documented rollout tradeoff.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. Supplied hosted evidence covers producer passive/report titles and retry retention; the changed commenter’s callback ordering is covered by synthetic production-script tests, with live default-branch execution explicitly unclaimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. Supplied hosted evidence covers producer passive/report titles and retry retention; the changed commenter’s callback ordering is covered by synthetic production-script tests, with live default-branch execution explicitly unclaimed.
Evidence reviewed 13 items Pinned introduction and checkout: The checkout matches the pinned original head. The merge-base-to-head delta contains the two producers, shared commenter, CI documentation, and commenter tests; unrelated endpoint drift was excluded from review. Repository ownership was verified from origin.
Current-main defect remains: Current main suppresses an older result whenever a same-PR, same-head run has a higher run number or attempt, without checking publication intent. Its successful-scope/skipped-scan path also cannot distinguish passive draft events from genuine scope loss.
Release comparison: The commenter at the supplied v2026.9.1 release commit is byte-identical to the fetched-main commenter. That release therefore does not contain this publication repair; this is repository automation rather than installed application behavior.
Findings None None.
Security None None.

How this fits together

The native dead-code workflows produce scan artifacts, and a separate GitHub Actions workflow publishes their findings as PR comments. The change connects producer event intent to comment publication while checking the PR’s current head and draft state.

flowchart TD
  A[PR event] --> B[Native scan workflow]
  B --> C[Recorded publication intent]
  B --> D[Scan report artifact]
  C --> E[Comment publication checks]
  D --> E
  F[Live PR and newer eligible runs] --> E
  E --> G[Update findings or cleanup comment]
  E --> H[Logged no-op]
Loading

Before merge

  • Resolve merge risk (P1) - Rollout deliberately stops historical unmarked runs from refreshing Periphery comments; affected PRs need a fresh source event, and rerunning an old run will not restore publication.
  • Resolve merge risk (P1) - Queued-run title availability is not established by the supplied hosted observations; a newer run with missing metadata cannot suppress an older admitted report.
  • Resolve merge risk (P1) - Reviewer-side network failures prevented independent rereading of GitHub’s platform contract and hosted run metadata; the supplied evidence was preserved without treating this as a contributor proof failure.
Agent review details

Security

None.

PR surface

Tests +182, Docs +4, Config +13. Total +199 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 388 206 +182
Docs 1 6 2 +4
Config 3 46 33 +13
Generated 0 0 0 0
Other 0 0 0 0
Total 5 440 241 +199

Review metrics

Metric Value Why it matters
Production versus test growth Operational production net +13; application runtime 0; tests net +182; docs net +4 The production growth establishes the missing cross-workflow fact while consolidating repeated validation; test growth expands shared ordering and boundary coverage.
Publication metadata contract 2 producer run-name fields added; 4 intent values; 2 publish-eligible values Both producers and the shared consumer must roll out together, while historical unmarked runs become intentional no-ops.

Merge-risk options

Maintainer options:

  1. Use the documented metadata rollout (recommended)
    Accept the maintainer-described cutoff for unmarked historical runs and use a fresh source event for affected PRs rather than guessing their original intent.

Technical review

Best possible solution:

Keep producer-recorded intent and one shared live-PR predicate with the documented fresh-event rollout; the small workflow growth supplies information that ambiguous job conclusions cannot recover.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: a same-head ready report followed by a higher-numbered passive draft run reaches both faulty main-branch paths. The supplied red/green results and inspected shared-state regressions support that synthetic ordering; this review did not execute it.

Is this the best way to solve the issue?

Yes. Recording intent at the producers repairs the information loss, and the consumer reuses it for admission and supersession without duplicating the already-merged concurrency fix; the historical-run cutoff is explicit rather than hidden behind a fallback.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c7dc2c68e246.

Labels

Label changes:

  • add P2: This repairs lost or misleading native-code review feedback with a limited repository-automation blast radius.
  • add merge-risk: 🚨 automation: The commenter now requires producer metadata, so historical runs stop publishing and missing queued metadata changes supersession behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. Supplied hosted evidence covers producer passive/report titles and retry retention; the changed commenter’s callback ordering is covered by synthetic production-script tests, with live default-branch execution explicitly unclaimed.

Label justifications:

  • P2: This repairs lost or misleading native-code review feedback with a limited repository-automation blast radius.
  • merge-risk: 🚨 automation: The commenter now requires producer metadata, so historical runs stop publishing and missing queued metadata changes supersession behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. Supplied hosted evidence covers producer passive/report titles and retry retention; the changed commenter’s callback ordering is covered by synthetic production-script tests, with live default-branch execution explicitly unclaimed.

Evidence

What I checked:

  • Pinned introduction and checkout: The checkout matches the pinned original head. The merge-base-to-head delta contains the two producers, shared commenter, CI documentation, and commenter tests; unrelated endpoint drift was excluded from review. Repository ownership was verified from origin. (5a84a4308a00)
  • Current-main defect remains: Current main suppresses an older result whenever a same-PR, same-head run has a higher run number or attempt, without checking publication intent. Its successful-scope/skipped-scan path also cannot distinguish passive draft events from genuine scope loss. (.github/workflows/ios-periphery-comment.yml:480, c7dc2c68e246)
  • Release comparison: The commenter at the supplied v2026.9.1 release commit is byte-identical to the fetched-main commenter. That release therefore does not contain this publication repair; this is repository automation rather than installed application behavior. (.github/workflows/ios-periphery-comment.yml:480, ad6fe23aecb9)
  • Producer boundary and dependency signal: Both native producers add the same closed run-name expression for report, draft, passive, and manual intent. This directly depends on GitHub Actions expression and workflow-run metadata contracts, not Codex runtime or protocol behavior. Existing triggers, concurrency, runner selection, and scan execution remain unchanged. (.github/workflows/ios-periphery.yml:4, 5a84a4308a00)
  • Publication owner and final effect: The shared commenter admits only recognized report/draft titles, checks live repository/head/state/draft status, restricts supersession to matching intent, and repeats the live predicate after report/comment/run reads immediately before the existing comment-write path. (.github/workflows/ios-periphery-comment.yml:84, 5a84a4308a00)
  • Original ordering and sibling regression coverage: The tests execute the embedded production commenter and producer expressions. Both iOS and macOS cases share comment state across ready-then-passive and passive-then-ready callbacks, and cover explicit draft cleanup, scope loss, newer eligible runs/attempts, missing metadata, and final live-state changes. GitHub transport calls are mocked; these tests were inspected, not executed during this review. (test/scripts/ios-periphery-comment-workflow.test.ts:869, 5a84a4308a00)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit f2ef967 into main Sep 5, 2026
192 of 193 checks passed
@steipete
steipete deleted the steipete/periphery-publication-admission-20260904 branch September 5, 2026 00:17
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…claw#138665)

Record producer publication intent and admit matching runs in the shared iOS/macOS commenter. Preserve useful findings across passive draft callbacks while retaining explicit draft and no-scope cleanup.

Related: openclaw#138571 (ancillary validation follow-up), openclaw#138572 (merged concurrency admission repair).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant