Skip to content

fix(autonudge): read a legacy loop's pull request between cycles and while held - #21377

Merged
bolichen97 merged 2 commits into
mainfrom
fix/legacy-loop-pr-probe
Nov 7, 2026
Merged

bolichen97 merged 2 commits into
mainfrom
fix/legacy-loop-pr-probe

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A babysit loop notices when its pull request conflicts with its base or has ended, even when it is ungated or paused for an approval.

Two gaps in legacy prompt loops (monitor_start), both seen on live babysit loops:

  • An ungated loop learns of a conflict only when its timer fires. gate=false (what prepare-pr babysit loops use, because they read review comments) keeps the loop off the observation gate entirely, so nothing reads the pull request between cycles. A loop on a 2-hour interval sits up to 2 hours on a CONFLICTING head, and GitHub runs no pull_request checks on a conflicted head meanwhile.
  • A loop paused for an unanswered approval is blind. The held tick fires nothing and arms nothing, so a pull request that merges during the hold leaves the loop active and paused indefinitely. One live loop sat held for ~17 hours after its PR had merged.

Kyle asked for these behaviours. They are recorded in docs/request-for-change/rfc-legacy-loop-reads-stops-waits.md (RFC PR #22165, docs only), which this stack rebases onto once it merges; this PR edits no RFC.

Why it matters

Babysit loops are how PRs get driven to merge unattended. A conflict that waits out a long interval stalls CI for that whole window, and a loop frozen on a merged PR looks alive in the popover while it will never do anything again — the user has to notice and clean it up by hand.

Not a goal

What changed (motivation → approach → change)

Both gaps share a cause: the only reader of a legacy loop's pull request is the gate, and neither an ungated nor a held loop reaches it. A gate-only reader cannot be reused, because putting a MonitorState on an ungated row turns it into a structured monitor, and the gate's verdicts can suppress or end a loop.

So a new owner, autonudge_service/subject_reads.py, adds two narrow readers that keep no monitor state and use one gh pr view per read (gh_pr.fetch_state, no check board):

  • Ungated sleep. _timer sleeps through sleep_until_cycle. For a gate=false loop naming one pull request with an interval over 5 minutes, it sleeps in 5-minute chunks and reads the state between them. A head that newly conflicts with its base (PrObservation.is_conflicting) ends the sleep, once per pull request and head, and the cycle runs through the normal ladder. BEHIND does not wake it: with up-to-date protection on a busy base every sync is behind again at the next base commit, so it would re-sync every 5 minutes. Merged, closed, unread, behind and clean readings only keep sleeping.
  • Held tick. The approval-hold branch now runs hold_tick. For a held gated loop naming one pull request it reads the state, settles the loop as monitor_terminal when the PR merged or closed (outcome on its monitor, as the gate records it), and re-arms itself one read interval out. Only such a loop owns that timer: every arm of it (a turn ending, a deferred re-arm, a reconciler rescue) goes through _arm_from_deadline, which still sets and saves its cycle deadline but arms it one read interval out, so a release fires within the overdue beat, and the reconciler rescues it when the timer dies. A held ungated loop, or one naming none, reads nothing: its held tick re-arms nothing, a turn's end arms it toward its deadline, and the reconciler skips it, as on main. So a merged or closed pull request never deactivates a gate=false loop or makes it refuse a resume. A settlement hands the held time back to the runtime budget the way a release does.

Supporting edits:

  • probes/gh_pr.py: fetch_state and PrObservation.is_conflicting (built on the structured monitor's _normalize_mergeability, so one predicate says what conflicts).
  • src/kiro_crew/autonudge.py: the in-memory wake fingerprint map.
  • docs/system-specs/modules/monitor-architecture.md describes both readers. The decisions are § 2.1 (a held gated loop reads its pull request and settles when it merges or closes, a held ungated loop reads nothing; supersedes the approval-hold RFC's "While held" and "a held tick fires nothing" text) and § 2.2 (an ungated loop wakes early on a new conflict only) of rfc-legacy-loop-reads-stops-waits.md.

Backwards compatibility

Compatible: no new stored field; every loop that is gated, monitor-backed, names no pull request or sleeps 5 minutes or less sleeps exactly one plain sleep; a held loop still fires nothing and spends no bound, and a held ungated loop behaves exactly as on main.

Removes nothing: no field, key, route or behavior a caller depends on is removed; the reconciler's held-loop skip now applies only to a held loop that is ungated or names no pull request, because a gated one naming a pull request owns a timer.

Tests

  • test/test_autonudge_subject_reads.py (new, 39 tests): is_conflicting across mergeability/state pairs; fetch_state is one core read; the ungated sleep wakes once per head, re-wakes on a new head, after a settled clean read or after a retarget to another pull request on the same head, does not forget a conflict on an UNKNOWN read, never wakes on a head that is BEHIND after every sync, and only sleeps on merged/closed/unread readings or for a held/inactive loop; a conflict wake fires the cycle through _timer; a held gated loop settles on merged (success) and closed (blocked) with the outcome on its monitor, stays held on an open or unread subject, stays held when the settlement write is refused, is not settled by a read that raced a release or an opt-out to gate=false, settles nothing when cancelled while waiting for the store lock, publishes the settlement only after the write lands, and hands the held time back to the budget clock; a held ungated loop survives its pull request merging or closing (reads nothing, stays active and held, re-arms nothing, never rescued); a held loop naming a pull request re-arms its read on a turn ending while keeping a persisted deadline, so a release fires on the overdue beat, and is rescued by the reconciler, while one naming none reads nothing, re-arms nothing from its held tick, is armed toward its deadline on a turn ending and is never a reconciler candidate; read time counts toward the sleep. An autouse guard fails any test in the file that reaches the real forge read, and the conflict-wake test installs its read stub before add arms the timer.
  • test_autonudge_approval_stall.py, test_autonudge_person_wait_hold.py: unchanged from main; their held loops name no pull request, so the held tick still arms nothing.
  • test_autonudge_refactor_contract.py: the new owner module.
  • The budget-credit test in test_autonudge_subject_reads.py pins the settlement clock and asserts the exact credited value.
  • Revert-verified by hand: disabling the sleep wrapper, the held tick, the reconciler rescue, the no-pull-request guards (the arm, the reconciler skip, the held re-arm: each turns 1 to 4 tests red), the gate=false guard (3 tests red), the wake dedupe, the settle revalidation, the publish-after-write order or the read-time accounting each turns a test red.
  • Determinism: the new file 20/20 at -n0, 10/10 at -n 4 --dist loadgroup with two co-tenant files, and a shuffled order of 54 ids (seed=8284) green.

Manual verification

N/A — unit coverage drives _timer, hold_tick and the settlement against a real AutoNudgeService store; every forge read is scripted, so no test reaches gh. Local gates: the related backend set (32,722 passed; the 5 failures also fail on clean origin/main with this venv: test_acp_client_more_coverage::TestClientEncodeRefusalDegrades ×2, test_app_scaffold::test_symlink_loop_raises_a_clear_error, test_client_bindings type hints, test_codex_session_mcp adapter), the related frontend set (24,262 passed), isort, flake8, mypy, semgrep, the flake-pattern ratchet and the comment-history gate.

Related Issues

No tracking issue, by the maintainer's request; the motivation above is the record.

Pattern harvest

Rule candidate: review-prompt
Pattern: a state machine branch that "fires nothing and arms nothing" also stops observing the world; any hold/pause state should state what still watches the subject and what ends the hold.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners October 16, 2026 20:52
@kyleseaman
kyleseaman requested a review from bolichen97 October 16, 2026 20:52
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

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

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the change adds two narrow readers that keep no monitor state, both follow the RFC's § 2.1/§ 2.2 decisions, and both can be reverted cleanly.

Notes

  • The held-loop fix only covers gated loops, but the description says babysit loops run gate=false ("what prepare-pr babysit loops use"). If the loop that "sat held for ~17 hours after its PR had merged" was a babysit loop, this PR does not fix that incident. Say which kind of loop it was, so the remaining gap is on record rather than assumed closed.
  • The spec line "a head that newly needs a re-sync ends its sleep early" (§ 6) contradicts the new rule that BEHIND does not wake a loop. Change it to say a head that newly conflicts ends the sleep early.

[DESIGN-REVIEWED] 28e0b37

Description read

[DESCRIPTION-READ] c4b921c13aabb0d6aa45e968126470ec4c57dd2c5731b9aaab1bf8211b049b3d

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 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ human override accepted

@bolichen97 overrode this lane for 28e0b3761d4970b366959ab5235d24c297ed140f via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 28e0b37

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

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

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 28e0b37

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

@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 16, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-pr-probe branch from f22a9ef to 12376b3 Compare October 17, 2026 14:30
@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 17, 2026
@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 17, 2026
@bolichen97 bolichen97 mentioned this pull request Oct 17, 2026
5 tasks done

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

Needs a maintainer decision before merge. The code looks correct to me, and I found no must-fix defect.

Head reviewed: 12376b3.

What blocks it: the First Principles lane gives BLOCK on this head. The approval-hold RFC is implemented on main, and it records "a held tick fires nothing and arms no timer" and "a hold nobody ends stays held". This PR changes both lines, so a held loop now settles on its own when its pull request merges or closes. The PR body says the maintainer asked for this change. That decision must be recorded by a maintainer (an RFC update merged on main, or a maintainer override on this head). A review cannot record it.

What I checked:

  • The self re-arm from inside the held tick is safe: _cancel_timer refuses to cancel the running timer task, and hold_tick re-arms only while the loop is still held and registered.
  • _settle_terminal writes before it publishes, and it re-checks release, retarget and registration under both locks.
  • monitor_terminal is a finished stop reason, so a stale subject_outcome cannot ride a revival.
  • No other open PR in my queue touches these files, and main does not contain this change.

Two should-fix items are inline. Neither blocks.

decided = getattr(settled, "value", settled) or owed
decided = (
getattr(settled, "value", settled)
or str(getattr(loop, "subject_outcome", "") or "")

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 expiry notice now reads subject_outcome, but the monitor_update refusal text does not, so the two endings disagree.

This PR teaches the expiry notice to fall back to subject_outcome when a loop has no monitor. The agent-facing reading of the same fact, in dashboard/session_directive_apply.py (about line 1228 at this head), still reads only monitor.outcome and terminal_pending:

decided = str(getattr(settled, "value", settled) or owed or "")

An ungated loop settled while held has no monitor, so decided is "" there. A later monitor_update on that loop then falls to the else branch and tells the agent "its subject was closed without merging", even when the pull request merged. The comment above that line says the two readings use the same fields "so the agent-facing and user-facing endings cannot disagree". After this PR they can.

Why it matters: the agent can tell the user to reopen or abandon a pull request that already merged.

Suggestion: add the same fallback there: ... or str(getattr(loop, "subject_outcome", "") or "") or owed ..., and add one test for an ungated settled loop that receives a max_cycles raise. If monitor_update cannot reach a loop with no monitor, I will withdraw this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 22afc39. _monitor_update in dashboard/session_directive_apply.py now falls back to the loop's own subject_outcome before owed (settled.value or own or owed), so a settled ungated loop with no monitor reads the same outcome the expiry notice does. New test test_applier_a_settled_legacy_loop_reads_its_own_outcome in test/test_autonudge_stop_auth.py raises max_cycles on such a loop and asserts "already merged" and no "without merging"; it fails with the fallback removed.

# Settled clean, so a later conflict on this same head is news again.
svc._subject_wake_fp.pop(loop.id, None)
continue
fingerprint = f"{observation.head}:{kind}"

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.

🟡 A behind wake has no rate cap, so on a strict-protection repo with a busy base it can replace the operator's interval.

fingerprint = f"{observation.head}:{kind}"

The key changes with every head. Where branch protection requires an up-to-date head, each sync cycle pushes a new head. The next base commit makes that head BEHIND, and the next 300 second read ends the sleep again. A loop on a 2 hour interval can then run a model turn about every 5 minutes for as long as the base keeps moving. That spends max_cycles and the runtime budget on a cadence the operator did not choose. The Design lane raised the same point and I agree with it. The work-ledger pull-forward path already has a per-hour cap for this shape.

Why it matters: behind alone does not stop CI the way conflicting does, so the early wake buys little and can cost many turns.

Suggestion: end the sleep early only for conflicting, or route behind wakes through an hourly cap like the pull-forward one. Add a test where the head goes BEHIND after each sync. If you intend behind to wake every time, say so in the spec and I will withdraw this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed (thread is outdated against the current diff). The between-cycle read ends the sleep only for CONFLICTING now: subject_reads.py returns early when not observation.is_conflicting, and the wake fingerprint is the head alone, so one conflicting head wakes once. BEHIND never wakes, and the spec (monitor-architecture.md) says why: where protection requires an up-to-date head, every sync is behind again at the next base commit. Covered in test/test_autonudge_subject_reads.py.

@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-pr-probe branch from 12376b3 to 9639a9d Compare October 18, 2026 21:18
@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 Oct 18, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-pr-probe branch from 9639a9d to 22afc39 Compare October 18, 2026 22:42
@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 18, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-pr-probe branch from 22afc39 to 845a69e Compare October 18, 2026 23:33

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

Re-review of head 845a69e. The code looks correct to me, and I have no new findings. A maintainer decision is still needed before merge.

My two earlier findings are fixed on this head:

  • monitor_update on a settled ungated loop now reads subject_outcome before owed, so it agrees with the expiry notice. test_applier_a_settled_legacy_loop_reads_its_own_outcome pins it.
  • A BEHIND head no longer ends the sleep. The fingerprint is the head alone, and test_a_head_behind_after_every_sync_never_ends_the_sleep drives six synced heads that stay BEHIND and asserts a full 1800 second sleep.

What changed since my last review, and what I checked:

  • A held loop that names no pull request now behaves as on main: its held tick arms nothing, a turn's end arms it toward its deadline, and the reconciler skips it. _held_tick_rearms is the one predicate for the held tick, _arm_from_deadline and the reconciler, so the three cannot drift apart. The approval-stall and person-wait tests are back to their main versions, which supports this.
  • _settle_terminal now hands the held span back to the budget, using hold_span and credit_held_runtime the same way release_approval_hold does.

What remains: the approval-hold RFC is implemented on main and records "a held tick fires nothing and arms no timer" and "the cost is a paused row". This PR amends both, so a held loop that names a pull request now reads it and settles on its own. The First Principles lane now gives CONCERNS for the same reason, not BLOCK. A maintainer must record that the amended hold shape is agreed. A review cannot record it.

Two First Principles items I agree with, both optional:

  • The budget credit in _settle_terminal has no reader I can find. A monitor_terminal loop is in FINISHED_LOOP_REASONS, so a revival is refused, and the failed-close restore path skips an inactive loop. You can delete the credit, or name the reader.
  • PrObservation.is_conflicting spells the same CONFLICTING or DIRTY rule as _normalize_mergeability. One shared predicate would keep them from drifting.

No other open PR in my queue touches these files, and main does not contain this change.

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

Copy link
Copy Markdown
Contributor Author

span=2e70db09a933 fixed

Fixed in e6e01f0. _held_tick_rearms now admits only a gated loop (gate=true, with its monitor), so hold_tick reads and settles only such a loop, and _settle_terminal re-checks it under the locks. A held gate=false loop reads nothing, settles nothing and is never rescued, as on main, so the opt-out promise holds through a hold. The now-dead subject_outcome field and its wording/REST/loader plumbing are removed. New tests test_a_held_ungated_loop_survives_its_pull_request_ending (merged, closed) and test_an_opt_out_landing_during_the_read_settles_nothing fail with the gate guard removed. RFC #22165 § 2.1 amended to match (efad3a3).

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

Re-reviewed at e6e01f0. Since 07cedbc the change, apart from the rebase, is the held-loop scope.

The earlier point about ungated loops is resolved. _held_tick_rearms now admits only a gated loop that has a monitor, so hold_tick reads nothing for a held gate=False loop and never settles it, and _settle_terminal re-checks that predicate under the locks, so an opt-out landing during the read settles nothing. The subject_outcome field and its projections in the dashboard handler, the websocket observer and the directive applier are gone, since a settled loop always records its outcome on its monitor now. The new tests test_a_held_ungated_loop_survives_its_pull_request_ending and test_an_opt_out_landing_during_the_read_settles_nothing pin both paths. The RFC text in #22165 section 2.1 now states the same exemption, so code and RFC agree. The Opus lane is green on this head.

I also confirmed the GPT lane finding at test/test_autonudge_subject_reads.py:330. test_a_conflict_wake_fires_the_ungated_cycle adds an ungated 1800 second loop with the slept fixture already active, and installs the _read_state stub only after svc.add returns. The patched _nap does not yield, so the timer task armed inside add can reach the real _read_state, which submits gh_pr.fetch_state to an executor before _cancel_timer runs. On a machine with a signed in gh that is a live forge call. Installing the stub before svc.add fixes it.

Still open before merge:

  • The RFC in #22165 is not merged, and the First Principles lane blocks on it for both the conflict wake and the held read.
  • The GPT lane block above.
  • CI on this head is still running.

@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 24, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-pr-probe branch from e6e01f0 to 7f0807e Compare October 24, 2026 06:29
@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 24, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=af8c4dac894f fixed

Fixed in 7f0807e. test_a_conflict_wake_fires_the_ungated_cycle now installs its _read_state stub before svc.add arms the timer, then clears the wake fingerprint and the recorded sleeps the add-time timer left, so the assertions measure _timer alone. A new autouse fixture, _no_live_forge, replaces gh_pr._fetch_core for every test in the file and fails any test that reaches it, so no test here can start a real gh read. With the stub moved back after add, the guard fails the test at teardown (a test reached the real forge read: [(acme/widgets, 7)]).

@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 24, 2026

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

Re-reviewed at 7f0807e. Against e6e01f0 the only PR-owned change, apart from the rebase, is in test/test_autonudge_subject_reads.py.

The live forge read I confirmed last round is fixed. test_a_conflict_wake_fires_the_ungated_cycle now installs the _read_state stub before svc.add, then clears _subject_wake_fp and the slept record after cancelling the armed timer, so an early read by that timer neither reaches gh nor suppresses the conflict wake the test asserts. _Reads repeats its last reading, so the early read does not consume the scripted value. The new autouse _no_live_forge fixture patches gh_pr._fetch_core, which both fetch_state paths go through, and fails any test that reaches it.

I confirmed the GPT lane finding on that fixture. It patches through the shared monkeypatch, and docs/system-specs/common/testing-conventions.md rule D11 says an autouse fixture patches only through _floor_monkeypatch. Requesting _floor_monkeypatch in _no_live_forge and using it for the _fetch_core patch is the whole fix; tests that stub _fetch_core themselves keep using monkeypatch.

Still open before merge:

  • The RFC in #22165 is not merged, and the First Principles lane blocks on it for the held read and the conflict wake.
  • The GPT lane block above.
  • Some backend test shards on this head are still running.

@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-pr-probe branch from 7f0807e to 45d8475 Compare October 24, 2026 07:24
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 24, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=af8c4dac894f fixed

Fixed in 45d8475. The autouse _no_live_forge guard now requests _floor_monkeypatch and patches gh_pr._fetch_core there, so a test calling monkeypatch.undo() cannot lift it, and test-specific transport overrides stay on monkeypatch. This also clears the Semgrep kirocrew.test-autouse-shared-monkeypatch (D11) finding on the same line. All 445 tests in the subject-reads and refactor-contract files pass.

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

Re-reviewed at 45d8475. Against 7f0807e the only PR-owned change, apart from the rebase, is the _no_live_forge fixture in test/test_autonudge_subject_reads.py. Every other file in the diff is byte-identical to the previous head.

The fixture now requests _floor_monkeypatch and patches gh_pr._fetch_core through it, which is the fix rule D11 asks for. A test's own monkeypatch.undo() can no longer lift the guard, and tests that stub _fetch_core themselves still override it through monkeypatch. The GPT lane reports no blocking findings on this head.

Still open before merge:

  • The RFC in #22165 is not merged, and the First Principles lane still blocks on it for the held read and the conflict wake. That sign-off belongs to the maintainers.
  • Some backend test shards on this head are still running.

The RFC document itself did not change since my last read, so this PR still matches the text it implements.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=a5fa062e8cc8 needs-a-decision

Covered by RFC #22165 § 2.1 (a held gated loop that names a pull request reads it and settles when it ends, replacing rfc-goal-loop-approval-hold.md:56 for gated loops only) and § 2.2 (an ungated loop naming one pull request wakes early on a new conflict only). This branch is rebased onto main once the maintainer merges #22165; no override will be posted.

kyleseaman and others added 2 commits November 6, 2026 22:01
…while held

An ungated (gate=false) prompt loop naming one pull request now reads the
pull request's state every five minutes while it sleeps and runs its cycle
early, once per head, when the head conflicts with its base (BEHIND does not
wake it: under up-to-date protection every sync is behind again). The read
never suppresses a cycle and never ends the loop on a merged or closed
reading, so the gate=false opt-out keeps its promise.

A loop held for an unanswered tool approval reads the same state on every
held tick: a pull request that merged or closed during the hold settles the
loop as monitor_terminal with the usual expiry notice. The reconciler now
rescues a held loop whose timer died, since a held loop keeps its own timer.
…mer tests

Main's _nosleep fixture now replaces firing's asyncio namespace; the timer's
cycle wait lives in subject_reads._nap, so the fixture stubs that seam too.
@bolichen97

Copy link
Copy Markdown
Contributor

/ai-review override first-principles 28e0b37 owner-decision: agent: This PR implements RFC #22165, whose status is accepted on the product owner's 10-19 decisions; the product shape is that RFC: #22165

@bolichen97

Copy link
Copy Markdown
Contributor

/ai-review override first-principles 28e0b37 owner-decision: agent: Re-posting; the 23:09 override got no handler reply during a GitHub quota outage. This PR implements RFC #22165, accepted on the product owner's 10-19 decisions: #22165

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: class owner-decision needs a link to the owner's decision comment (https://github.com/<owner>/<repo>/pull/<n>#issuecomment-<id>) in the reason. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

1 similar comment
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: class owner-decision needs a link to the owner's decision comment (https://github.com/<owner>/<repo>/pull/<n>#issuecomment-<id>) in the reason. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

@bolichen97

Copy link
Copy Markdown
Contributor

/ai-review override first-principles 28e0b37 owner-decision: agent: This PR implements RFC #22165; the product owner approved its accepted text in this comment: #22165 (comment)

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Human judgment recorded

@bolichen97 recorded a owner-decision release (class owner-decision) for the first-principles AI finding on 28e0b3761d4970b366959ab5235d24c297ed140f.

agent: This PR implements RFC #22165; the product owner approved its accepted text in this comment: #22165 (comment)

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

@bolichen97 bolichen97 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 at 28e0b37. All checks pass, no change requests, and the branch is mergeable.

What I checked:

  • subject_reads.sleep_until_cycle only shortens an ungated loop's sleep, once per head, when the head conflicts with its base. It never suppresses a cycle or acts on a terminal reading, so the gate=False promise holds. BEHIND does not wake it.
  • hold_tick reads only a held gated loop that names one pull request (_held_tick_rearms). A merge or close settles it with monitor_terminal, persisted before it is applied to the live loop. A refused write leaves the loop held.
  • The reconciler rescues only those held gated loops. Other held loops keep main's behavior.
  • gh_pr.fetch_state is one call with no check board, and it is not published as a monitor reading. is_conflicting reuses the structured monitor's normalizer.
  • _subject_wake_fp is cleared in remove_sync. The spec update in monitor-architecture.md matches the code.
  • No new regex, and no new refusal.

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