Skip to content

fix(autonudge): leave a default-brief loop with no readable target to its probe - #40001

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
crew/issue-radar/fix-39974-default-brief-no-target
Nov 20, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
crew/issue-radar/fix-39974-default-brief-no-target

Conversation

@kyleseaman

Copy link
Copy Markdown
Contributor

Fixes #39974

Problem / Motivation

Goal: Granting the nudge_evidence scope no longer turns every quiet tick of a conductor's patrol into a turn.

The gateway arms a conductor's patrol as a gated work-ledger loop with the stock PATROL_MESSAGE, which names no session and no pull request. Once the scope is granted, a gated loop with no criteria of its own is judged under the default brief. _judge_tick_is_quiet (src/kiro_crew/autonudge_service/judge_tick.py) then finds no target in the message and returns False, so the quiet answer the typed probe already reached is replaced by a fire. With the scope off the same tick returns None and stays quiet.

Why it matters

At the 300 s interval an idle conductor goes from about one turn an hour (the probe's floor) to twelve, each on the conductor's own model. A host that runs conductors has to leave the scope off, which also gives up default-brief screening for the loops that could use it.

Not a goal

  • Part 2 of the issue: letting the judge read work-ledger events so a patrol can be judged quiet past the floor. That is a new evidence source and a feature of its own; this PR leaves the floor turn as it is today.
  • Changing an owner-written brief. A loop whose owner armed a criterion and whose watch reads nothing still fires every tick, as test_no_targets_fires_rather_than_suppressing pins.

What changed

  • src/kiro_crew/autonudge_service/judge_tick.py: when no target can be read and the loop is under the default brief, return None ("no judge applies") instead of False. Both callers in autonudge_service/gate.py already treat None as the scope-off path: after a probe, the judge-less quiet with its counters and floor; with no probe, the existing fire. The docstring lists the new None case.
  • src/kiro_crew/autonudge_service/gate.py: the _judge_reads_only_the_watched_pr docstring now says what a no-target loop's judge does under each brief kind. No code change.
  • src/kiro_crew/docs/monitor-loops.md: one sentence saying a loop that names no session or pull request runs under the scope as it does without it.

Intent check: the no-target return False came in with #12787, before the default brief existed, and was kept when #12787 added "screen every gated loop, under a default brief". That commit's stated goal is to save turns on loops armed with no brief. A loop with no target cannot be screened, so leaving it as it is with the scope off follows that goal.

Tests

  • New in test/test_autonudge_wake_judge_tick.py::TestTheDefaultBrief:
    • test_a_default_brief_with_no_readable_target_leaves_the_probe_s_answer: a gated loop with no brief whose message is PATROL_MESSAGE returns None, collects no evidence and asks no judge. It fails on origin/main with assert False is None and passes with the fix.
    • test_an_owner_brief_with_no_readable_target_still_fires: the same message under a wake_when brief still returns False.
  • PYTHONPATH=src:test pytest -n 8 over every test/*autonudge*, *conductor*, *patrol*, *nudge_wake* and *wake_judge* file, plus the two doc tests below: 6350 passed.
  • GITHUB_BASE_REF=main FLAKE_RATCHET_BASE=<origin/main> pytest -n 8 test/test_*ratchet*.py: 404 passed.
  • Doc tests that read monitor-loops.md: test_runtime_docs_monitor_skills_facts.py and test_runtime_budget_wording.py (in the run above), and test_feature_videos*.py and test_recommendation_metrics.py on the same diff: passed.
  • black --check, flake8 on the changed Python files, and mypy on judge_tick.py: clean.

Proof: PROVEN test_a_default_brief_with_no_readable_target_leaves_the_probe_s_answer (head b5686da)

Sibling sweep

Swept: grep -rn "parse_targets(" src/kiro_crew, every reader of a judge spec's targets
Sibling: src/kiro_crew/autonudge_service/judge_tick.py -- changed here
Sibling: src/kiro_crew/autonudge_service/gate.py (_judge_reads_only_the_watched_pr) -- not affected -- it answers False for a no-target loop, which sends the tick on to the judge; that judge now answers None under the default brief, so the tick still goes quiet. Docstring updated.
Sibling: src/kiro_crew/slack/gateway_runtime/nudge_wiring.py (evidence collector) -- not affected -- it runs only after the judge found targets
Sibling: src/kiro_crew/autonudge_judge.py (pr_targets_of) -- not affected -- it reads the spec's own list for arming, not the tick

Pattern harvest

Not generalizable: this is the only place the wake judge decides what a loop it cannot read does; the other "no judge applies" exits (ungated, judge: false, scope off, no lane) already return None

@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners November 20, 2026 16:08
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision b5686da1a6993a33ac1ac0a98c8329b5c8d93c57 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of b5686da1a6993a33ac1ac0a98c8329b5c8d93c57 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. Returning None for a no-target loop under the default brief matches the scope-off path that already exists, and loops with an owner-written brief still fire as before.

[DESIGN-REVIEWED] b5686da

Description read

[DESCRIPTION-READ] 28b49e98959ebde46cb627fffac4cb4512a09fd96a773da02604f0119eae1b72

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of b5686da1a6993a33ac1ac0a98c8329b5c8d93c57 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. This is a fix for a defect that #39974 reports and a new test reproduces on base. It changes one branch, and only for the default brief. A loop with an owner-written brief still fires.

What this change ships

Inventory (4 items) — 4 justified

Intent: stop granting the nudge_evidence scope from turning each quiet conductor-patrol tick into a turn. FIX.

  1. A default-brief loop whose message names no session and no pull request now behaves as it does with the scope off, so it stays quiet instead of firing every tick — justified
  2. A loop with an owner-written brief and no readable target still fires every tick — justified
  3. The monitor-loops.md user doc gets one sentence saying such a loop runs as it does with the scope off — justified
  4. The docstrings of _judge_tick_is_quiet and _judge_reads_only_the_watched_pr now describe the new None case — justified

[FIRST-PRINCIPLES-REVIEWED] b5686da

Description read

[DESCRIPTION-READ] 995f040e701e69d3f8cbcf9223e46d946715a96d2b47d998477a0ccd499b53bd

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] b5686da

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable b5686da1a6993a33ac1ac0a98c8329b5c8d93c57 false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b5686da

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b5686da1a6993a33ac1ac0a98c8329b5c8d93c57 false-positive: <reason, 20 to 500 characters>

@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 Nov 20, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier pending: being reviewed.

Narrow fix: when a loop runs under the default brief and its message names nothing the judge can read, _judge_tick_is_quiet now returns None instead of False. I traced both callers. Probe-backed loops (gate.py:1294) take the same judge-less path they get with the scope off, with the blocker override and quiet floor intact, so an idle conductor patrol drops back to the probe's floor turn. Loops with no probe (gate.py:778) still fall through to firing every tick. Owner-written briefs still fire, and that is tested. The new behaviour matches default_spec's own docstring and the scope-off behaviour. The new test reproduces the bug on main. No state is written on the new path, and no trust boundary moves.

Tier: pending: being reviewed.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit b5686da1a6 · 43 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 20, 2026 17:27

@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.

This review checked head b5686da. Under the default brief, _judge_tick_is_quiet now returns None for a loop with no readable target. Owner-written briefs still return False. In gate.py, the no-probe caller still fires as before. The after-probe caller keeps the probe's quiet answer, its counters and the quiet floor, which is what the tick does with the scope off. No evidence is collected and no state is staged before that early return. A run against the head tree passed the new tests. With main's judge_tick.py the default-brief test fails with assert False is None. If the brief-kind check is removed, the owner-brief tests fail.

Done well: the default-brief test first asserts that PATROL_MESSAGE names no target, and it swaps in an evidence collector that raises if called. "No judge applies" therefore means nothing was read, not only that the return value is None.

Optional:

  • Add a ## Real-machine verification section. A before/after run of the new test on your own computer is enough for this decision function.
  • The default_spec() docstring in src/kiro_crew/autonudge_judge.py still says a no-target loop "fires as it does today". Rewording it to match the new None return would help the next reader.
  • The "Gated loops only" bullet in the Wake judge section of docs/system-specs/modules/learn-cron-dashboard.md could list this case as one more bypass where no judge runs.

@KiroCrewCaptain
KiroCrewCaptain merged commit fdbc72c into main Nov 20, 2026
98 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/issue-radar/fix-39974-default-brief-no-target branch November 20, 2026 17:27
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 20, 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.

Wake judge: granting nudge_evidence makes a conductor's work-ledger patrol fire every tick

2 participants