Skip to content

Optimizer recursion guard: stop counting no-op runs - #87

Merged
iamkayleb merged 1 commit into
mainfrom
fix/optimizer-recursion-guard-counts-noops
Sep 6, 2026
Merged

iamkayleb merged 1 commit into
mainfrom
fix/optimizer-recursion-guard-counts-noops

Conversation

@iamkayleb

Copy link
Copy Markdown
Owner

The guard counted every workflow run whose run-name ended with the issue number, with no filter on whether the run did anything. This workflow triggers on every issues: labeled event, but only agents:format, agents:optimize, agents:apply-suggestions and workflow_dispatch get past the trigger check — every other label spawns a run that exits immediately and still consumed one of the four slots.

Applying three labels to a new issue therefore burned the whole budget before any optimizer work started, and the guard tripped on legitimate bulk seeding: "Too many optimizer runs (5 > 3) in last hour" on issues that had run the optimizer at most twice.

run-name now marks a run [work] or [noop] from the triggering label, which is known at trigger time, and the guard excludes [noop]. Genuine recursion is still caught: four real runs in the window trips as before.

Verified against the observed failure — the same history counts 5 (trips) under the old expression and 2 (passes) under the new one, while four work runs still trip.

Claude-Session: https://claude.ai/code/session_01FC8XoyssN5v6hQCTtcjoB5

Workflow Source

Started from:

  • GitHub issue: #
  • Direct PR / remote GitHub work
  • Local Codex/user request
  • Automation run
  • Review follow-up from PR #
  • Sync / maintenance campaign
  • Dependabot or dependency update
  • Do not automate

Automation intent:

  • Verifier should review this
  • Keepalive may manage this PR
  • Human-only unless checks fail

Notes:

Summary

Testing

The guard counted every workflow run whose run-name ended with the issue
number, with no filter on whether the run did anything. This workflow
triggers on every `issues: labeled` event, but only agents:format,
agents:optimize, agents:apply-suggestions and workflow_dispatch get past
the trigger check — every other label spawns a run that exits immediately
and still consumed one of the four slots.

Applying three labels to a new issue therefore burned the whole budget
before any optimizer work started, and the guard tripped on legitimate
bulk seeding: "Too many optimizer runs (5 > 3) in last hour" on issues
that had run the optimizer at most twice.

run-name now marks a run [work] or [noop] from the triggering label, which
is known at trigger time, and the guard excludes [noop]. Genuine recursion
is still caught: four real runs in the window trips as before.

Verified against the observed failure — the same history counts 5 (trips)
under the old expression and 2 (passes) under the new one, while four
work runs still trip.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FC8XoyssN5v6hQCTtcjoB5
@iamkayleb
iamkayleb merged commit 051b5de into main Sep 6, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants