Repository navigation
fix(scheduler): count active runs by workflow path - #393
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 5:24 PM ET / 21:24 UTC. Summary Reproducibility: yes. at source/API level: current main compares REST Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the path-based active-run accounting with its focused tests after redacted live Actions proof shows the fixed scheduler behavior under the affected overlap path. Do we have a high-confidence way to reproduce the issue? Yes at source/API level: current main compares REST Is this the best way to solve the issue? Yes for the code path: comparing the REST workflow file path is the narrow stable identifier, and the PR covers the affected planners and tests. The merge decision still needs live after-fix proof because this is scheduler admission logic. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 56431d2dedf3. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 220e340fd6
ℹ️ 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".
| active_run_count() { | ||
| printf '%s' "$ACTIVE_RUNS_JSON" \ | ||
| | WORKFLOW_NAME="$1" STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq '[.[] | select(.workflowName == env.WORKFLOW_NAME) | select(.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF)))] | length' 2>/dev/null \ | ||
| | WORKFLOW_PATH="$1" STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq '[.[] | select(.workflowPath == env.WORKFLOW_PATH) | select(.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF)))] | length' 2>/dev/null \ |
There was a problem hiding this comment.
Normalize workflow run paths before comparing
When GitHub returns the documented REST workflow-run path with a ref suffix like .github/workflows/build.yml@main, this exact equality rejects every active run even when it is the intended workflow. In active sweep/repair/commit-review environments, the scheduler (and the same exact comparisons added below and in commit-review.yml) will still count zero active workers/backstops and can over-allocate until waves are cancelled; strip the @... suffix or query the workflow-specific endpoint before comparing.
Useful? React with 👍 / 👎.
fix(scheduler): count active runs by workflow path
Summary
Why
Live verification after #392 exposed that GitHub's REST
namefield now follows the dynamicrun-name. The scheduler still compared it with the workflow's static name, so a normal 89-shard wave was not counted before a hot planner allocated its lane. The excess hot run was cancelled immediately.Validation
pnpm run formatpnpm run check:limitspnpm run build:allnode --test test/sweep-workflow.test.ts(37/37)The complete local check passed 551/559 tests; its eight failures were Codex-process 10-second timeouts under the live 89-worker load. All eight passed when rerun in their two isolated test files.
Live failure evidence: https://github.com/openclaw/clawsweeper/actions/runs/28682959017
Live verification plan
The scheduled workflow executes from
main, so the after-fix overlap proof is necessarily post-merge. On the exact green head, observe the next natural broad overlap and verify the planner counts active workflow-path runs and admits no more than the remaining 128-worker budget. Cancel the new wave immediately if that invariant fails.After-merge proof
Verified on merged
maincommit1343d8ec0cef4a5088be01084937fe4396cf9571.Capping broad background review shards from 89 to scheduler allowance 1after counting all overlapping fixed-head planners by workflow path.Proof run: https://github.com/openclaw/clawsweeper/actions/runs/28684426284