Repository navigation
fix(apply): batch exact publication labels - #1085
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 4:35 PM ET / 20:35 UTC. ClawSweeper reviewWhat this changesThe PR batches exact-apply GitHub label changes and caches label definitions while preserving guarded fallback, comment, and close ordering. Merge readinessKeep open. This is a distinct, current automation fix not present on main; the final head has no supported actionable correctness finding and includes substantial real-behavior proof, so it merits normal maintainer review. Priority: P2 Review scores
Verification
How this fits togetherClawSweeper’s apply lane publishes reviewed outcomes to GitHub through labels, durable review comments, and eligible closes. The changed path collects an item’s exact-event label mutations, publishes them, then refreshes guards before later durable mutations. flowchart LR
ReviewedReport[Reviewed report] --> ExactApply[Exact apply lane]
ExactApply --> LabelBatch[Collected label changes]
LabelBatch --> GitHubLabels[GitHub label publication]
GitHubLabels --> FreshGuard[Freshness guard]
FreshGuard --> DurableComment[Durable review comment]
DurableComment --> CloseGate[Eligible close gate]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the guarded exact-event batching design and land it only after maintainers accept the bounded automation-ordering risk supported by the supplied fault-path proof. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible: current main performs individual label edits, while the PR’s exact-head fixture and endpoint proof exercise the batched publication and partial-failure paths. Is this the best way to solve the issue? Yes. Restricting batching to exact-event publication while preserving ordinary immediate behavior and fresh guards is the narrowest maintainable correction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 80847d16452c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
Summary
gh issue editProblem
Exact review publication accumulated the desired final label state in memory but emitted repository-label discovery/creation and item-label mutations one operation at a time. Under publication backlog this multiplied GitHub API/GraphQL cost and contributed to quota backoff even though the state writer itself was healthy.
The narrow correction is at exact-event label publication. It does not change review admission, scheduling, review execution, durable comment publication, queue schemas, workflow cadence, or GitHub credentials.
Implementation
gh label list --limit 1000 --json name,color,descriptiononce per apply process; skip matching definitions, create missing definitions, and repair managed definitions only when their color/description differs.labels_synced_atadvances only after a confirmed common-path or fallback success.labels_synced_atonly from an actual published item-label mutation, so discarded batches and runtime yields cannot claim an unpublished sync.clawsweeper-recovery-stuck, publish the durable review comment first, queue recovery-label removal into the still-single exact label batch, then flush before placeholder cleanup. Treat that ClawSweeper-owned recovery label as source-revision-neutral so its removal cannot invalidate ClawSweeper's own mutation lease.Validation
Local Windows proof:
Observed: build and lint clean; 13/13 batching unit scenarios, 2/2 focused exact-publication integration scenarios, and six focused guard/restoration/source-ordering scenarios passed. The no-mutation regression proves a rejected combined optional-only command plus rejected fallback returns
itemMutationPublished=falseand cannot setlabels_synced_at. The close fixture proves recovery-label removal joins the one exact item-label edit and fresh item guards separate durable-comment publication, label publication, superseded-placeholder cleanup, and close.Codex review closeout:
codex review --uncommitted: accepted findings for per-fallback freshness, optional definition failure handling, possible partial mutation receipts, blocked-close report restoration, required-before-optional capacity recovery, post-fallback durable-comment reconciliation, fresh guards after the label batch, same-author skip restoration, and recovery cleanup ordering; each fix received focused regression coverage and a clean dirty-patch rerun.codex review --base origin/main: final committed range at1cfa23d3f84b0e3cd01bfe3e6eddd3908a362565reported no actionable regressions; focused coverage includes fallback, discard, freshness-guard, recovery-label, and uncertain-receipt scenarios.Real Behavior Proof
Claim: Exact-event publication emits one deterministic combined item-label command on the common path, avoids repeated repository-label catalog reads/writes, and retains fresh mutation guards and recoverable optional-label behavior at every durable boundary.
Exercised surface: The production apply workflow, label selection/mutation operations, mutation runner/receipt handling, durable report reconciliation, comment boundary, and close boundary were built and executed from the exact pushed commit in a clean Linux environment.
Scenario/fixture: Deterministic GitHub CLI fixtures exercised:
labels_synced_atbefore persistenceEnvironment: Crabbox provider
local-container, targetlinux, Docker29.5.2, imagemcr.microsoft.com/playwright:v1.60.0-noble; leasecbx_018a9b10e931(swift-shrimp); head1cfa23d3f84b0e3cd01bfe3e6eddd3908a362565.Command: Fresh checkout of PR #1085, assert
git rev-parse HEADequals the exact SHA above,pnpm install --frozen-lockfile,pnpm run build:all, all 13test/label-mutation-batch.test.tsscenarios, the two exact-publication scenarios, the blocked-close invariant, the same-author restoration scenario, the bound precomputed-proof scenario, and three source/placeholder/recovery-ordering scenarios.Observed result: Exit 0. Frozen install and all TypeScript builds succeeded; all 21 targeted scenarios passed. The new no-mutation scenario kept the confirmed receipt and
labels_synced_atabsent while retaining a possible-mutation freshness receipt. The recovery close flow published the durable comment, performed one combined item-label edit including recovery-label removal, refreshed the guard, deleted the superseded placeholder, and closed. Metadata-only fallback reconciled the durable comment to the actually published labels; blocked and same-author exits restored staged state; bound proof canonicalization and source-revision ownership checks passed. The lease was auto-released.Artifact/trace: Crabbox timing receipt for local-container lease
cbx_018a9b10e931: sync 10.141s, command 29.225s, total 39.366s, exit 0,leaseStopped=true.Live GitHub endpoint proof
The built production
createLabelMutationOperationsimplementation was then exercised through the real authenticatedghbinary against two disposable issues in a user-owned private synthetic ClawSweeper E2E repository. The repository and issue URLs are redacted here; both issues were closed as completed afterward and retain their audit comments and final labels.This live run exposed GitHub's real partial-mutation behavior during development: the combined command can apply removals before returning nonzero for a missing optional addition. The live endpoint exercise at
d73d458destablishes that external behavior. The final implementation separates that uncertain post-error observation from confirmed publication: it refreshes freshness receipts before fallback but advanceslabels_synced_atonly after a confirmed success. The exact-final-head Crabbox run exercised that distinction plus durable-comment reconciliation, skip restoration, recovery cleanup, source-revision classification, and guard refresh.Limits: The Crabbox proof executes the full production exact-apply path against deterministic GitHub CLI fixtures. The live endpoint proof executes the built production label-mutation module and real
gh/GitHub API boundary, not a production queue or workflow dispatch. "One combined command" describes ClawSweeper's common-path invocation;ghmay implement add/remove using more than one underlying HTTP request. The exceptional optional-label recovery path intentionally uses multiple guarded commands.OpenClaw Bay impact
OpenClaw Bay is unaffected; no Bay change or Bay-specific proof is needed. This PR changes only how the internal exact-apply lane groups GitHub item-label commands and records their mutation certainty. It does not change dashboard files,
/api/status, Bay's live-activity or durable-lifecycle contracts, workflow job/lane names, action-event schemas, queue state, terminal outcomes, recent-close inputs, or webhook journey triggers/completions. Bay remains a read-only observer of the same cache-backed workflow-job and terminal evidence; it neither consumeslabels_synced_atnor interprets individual label-edit command count.Risks / rollout
Links