Skip to content

draft: optional exact-review background-yield experiment - #542

Closed
brokemac79 wants to merge 8 commits into
openclaw:mainfrom
brokemac79:codex/csw-037-adaptive-review-priority
Closed

brokemac79 wants to merge 8 commits into
openclaw:mainfrom
brokemac79:codex/csw-037-adaptive-review-priority

Conversation

@brokemac79

@brokemac79 brokemac79 commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Status

Draft — do not merge or enable yet. This is an optional scheduler experiment,
not the production repair for the exact-review backlog incident.

Relationship to the incident work

  • #545 is the deployed
    recovery work: it increased exact-review admission/recovery capacity and
    reconciles completion pressure. This branch is rebased on current main,
    which includes that PR.
  • Current incident evidence showed leases being held after useful review work
    while state/action-ledger publication and lease completion were blocked. This
    PR does not repair that state-publication path and cannot create another
    exact-review slot.
  • Current main also includes the rollback of feat(ledger): record ClawSweeper action lifecycles #521's action-lifecycle
    expansion. This branch preserves that rollback rather than restoring it.

Proposed optional behavior

The experiment is disabled unless a maintainer explicitly sets this repository
variable to exactly 1:

CLAWSWEEPER_ENABLE_EXACT_REVIEW_BACKGROUND_YIELD=1

With the variable unset, the changed planners retain their ordinary
per-target/independent admission groups, do not fetch exact-review pressure,
and pass idle pressure to the scheduler. Exact-item planners remain
independently admitted.

With the variable enabled, healthy, fresh exact-review telemetry can reduce
broad background review allowance to the configured 16/4 caps while the
exact-review lane is full and has admissible pending work. Missing, malformed,
or stale telemetry fails open. Continuations are admitted again and re-evaluate
the cap; background target-sweep fanouts preserve per-target planner grouping.

The supporting limits, dashboard telemetry, and tests are included so a future
controlled rollout can measure that policy. No variable, gate, or production
workflow setting is changed by this PR.

Non-goals

  • It does not raise the exact-review global cap (64) or per-target cap (60).
  • It does not fix state-ledger contention, post-review publication, or stuck
    lease completion.
  • It does not claim that yielding broad work alone drains the current backlog.

Rollout decision

Keep this PR draft. Before considering a limited maintainer-owned trial, agree
the policy values and collect runtime evidence for: fresh-pressure throttling,
stale-telemetry fail-open behavior, bounded deferral/requeue, automatic broad
work resumption, exact backlog slope, and publish-to-lease-completion latency.
Do not enable the variable as part of this PR.

Validation

  • node --test --test-name-pattern "sweep review continuations reapply|background review schedulers yield|background-yield admission" test/sweep-workflow.test.ts — 3 passed.
  • node --test test/repair/workflow-utils.test.ts test/dashboard-worker.test.ts — 155 passed.
  • pnpm check:limits and git diff --check origin/main...HEAD — passed.
  • pnpm run check completed active-surface, limits, build, and lint. Its unit
    stage is not runnable on this Windows host because the default WSL image has
    no /bin/bash; a raw Linux Node 24 container reached the same stage but lacks
    jq required by unrelated shell-fixture tests. No platform or line-ending
    change is included here.
  • codex review --uncommitted — final clean after accepting and fixing the
    target-fanout admission finding.
  • codex review --base origin/main — clean: no actionable correctness issues.

actionlint was not installed in the local environment; workflow syntax and
the static workflow assertions above were exercised instead.

@brokemac79
brokemac79 requested a review from a team as a code owner July 13, 2026 22:53
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 13, 2026
@clawsweeper

clawsweeper Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 14, 2026, 6:55 AM ET / 10:55 UTC.

Summary
Adds a default-off repository-variable experiment that reads exact-review pressure, caps broad sweep and commit-review scheduling under congestion, exposes supporting telemetry, and updates limits documentation and tests.

Reproducibility: not applicable. This PR proposes an optional scheduling mode rather than reproducing a current-main bug, and it explicitly distinguishes itself from the incident fixed by #545.

Review metrics: 3 noteworthy metrics.

  • Patch scope: 12 files, +1,114/-83. The experiment spans workflows, runtime limits, dashboard status, documentation, and tests rather than being a small isolated scheduler tweak.
  • Workflow surface: 2 production workflows changed. Both sweep planning and commit-review planning can join the shared admission group when the experiment is enabled.
  • Activation surface: 1 new repository variable; default off. Normal behavior is intended to remain unchanged until a maintainer explicitly enables the experiment.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted controlled Actions evidence covering throttling, stale telemetry, bounded deferral, automatic resumption, and completion latency.
  • Resolve the telemetry overlap with feat(dashboard): expose exact-review pressure telemetry #555 and record the maintainer-approved trial thresholds and rollback criteria.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Only tests and static checks are provided; before merge, add redacted controlled-run logs or live output showing fresh-pressure throttling, stale fail-open behavior, bounded deferral, and broad-work resumption, then update the PR body to trigger a fresh review or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] Enabling the variable would serialize broad sweep and commit-review planners through one shared admission group and can materially delay background work if pressure classification or the 16/4 thresholds are wrong.
  • [P1] The supplied tests do not establish production behavior for fresh-pressure throttling, stale-telemetry fail-open handling, bounded queueing, resumption, or publish-to-lease-completion latency.
  • [P1] The telemetry portion overlaps feat(dashboard): expose exact-review pressure telemetry #555; merging both branches unchanged could create duplicate implementations and future maintenance drift.

Maintainer options:

  1. Split telemetry and prove the scheduler trial (recommended)
    Remove the telemetry overlap after feat(dashboard): expose exact-review pressure telemetry #555 is resolved, then provide controlled redacted runtime evidence for throttling, fail-open behavior, deferral, and resumption before merge.
  2. Accept an explicitly owned experiment
    A maintainer may merge the default-off policy while accepting that activation remains an operator-owned experiment without established production behavior.
  3. Pause the scheduler policy
    Keep only the observation surface and close or defer this branch if the operational benefit does not justify cross-workflow scheduling complexity.

Next step before merge

  • [P1] A maintainer must first choose whether to sponsor cross-workflow background throttling and define the trial's thresholds, metrics, and rollback conditions; contributor-side automation cannot supply that operational decision or live proof.

Maintainer decision needed

  • Question: Should ClawSweeper adopt an opt-in policy that reduces broad review capacity when the exact-review queue is saturated, and if so, what thresholds and rollback conditions govern the trial?
  • Rationale: Tests can verify the implementation mechanics, but only maintainers can choose whether cross-workflow background throttling matches operational priorities and define acceptable backlog, latency, and starvation tradeoffs.
  • Likely owner: steipete — They authored the merged exact-review incident recovery and are best positioned to judge whether an additional scheduling policy is operationally warranted.
  • Options:
    • Sponsor a staged trial (recommended): Land telemetry first, narrow this branch to scheduler policy, and run a default-off trial with explicit 16/4 threshold justification, success metrics, and rollback conditions.
    • Keep telemetry only: Proceed with feat(dashboard): expose exact-review pressure telemetry #555 and close the scheduler experiment unless later production evidence demonstrates a need for adaptive yielding.
    • Defer the experiment: Leave this PR draft until a future backlog event provides a controlled test window and an agreed operational owner.

Security
Cleared: The automation-sensitive diff adds no third-party action source, dependency, permission, secret-access expansion, or executable download path; the remaining concern is operational scheduling risk rather than a concrete security regression.

Review details

Best possible solution:

Land or evaluate the observation-only telemetry separately through #555, then keep any scheduler experiment narrowly default-off and require a maintainer-defined controlled trial with thresholds, success metrics, rollback criteria, and redacted live Actions evidence.

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

Not applicable: this PR proposes an optional scheduling mode rather than reproducing a current-main bug, and it explicitly distinguishes itself from the incident fixed by #545.

Is this the best way to solve the issue?

Unclear pending product direction: the implementation is plausibly narrow and default-off, but observation-only telemetry should remain separate and the cross-workflow policy needs controlled runtime proof before it can be considered the best solution.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P3: This is a speculative, default-off scheduler experiment rather than an active production regression repair.
  • merge-risk: 🚨 automation: Activation changes admission and capacity behavior across sweep and commit-review workflows, with potential background-work delay that green CI cannot settle.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only tests and static checks are provided; before merge, add redacted controlled-run logs or live output showing fresh-pressure throttling, stale fail-open behavior, bounded deferral, and broad-work resumption, then update the PR body to trigger a fresh review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

What I checked:

Likely related people:

  • steipete: Authored the merged exact-review throughput and completion-recovery work in fix: exact-review backlog stalls during completion bursts #545, making them the strongest available owner for operational scheduler policy and rollout conditions. (role: recent incident-recovery author; confidence: high; commits: 2071755d7464; files: .github/workflows/sweep.yml, dashboard/worker.ts, config/automation-limits.json)
  • vincentkoc: Authored merged action-lifecycle work and the related telemetry-only extraction in feat(dashboard): expose exact-review pressure telemetry #555, connecting them to the queue-status and observability boundary. (role: adjacent automation and telemetry contributor; confidence: medium; commits: b30773af54b4, 77cb51ad8558; files: dashboard/worker.ts, docs/live-dashboard.md, test/dashboard-worker.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (6 earlier review cycles)
  • reviewed 2026-07-13T22:58:28.078Z sha d05ff08 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-13T23:19:42.159Z sha d05ff08 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-14T01:28:22.548Z sha a9c28bb :: needs real behavior proof before merge. :: [P1] Reject stale queue snapshots before applying caps
  • reviewed 2026-07-14T02:07:16.582Z sha 7561615 :: needs real behavior proof before merge. :: [P1] Apply the pressure cap to continuation scheduling
  • reviewed 2026-07-14T09:30:17.467Z sha 07ead33 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-14T10:33:22.323Z sha 5e78721 :: needs real behavior proof before merge. :: none

@brokemac79
brokemac79 force-pushed the codex/csw-037-adaptive-review-priority branch 2 times, most recently from d15930f to a9c28bb Compare July 14, 2026 01:06
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 14, 2026
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@brokemac79
brokemac79 force-pushed the codex/csw-037-adaptive-review-priority branch 2 times, most recently from 7b30afc to 07ead33 Compare July 14, 2026 07:50
@brokemac79
brokemac79 marked this pull request as draft July 14, 2026 09:36
@brokemac79
brokemac79 force-pushed the codex/csw-037-adaptive-review-priority branch from 07ead33 to 5e78721 Compare July 14, 2026 10:22
@brokemac79 brokemac79 changed the title feat(scheduler): prioritize exact-review backlog draft: optional exact-review background-yield experiment Jul 14, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. P2 Normal priority bug or improvement with limited blast radius. labels Jul 14, 2026
@brokemac79 brokemac79 closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant