Skip to content

fix(skills): let the poll runtime, not the cycle cap, end prepare-pr and babysit loops - #22200

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/20869-prepare-pr-poll-budget
Oct 19, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/20869-prepare-pr-poll-budget

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The kirocrew-prepare-pr and babysit poll loops run for their full stated runtime instead of stopping early when the cycle count runs out.

The kirocrew-prepare-pr recipe arms monitor_start with interval_secs=300, max_cycles=280 and max_runtime_secs=86400. 300 s x 280 = 84,000 s, under 86,400 s, so the cycle cap ends the loop up to 40 minutes before the 24 hours the skill promises. The babysit legacy recipe has the same shape and a bigger gap: 300 s x 24 = 7,200 s against a 14,400 s runtime, so it stops after about two of its four hours.

Why it matters

A loop that runs out of cycles first deactivates before its runtime ends. A PR that is still being reviewed or rebased then loses its watcher early, and the agent never gets the turn in which it would have reported or renewed.

Not a goal

What changed (motivation → approach → change)

Both recipes counted cycles that end before their runtime does. The rule the conductor skills already use is interval x max_cycles >= max_runtime_secs, so the runtime, not the cycle count, ends the loop.

recipe interval max_cycles max_runtime_secs cycles cover
kirocrew-prepare-pr 300 280 → 288 86400 84,000 → 86,400 s
babysit legacy 300 24 → 48 14400 7,200 → 14,400 s

In kirocrew-prepare-pr/SKILL.md the bound line and the monitor_start example both carry 288; babysit/SKILL.md carries 48. The learn-cron-dashboard spec states the same numbers and the rule.

Backwards compatibility

Compatible: only the example numbers an agent copies change; no API, validator or default changes. A loop already armed keeps its own bounds.

Removes nothing: the loops get more cycles, nothing is hidden or rejected.

Tests

  • test/test_review_repair_routing_skill.py::test_comment_aware_recipes_are_finite_ungated_and_keep_repair_routing asserted max_runtime_secs > interval x max_cycles, which pinned the bug. It now asserts interval x max_cycles >= max_runtime_secs for both recipes, and pins (288, 86400), (48, 14400) and the prose line.
  • test/test_babysit_monitor_scenarios.py: the prepare-pr scenario now asserts that the runtime is spent once every cycle has run, through the real runtime_budget_exceeded. The babysit legacy scenario pins 48 cycles and the same rule on the decoded monitor_start arguments.
  • Mutant: with the old numbers put back in both skills and the exact pins, 3 tests fail (the >= rule, the runtime check, the babysit rule); restored, 34 pass.
  • Determinism: these are pure reads of the shipped skill text. 3 repeats and one shuffled order, -n0 -p no:testmon, 34 passed each time.

Manual verification

N/A — unit coverage sufficient: the change is two example numbers, and the tests run them through the real monitor_start and runtime_budget_exceeded.

Related Issues

Closes #20869

Pattern harvest

Rule candidate: lint
Pattern: a skill's monitor_start example whose interval x max_cycles is under its max_runtime_secs; a test could scan every built-in skill recipe the way goal-conductor/scripts/patrol_budget.py check does.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 1bb668d4d8a8a8011dfbaad0ecde009379935a05 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 1bb668d4d8a8a8011dfbaad0ecde009379935a05 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that #20869 really expects the legacy babysit loop to keep spending a full model turn every 300 s for all four hours. That doubles its worst-case turns from 24 to 48.

Inventory (4 items) — 4 justified

Intent: make the prepare-pr and babysit watchers run for the whole runtime their skills promise instead of quitting early on the cycle cap. FIX.

  1. The babysit legacy comment-aware loop now watches for its full 4 hours instead of about 2 (24 → 48 cycles). — justified
  2. The prepare-pr poll loop's cycle budget grows from 280 to 288, so 300 s × 288 now matches the 24-hour runtime. The skill's bound line and its example both change. — justified
  3. The learn-cron-dashboard spec now gives the new numbers and the rule that interval × cycles is at least the runtime. — justified
  4. The test that pinned runtime > interval × cycles is reversed, and the description says so ("pinned the bug"). Its evidence is the skill's stated 24 h and the spec's "so the four-hour default does not truncate". — justified

