Skip to content

fix(monitor): wake a briefless watch when the board settles green - #14733

Merged
iamwhatever merged 1 commit into
mainfrom
fix/wake-default-settled-green-14072
Oct 6, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/wake-default-settled-green-14072

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A monitoring loop that arms no wake criteria of its own now wakes its owner the moment the board it watches settles green.

The wake judge's DEFAULT_WAKE_WHEN — the brief a briefless loop runs under — named a failing check but no settled, all-passed board. So a loop that armed no criteria slept through the board going green and surfaced it only when the starvation backstop happened to fire for another reason. Nothing in the tests pinned the intended criterion either way, and test_monitor_start_ack.py's docstring described a wake set the code does not have.

Why it matters

The board going green is the state an owner arming a plain watch is most often waiting FOR — the thing they watched is done. A missed "it is green now" strands the owner, who keeps waiting on work already finished; a spurious wake costs one model turn and is self-correcting. Leaving the choice to "whatever the judge says on the day" is worse than either fixed answer, because the behaviour then drifts with the model.

Not a goal

  • Does not change the wake behaviour of a loop that arms its OWN wake_when — that brief is the owner's to write; only the shipped default gains the clause.
  • Does not add a deterministic in-process wake decision: the wake verdict remains the judge's at runtime, so the pin is at the criterion (constant + rendered board) level, mirroring how the existing failing-check criterion is pinned.

What changed (motivation → approach → change)

Symptom: a briefless gated loop does not wake when its watched PR's board settles green. Root cause: DEFAULT_WAKE_WHEN (src/kiro_crew/autonudge_judge.py) enumerates wake reasons and omits a settled/all-passed board, so the judge has no criterion to match a green board against. This is a product-shape decision (a changed default for what a briefless loop wakes on); the settled-green wake is load-bearing (#8926 records a briefless loop taking ~35 min to wake on its own PR settling), and the failure mode of having the clause (an occasional extra wake) is cheaper and self-correcting versus the failure mode of omitting it (a stranded owner). The decision is recorded in docs/request-for-change/rfc-wake-judge.md (§3.3 built-in brief) as part of this change.

Change:

  • src/kiro_crew/autonudge_judge.py: add "a fully settled board whose every check has passed" to DEFAULT_WAKE_WHEN, with a doc-comment on the asymmetry (missed-green strands the owner vs a self-correcting spurious wake) and that last_verdict gives the judge advisory context to answer quiet on a board it already woke on.
  • docs/request-for-change/rfc-wake-judge.md: add the settled-green clause to the built-in-brief text and a rationale paragraph in the section an owner reads — this is where the changed default is documented for owners (the CHANGELOG holds shipped releases only and is written by the release PR).
  • test/test_autonudge_wake_judge.py: add the case that pins the criterion (the default brief names a settled green board) and proves a fully-passed board renders as one the clause matches.
  • test/test_monitor_start_ack.py: correct the ack docstring so it describes the screened ack its assertions check.

Backwards compatibility

Compatible: the change widens the default wake criterion (one more reason to wake); it rejects, renames, or removes nothing. A loop that names its own wake_when is unaffected. The only behavioural delta is that a briefless loop now wakes on a settled green board where before it did not — the intended fix, documented in the RFC.

Tests

  • test_the_default_brief_wakes_on_a_settled_green_board (new): asserts DEFAULT_WAKE_WHEN names a fully settled, all-passed board, and that render_pr_checks renders a 3-passed board as one the clause can match (passed 3, no failed, not INCOMPLETE).
  • test_the_default_brief_names_a_failing_check (unchanged): still passes — the failing-check clause is untouched.
  • test_the_gated_ack_names_what_actually_raises_a_wake (docstring corrected): assertions unchanged and still pass.
  • Full suites test_autonudge_wake_judge.py + test_monitor_start_ack.py: 293 passed locally.

Manual verification

The wake decision is the judge model's at runtime, so this change pins the criterion (the constant text and the rendered board it must match), not an end-to-end wake — matching how the existing failing-check criterion is pinned. There is no deterministic in-process wake path to assert against; a judge-eval transcript would exercise the model lane, not this diff. The criterion + rendering coverage is the same discipline the surrounding wake-criteria tests use.

Related Issues

Fixes #14072

Pattern harvest

Not generalizable: this is a single omitted clause in one enumerated default constant, introduced when the deterministic settled-green wake moved into the judge criterion and the criterion was not given the corresponding clause. No broader class — a lint/semgrep rule cannot know which enumerated defaults are meant to be exhaustive.

Checklist

  • At most two commits (one here), with a Conventional Commits title (fix: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (RFC built-in-brief section)
  • No secrets, credentials, or internal references in the diff

@chenmingwei23
chenmingwei23 requested a review from a team as a code owner September 28, 2026 16:07
@chenmingwei23
chenmingwei23 force-pushed the fix/wake-default-settled-green-14072 branch from 75c3c4f to d505ebf Compare September 28, 2026 16:14
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 8437f3519ff643a31068f6fda7b5b105565decce and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- src/kiro_crew/autonudge_judge.py:934 -- after a wake, build_state sends recent_verdicts and omits last_verdict, so the comment names a signal the judge does not receive -> Fix: replace last_verdict with recent_verdicts history. (origin: validation)
[GPT-REVIEWED] 8437f35

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

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

One judge-eval transcript showing the model actually wakes on a rendered green board would close the model-lane gap the tests cannot reach.

[DESIGN-REVIEWED] 8437f35

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ human override accepted

@buluoray overrode this lane for 8437f3519ff643a31068f6fda7b5b105565decce via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 8437f3519ff643a31068f6fda7b5b105565decce — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 8437f35

Verdict parsed from the review's SHA-scoped output markers for commit 8437f3519ff643a31068f6fda7b5b105565decce.

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

The wake judge's DEFAULT_WAKE_WHEN named a failing check but no settled,
all-passed board, so a monitoring loop that armed no wake criteria of its
own slept through the board going green -- the very state an owner arming a
plain watch most often waits FOR. Nothing pinned the intended verdict either
way, and the ack test's docstring described a wake set the code does not have.

- autonudge_judge.py: add "a fully settled board whose every check has
  passed" to DEFAULT_WAKE_WHEN, with a doc-comment on why a missed
  "it is green now" (a stranded owner) is worse than a spurious wake (one
  self-correcting turn), and that last_verdict guards against re-waking.
- test_autonudge_wake_judge.py: pin the criterion -- the default brief names
  a settled green board -- and prove a fully-passed board renders as one the
  clause matches.
- test_monitor_start_ack.py: correct the ack docstring to describe the
  screened ack its assertions check.
- rfc-wake-judge.md: document the settled-green clause and the behaviour for a
  briefless loop in the built-in-brief section an owner reads.

Fixes #14072
@chenmingwei23
chenmingwei23 force-pushed the fix/wake-default-settled-green-14072 branch from 421054b to 8437f35 Compare September 28, 2026 18:02
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 28, 2026
@cruisercohen cruisercohen added the needs-pr-triage PR scanner: awaiting automated triage label Oct 5, 2026
@dwu96

dwu96 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: dwu96#8c08bee0]: This PR has been inactive for 7+ days. I reviewed the blockers but they require your input:

State: MERGEABLE, and 100+ checks pass (backend lint/type, all 8 backend test shards, Windows shards, CodeQL, both CodeBuild projects). The only two red checks are First Principles Review (🔴 BLOCK) and PR Readiness, which fails because of that BLOCK — so there is no mechanical failure left to fix.

Why I did not take this one: the BLOCK is premise-level, not a code defect. It holds that the changed default wake criterion is a product-shape decision whose only record is the docs/request-for-change/rfc-wake-judge.md edit shipped inside this same diff — "a proposal, not a decision". Its own Clears when offers only maintainer-side exits:

  • Record the decision on the base. Either an RFC covering the settled-green default-brief clause is merged non-draft onto main (then rebase), or a maintainer records /ai-review override first-principles 8437f351 : <decision>. Both need repository-writer action — I cannot self-grant either.
  • Decide on the rider split (Item 2). The review's suggested subtraction is to split the rfc-wake-judge.md hunk into its own PR against main and rebase this one onto it. I deliberately did not do that: this pipeline pushes only to an existing PR branch and never opens a new PR, and the split RFC would still need a maintainer merge before it unblocks anything here.
  • Confirm the intended default. The BLOCK does not dispute the fix's correctness, only that nobody has accepted the behaviour change. That acceptance is yours (or a maintainer's) to give — if I widened the default on my own authority I would be deciding the product shape the review is asking a human to decide.

One advisory, non-blocking note you may want to fold in while you are here: the GPT 5.6 lane (overall ✅, finding is in its details block) reads src/kiro_crew/autonudge_judge.py:934 as naming last_verdict, where build_state actually sends recent_verdicts — so the new doc-comment cites a signal the judge does not receive. That is a one-line comment correction, not a gate.

When you've addressed these, the pipeline will re-assess on its next cycle.

@dwu96 dwu96 added needs-author-decision PR blocked on author input and removed needs-pr-triage PR scanner: awaiting automated triage labels Oct 5, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving on head 8437f35.

Verified on the PR head:

  • DEFAULT_WAKE_WHEN now names "a fully settled board whose every check has passed" (autonudge_judge.py), and test_autonudge_wake_judge.py pins the clause. This is the first of the two resolutions #14072 offered.
  • The stale docstring in test/test_monitor_start_ack.py is corrected.

Maintainer decision (First Principles BLOCK): widening the default wake condition for briefless watches to include a green board is accepted. A missed "it is green now" strands the owner, while a spurious wake costs one turn, so the wider default is the right trade. Recording it here and via override so the decision does not live only in the RFC edit.

Security Scope Review: the red run on this SHA (run 37364683631) was cancelled before its candidate jobs ran, so it failed closed on an empty scope. Two other Security Scope runs on this SHA succeeded, and the diff does not touch the deny composite. It needs a re-run, not a change.

Non-blocking follow-up: the new comment (and the RFC) says last_verdict lets the judge answer quiet on a board it already woke on, but nudge_wake.build_state sends recent_verdicts instead once any verdict history exists. The pre-existing line above repeats the same wording. Worth a one-line comment fix.

@buluoray

buluoray commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

/ai-review override first-principles 8437f35: maintainer decision, widening the default wake condition for briefless watches to a fully settled green board is accepted; a missed green strands the owner while a spurious wake costs one turn.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for 8437f3519ff643a31068f6fda7b5b105565decce.

maintainer decision, widening the default wake condition for briefless watches to a fully settled green board is accepted; a missed green strands the owner while a spurious wake costs one turn.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 6, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new clause in DEFAULT_WAKE_WHEN is small and well argued. The test checks both the wording and that a fully passed board renders as one the clause can match. buluoray recorded the product decision as a maintainer override on this head, and CI is now fully green on 8437f351. The fixed test_monitor_start_ack.py docstring now describes the screened ack. One non-blocking follow-up: the new comment and the RFC say last_verdict lets the judge answer quiet on a board it already woke on. But once any verdict history exists, build_state sends recent_verdicts instead, so a one-line wording fix would make that accurate.

@iamwhatever
iamwhatever enabled auto-merge (squash) October 6, 2026 16:42
@iamwhatever
iamwhatever merged commit cefb470 into main Oct 6, 2026
120 of 130 checks passed
@iamwhatever
iamwhatever deleted the fix/wake-default-settled-green-14072 branch October 6, 2026 16:43
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-author-decision PR blocked on author input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wake judge: the default brief names no settled-green board, so an already-armed gated loop loses that wake and nothing pins the intended verdict

5 participants