[FIRST-PRINCIPLES-REVIEWED] 1bb668d

Description read

[DESCRIPTION-READ] c224a856fa9d0368d4e8260dec815aea754c3af98f22fc4d8576ee9b6857422e

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 1bb668d4d8a8a8011dfbaad0ecde009379935a05 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Before merge, confirm the old max_runtime_secs > interval × max_cycles pin was a sloppy formalization and not a deliberate decision. The clone is shallow, so its history is not readable here.

[DESIGN-REVIEWED] 1bb668d

Description read

[DESCRIPTION-READ] 835a257a48b0215fdf406a95ef953731de539bdfe03b45993c6ef3f0ad3f04ce

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 1bb668d4d8a8a8011dfbaad0ecde009379935a05 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 1bb668d

Verdict parsed from the review's SHA-scoped output markers for commit 1bb668d4d8a8a8011dfbaad0ecde009379935a05.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 1bb668d4d8a8a8011dfbaad0ecde009379935a05: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 1bb668d4d8a8a8011dfbaad0ecde009379935a05 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 1bb668d

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 1bb668d4d8a8a8011dfbaad0ecde009379935a05: <one-sentence reason>

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Harness Parity Gate is red on main too (fast-gate on main 602ba3c: ACP_BACKENDS_MEMBER_CAPABILITIES [claude]: allowlisted but now proven; delete the entry). Await Fast Gate and Coverage Gate fail only because of it. Fixes are open in #22178 and #22186. This PR waits for one to merge, then rebases onto it; no override for this red.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

First Principles punchline: was the deleted pin the bug?

Yes. #20869 asks for interval x max_cycles >= max_runtime_secs so the runtime, not the cycle cap, ends the loop. The old assertion max_runtime_secs > interval_secs * max_cycles in test/test_review_repair_routing_skill.py required the opposite, the shape that let 300 x 280 = 84,000 s end before 86,400 s.
The flipped assertion fails on the old numbers (mutant: 280 and 24 restored, 3 tests fail) and passes on 288 and 48.

@iamwhatever
iamwhatever force-pushed the fix/20869-prepare-pr-poll-budget branch from 544ffb6 to 1bb668d Compare October 19, 2026 18:05
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main's Harness Parity red is fixed by #22178 (544ffb6 -> 1bb668d, base 3e39e7a). Related tests pass locally (45) and check_harness_parity.py is green; CI re-running.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Design punchline: was the old max_runtime_secs > interval x max_cycles pin deliberate?

No recorded decision. The assertion arrived in c690e4b (#10293, a prompt-slimming refactor) with no rationale for the direction; #16740 later re-pinned it to (280, 86400) as part of the rename. #20869, filed from the First Principles review of #20864, asks for the opposite rule, which goal-conductor's patrol_budget.py check and pipeline-conductor already enforce.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

First Principles punchline: does #20869 expect the babysit legacy loop to run all four hours?

Yes. #20869 names the babysit legacy recipe (300 / 24 / 14400) as the same shape to fix. The recipe's own max_runtime_secs already states four hours; 24 cycles ended it after two. 48 is the worst case only: the message stops the loop with autonudge_stop as soon as the PR is ready, terminal, blocked or stopped, so a loop that finishes early spends fewer turns.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready at 1bb668d: PR Readiness passed, all 103 checks green, mergeable, green age fresh on main 3e39e7a. GPT and Opus left no findings; Design and First Principles passed and their punchlines are answered above. Waiting for maintainer review. This Crew will not merge, approve or enable auto-merge.

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 19, 2026 20:06

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: raises the babysit (24 to 48) and prepare-pr (280 to 288) monitor cycle caps so interval x max_cycles covers max_runtime_secs and the runtime, not the cycle cap, ends each loop; tests pin that relation. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/learn-cron-dashboard.md.

@KiroCrewCaptain
KiroCrewCaptain merged commit 3ad0780 into main Oct 19, 2026
104 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/20869-prepare-pr-poll-budget branch October 19, 2026 20:44
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 19, 2026
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.

kirocrew-prepare-pr: poll loop cycle cap ends before its runtime

2 participants