Skip to content

fix(autonudge): bound the re-probe of a delivered terminal - #18648

Merged
bolichen97 merged 2 commits into
kirodotdev:mainfrom
rubencu:fix/autonudge-delivered-reprobe-retention
Oct 23, 2026
Merged

bolichen97 merged 2 commits into
kirodotdev:mainfrom
rubencu:fix/autonudge-delivered-reprobe-retention

Conversation

@rubencu

@rubencu rubencu commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A delivered terminal turn is not repeated because one re-probe could not read the subject, while an unreadable watch still resumes ordinary observation after a bounded number of tries.

With #9052, a channel terminal turn that landed is recorded in terminal_delivered and settled by a provider re-probe. A re-probe that cannot read the subject (no target or probe, a raised or unreachable fetch, the kernel's fallback, an observation-less wake) clears the marker as main does, so the next ordinary tick can deliver the same terminal turn again.

Why it matters

A repeated terminal turn is a second "your pull request merged" message and a second model turn for news already delivered. A transient gh failure is enough to cause it.

Not a goal

  • No change to the definite answers: a confirmed terminal still settles and a definite reopen still clears.
  • No change to an owed turn that has not been delivered (terminal_pending), which keeps its fire-on-uncertainty behavior.
  • No change to the shutdown drain, the delivered marker encoding or the state version from fix(autonudge): drain admitted mutations through gateway shutdown #9052.

What changed (motivation → approach → change)

Stacked on #9052: this branch carries #9052's head commit a2b4e7e606 itself, one commit on 4533b1eb5b. Review the top commit only; this PR depends on #9052 and merges after it. The fork review lanes that read the whole diff against main see #9052's commit too until it lands; this PR's own commit touches no website/ file.

Symptom: after #9052, an unreadable re-probe drops the delivered marker, and the next ordinary tick may announce the terminal again.

Root cause: the re-probe has two answers, so an indeterminate reading takes the same branch as a definite reopen.

Change:

Area Change
Re-probe _terminal_still_holds answers holds, gone or unknown. unknown covers no target or probe, a target that no longer matches the monitor, a raised fetch, the kernel's FALLBACK, an unreached observation and an observation-less WAKE; a work-ledger QUIET is a definite gone.
Bounded retention An unknown keeps the delivered marker and is counted in memory per monitor (AutoNudgeService._terminal_reprobe_unknowns), so the next quiet ticks re-probe without delivering. After _DELIVERED_REPROBE_UNKNOWN_LIMIT = 3 unknown answers (about ten minutes across two default-cadence retries, below the IRQ kernel's six-failure blind backstop) the settlement-only branch steps aside and ordinary observation resumes, but the marker stays. The bound is three rather than one because an ordinary tick that cannot read the subject reaches no verdict and spends a turn: at one, an outage that outlasts the first re-probe costs a turn on a watch whose final turn has already landed. A reading whose classification matches terminal_delivered settles the watch without firing again (_settle_observed_delivered_terminal). A definite still-open reading (a reached pull-request reading that is not FALLBACK, or a work-ledger QUIET) clears it, so a reopen and the next close still get their turns. The backstop's WAKE still fires. The count is not the kernel's errors streak: that streak counts failed fetches only, irq.poll does not expose it, and it sits at zero after any good fetch for the non-fetch unknown answers (a work-ledger WAKE, a FALLBACK from a raised probe). While the marker is kept, the observation-free follow-up allowance stays shut, as it does while a terminal turn is owed: a busy session's refusal of the final fire grants one retry credit that the owed turn never spends, and spending it once the bound is exhausted would fire a second final turn instead of observing (GPT 6.1 on 5532128b48).
Writes An unknown answer writes nothing. The holds settlement, from the re-probe or from a matching ordinary reading, goes through one staged write (_commit_delivered_settlement) that lands before the live monitor changes, and the gone and still-open clears stage theirs the same way. The count is dropped on settlement, gone, a reopen clear, a fresh delivery, a retarget, a removal and a service stop. A restart resets it, which only buys up to three more quiet re-probes, never a second turn.
Docs learn-cron-dashboard.md describes the tri-state answer, the in-memory bound, the kept marker and the settlement on a matching reading.

Design questions

The bound is better stated as a count ("two further re-probes, about ten minutes at the default cadence") than as a duration, since crew-log pushes also bring ticks forward and spend retries.

Backwards compatibility

Compatible: no new persisted field. A row an earlier head of this PR wrote carries a terminal_reprobe_unknowns key, which MonitorState keeps under extra_fields and writes back unchanged; nothing reads it.

  • Reader: src/kiro_crew/autonudge_service/gate.py:_monitor_tick_is_quiet -- release -- reads the in-memory count to decide whether the settlement-only branch still runs; a restart starts it at zero.

Tests

Validation on d1689c6bea, directly atop #9052's head a2b4e7e606 (one commit on 4533b1eb5b; this PR's own files are patch-identical to ad5aa6676f): every test_autonudge*.py and test_monitor_*.py module, the conductor patrol, slot-close race, workflow nudge wiring and Slack composition modules pass (2,922 tests), as do every test_slack_gateway*.py module and the boot-path test (1,087 tests) and main's new test/metrics/test_monitor_loop_counters.py (85 tests). The repository-wide facade-mirror, link-screen and dashboard-files composition guards pass too. Baselined Black, isort, Flake8, mypy, the comment-history, brand-name, subprocess-encoding, documentation-lint, line-cap and harness-parity gates, the flake-pattern and wait-discipline ratchets, and the max-two-commit push guard pass.

  • test/test_autonudge_shutdown_terminal_reprobe.py: test_exhausted_unknown_reprobes_then_a_holds_reading_settle_without_a_second_turn (three unknowns, an unreadable tick, then the merged reading: no second turn), test_exhausted_unknown_reprobes_do_not_spend_a_busy_retry_credit_on_a_second_turn (a busy refusal, the delivered retry and three unknowns, then the merged reading settles with two fires in all; it fires a third on 5532128b48), test_exhausted_unknown_reprobes_then_a_reopen_clears_and_the_next_close_fires, test_exhausted_unknown_reprobes_still_deliver_the_kernel_backstop, test_MUTATION_an_indeterminate_reprobe_writes_nothing_and_keeps_the_marker, test_MUTATION_a_reopen_publishes_the_cleared_marker_only_after_its_write_lands (the reopen clear reaches memory only after its write lands, and a failed write is retried) and test_MUTATION_an_outage_past_one_reprobe_costs_no_extra_turn (a second unreadable tick re-probes instead of spending a turn); a definite answer resets the count and settles once; an unobservable subject keeps the delivered marker without settling; a retarget drops the previous subject's marker and count. Each new case fails under the mutation it names (no match-settle, no reopen clear, a write on unknown, no retarget reset, a reopen clear published before its write, a bound of one).
  • test/test_autonudge_approval_stall.py: an approval release leaves the delivered marker untouched.

Manual verification

N/A: the unit tests drive the real settlement path with a stubbed re-probe against a temporary store.

Related Issues

No linked issue; this was split out of #9052 at the maintainer's request.

Pattern harvest

Not generalizable: the bound is a retry count for one re-probe of one persisted marker in _settle_delivered_terminal; a repeated-indeterminate-reading limit is a policy choice per probe, not a shape a rule can flag.

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

Contribution License Agreement

@rubencu
rubencu requested review from a team and KiroCrewCaptain as code owners October 9, 2026 22:24
@rubencu
rubencu requested a review from dodgeblaster October 9, 2026 22:24
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of d1689c6bead37405572db7ea16a75befe969e5a9 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design problem: the three-way re-probe answer (holds/gone/unknown) fixes the root cause, which was that an unreadable reading and a real reopen took the same branch. The cap on retries keeps a watch from going silent.

Notes

  • The unknown-answer count lives only in memory, so every gateway restart gives three more quiet re-probes. The description says so, and since a restart never produces a second turn, this is fine as long as restarts stay rare.

[DESIGN-REVIEWED] d1689c6

Description read

[DESCRIPTION-READ] 40d10487ebe999438ce2556329e358fcc29168f00cbb9d936da20fc99f0b3be6

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of d1689c6bead37405572db7ea16a75befe969e5a9 via the fork AI-review pipeline — 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. The fix is at the right level: the re-probe now returns three answers instead of two, so an unreadable reading no longer takes the reopen branch.

Notes

  • Item 5 — duplicate: the new still-open clear in _monitor_tick_is_quiet ("stage, write under _lock, publish once the write lands") repeats the gone branch of _settle_delivered_terminal almost line for line (2 copies in gate.py). Subtraction: delete the inline copy and send the still-open reading through the one gone clear path, so the two cannot drift apart.

What this change ships

Inventory (7 items) — 6 justified

Intent: stop a watch from announcing an already-delivered "PR merged" turn a second time after one unreadable re-probe, while still letting an unreadable watch go back to normal observation. FIX.

  1. An unreadable re-probe keeps the delivered marker instead of clearing it, so the final turn is not repeated — justified
  2. After 3 unreadable re-probes, the watch goes back to ordinary observation and keeps the marker — justified
  3. An ordinary tick that reads the same ending again settles the watch silently, with no second turn — justified
  4. The retry allowance after a busy refusal no longer fires while a delivered ending is unsettled — justified
  5. A definite still-open reading on ordinary observation clears the marker, so a reopen and the next close each get a turn — duplicate of the gone clear in _settle_delivered_terminal, gate.py
  6. A re-probe whose target no longer matches the monitor counts as unknown — justified
  7. The spec learn-cron-dashboard.md describes the three answers and the bound — justified

[FIRST-PRINCIPLES-REVIEWED] d1689c6

Description read

[DESCRIPTION-READ] 23f9d2439ed6087ce23d72678c45aed410ef7e261c75d3f27d3021f33aebeda1

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of d1689c6bead37405572db7ea16a75befe969e5a9 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The only new user-facing string, the shutdown refusal "The gateway is restarting, so this was not applied. Try again once it is back.", appears in the committed screenshot after-pause-restart.png. No blind reader has read it, because this fork lane has no blind read.

[UX-REVIEWED] d1689c6

Description read

[DESCRIPTION-READ] 750eb2d5f6a3186542e0327fc7bfbcc5c6886ffc3bb9858ad55e241d3fe17e8a

That sha256 names everything this verdict read: the PR description, plus the 5 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 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed d1689c6bead37405572db7ea16a75befe969e5a9 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d1689c6

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed d1689c6bead37405572db7ea16a75befe969e5a9 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d1689c6

@rubencu
rubencu force-pushed the fix/autonudge-delivered-reprobe-retention branch from 762310e to 52560e4 Compare October 10, 2026 00:29
@rubencu

rubencu commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Replayed onto #9052's new head b342f186. The blocking finding here (the detached completion child cancelling its own timer task on a budget-ending Slack wake) is in #9052's commit, not this one; #9052 round 31 fixes it with test_a_slack_wake_that_ends_its_monitor_still_posts_its_reply (three cases, failing on the old head and green on the fix). This PR's own commit is unchanged apart from a re-merge of one spec paragraph; review the top commit only.

@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 10, 2026
@rubencu
rubencu force-pushed the fix/autonudge-delivered-reprobe-retention branch from 52560e4 to be95bdb Compare October 10, 2026 03:15
@rubencu

rubencu commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Replayed onto #9052's round-32 head 5b2373c5df (main 950be416): be95bdbd01, same patch-id as 52560e4b, no conflicts; owning set 4,013 green, docs lint and diff --check clean, one commit on the base. Still stacked on #9052; its sibling #18647 was folded into #9052 and is now a draft.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 10, 2026
@rubencu
rubencu force-pushed the fix/autonudge-delivered-reprobe-retention branch from be95bdb to 2619780 Compare October 10, 2026 04:03
@rubencu

rubencu commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Replayed onto #9052's round-33 head f7db10a398: 2619780f3a, same patch-id as be95bdbd01, no conflicts, owning set 4,014 green. The GPT 6.1 block on be95bdbd01 was #9052's persist-before-publish finding in mutations.py, which this branch does not touch; it is fixed in #9052's round 33. The two test reds on be95bdbd01 were outside this diff: test_builtin_skill_sync_safety.py::test_carry_records_the_packaged_fingerprint on Windows shard 1 and the frontend auto-reverts the armed state after the timeout test on shard 4 (this PR changes no website/ file).

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 10, 2026
@rubencu
rubencu force-pushed the fix/autonudge-delivered-reprobe-retention branch from 2619780 to ef27931 Compare October 10, 2026 08:10
@rubencu

rubencu commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Replayed onto #9052's rebased head 45ab640653 (main d3f462f23b): ef2793125e, same patch-id as 2619780f3a, no conflicts; owning set 4,021 green, docs lint and diff --check clean. Still stacked on #9052.

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 10, 2026
@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • Severity: low: acknowledged, with no change here.

I agree with the reading: the refusal is rare and the user can recover from it. The text is main's, so the fix is the follow-up against main offered under 380bd5ceb39b.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • Replace the string with "Couldn't resume the paused goal, so nothing was sent. Press Play to try again.": declined here and offered as a follow-up.

The wording fits the banner and names the control. Since main already sends the old text from api_autonudge_fire, the change belongs in a PR against main that rewords every branch and its tests together, not in this stacked re-probe fix. If a maintainer wants it, that follow-up is the next step.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • Persist the reopened-subject marker clear before publishing it: fixed in d497d2dcbd.

The ordinary-path clear now follows the gone settlement's order. Under _lock, it writes a staged copy of the loop with terminal_delivered cleared (through _monitor_snapshot_with_replacement), and only then clears the live marker. A snapshot that another writer takes while this one waits for the lock therefore still stores the marker. A cancellation during the write still publishes the clear, because the writer re-raises only after the write has settled. A failed write leaves the live marker as stored, and the next open reading retries. A loop that was removed or retargeted while the tick waited for the lock is skipped.
test_MUTATION_a_reopen_publishes_the_cleared_marker_only_after_its_write_lands records the live marker at each write that stores the clear, fails the first such write, then lets the retry land. With the old order, the first clearing write runs with the live marker already empty, and the test fails on that.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

This round's review of d497d2dcbd needs no code change in this PR, so there is no push. The runs stay as they are.

The one CI red, Backend Tests (3.12, 2), is the test_facade_mirror_guards tree-scan timeout tracked in #22004. The Sensitive Change Review red is the API error ("Could not read the PR from the API"), and the Dependency License Gate red is the unsupported-repository error. None of them is this diff. Each finding has its own disposition below.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

The sizes: gate.py is 1,496 lines on main, 1,651 with #9052's commit and 1,807 with this PR's. mutations.py is 1,611 on main and 1,803 with #9052's commit (_retire_stale_stop_sentinel, _remove_admitted, _clear_terminal_monitor_admitted); this PR adds one line to it.
The plan:
(a) If the maintainer ships terminal_delivered in #9052, #9052's next round moves the delivered-terminal settlement (_settle_delivered_terminal, _publish_holds_settlement, _terminal_still_holds) into its own owner module under autonudge_service/, and this PR's _commit_delivered_settlement, _settle_observed_delivered_terminal and bound land in that module instead of gate.py.
(b) If the maintainer splits the marker out, the new marker PR creates that module, and this PR restacks on it.
Either way, #9052's admitted-transaction helpers move out of mutations.py into a module of their own in the same round. Both PRs merge only after that decision, so holding the move until then costs no merge time, and it avoids re-holding two approved heads for a layout that the decision would move again.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • The approval-hold refusal copy doesn't match the panel around it: declined here, because the string is not this PR's.

main's existing copy: api_autonudge_fire on main already returns "nudge not sent: the loop is paused for approval and could not be resumed, so press again" from its except Exception branch. #9052's commit, which this PR carries until #9052 merges, adds one more branch that returns the same text, and this PR's own commit does not touch it.
Rewording it would change main's message on every branch that sends it, so it belongs in its own change against main, which is offered as a follow-up with the wording in cb6ab53539bd.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • It starts lowercase, unlike its sibling sentence: declined here, for the same reason as 03ca91d16621.

The lowercase fragment is main's text. SERVICE_SHUTTING_DOWN_MESSAGE is new in #9052, so it was written as a full sentence. Bringing the older string to the same shape belongs in the follow-up against main offered under 03ca91d16621.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • "loop" is internal vocabulary; the panel says "goal": declined here, for the same reason as 03ca91d16621.

The word is in main's text. The follow-up against main offered under 03ca91d16621 would use the panel's "goal".

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • "press again" doesn't say which button: declined here, for the same reason as 03ca91d16621.

The phrase is main's text. Naming Play, the control that replaced the lightning button, belongs in the follow-up against main offered under 03ca91d16621.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • Severity: low frequency, moderate friction: acknowledged, with no change here.

I agree with the reading: the refusal is rare and the user has to guess the retry button. The text is main's, so the fix is the follow-up against main offered under 03ca91d16621.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • Fix: reword the string: declined here and offered as a follow-up.

main's existing copy: api_autonudge_fire on main already returns "nudge not sent: the loop is paused for approval and could not be resumed, so press again" from its except Exception branch. #9052's commit, which this PR carries until #9052 merges, adds one more branch that returns the same text, and this PR's own commit does not touch it.
Rewording it would change main's message on every branch that sends it, so it belongs in its own change against main, which is offered as a follow-up with the wording in cb6ab53539bd.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • No first-time reader has seen either refusal string: acknowledged, with no change here.

Both strings are rendered in the committed screenshots under temp-screenshots/9052-goal-restart/ (attachments 01 and 02), from the built dashboard with synthetic data. A first-time reader's check is a person's step, so the cap at CONCERNS stands until one reads them.

@rubencu

rubencu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author
  • Replace the approval-hold string with "Nudge not sent: the goal is paused for an approval and could not resume. Press Play to try again.": declined here and offered as the follow-up's wording.

The wording fits the panel and names the control. Since main already sends the old text from api_autonudge_fire, the change belongs in a PR against main that rewords every branch and its tests together, not in this stacked re-probe fix. If a maintainer wants it, that follow-up is the next step.

@rubencu

rubencu commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Restacked on #9052's new head 79a98a7c96, which resolves a conflict with main's #22217 in autonudge_service/firing.py (details on #9052). The new head is 5532128b48, one commit on #9052's head, and this PR's own seven files are patch-identical to d497d2dcbd. The branch now carries #9052's head commit itself instead of a replay of it.

Verified on 5532128b48:

  • every test_autonudge*.py and test_monitor_*.py module, the conductor patrol, slot-close race, workflow nudge wiring and Slack composition modules (2,921 tests);
  • every test_slack_gateway*.py module and the boot-path test (1,087), and main's new test/metrics/test_monitor_loop_counters.py (85);
  • the facade-mirror, link-screen and dashboard-files composition guards (139);
  • the 24 script gates, the flake and wait ratchets, and the max-two-commit push guard.

@rubencu

rubencu commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

New head ad5aa6676f, the single push for the round on 5532128b48. It fixes the GPT 6.1 BLOCK on gate.py: exhausted re-probes spent a stale terminal-delivery retry credit.

The finding holds. A busy session refuses the final fire, and the refusal grants one observation-free follow-up tick so the next tick retries the delivery. While the turn is owed the bypass never spends that credit, so it is still standing when the retry lands. After three unknown re-probes the settlement-only branch steps aside, and the follow-up bypass spent the credit and fired a second final turn instead of observing. The bypass now also requires not monitor.terminal_delivered, so with the marker kept the tick observes the subject, and a merged reading settles the watch without firing. This is the reasoning the bypass already applies to terminal_pending: a finished subject has no in-progress work for the allowance to protect.

test_exhausted_unknown_reprobes_do_not_spend_a_busy_retry_credit_on_a_second_turn drives that path through AutoNudgeService: a busy refusal, the delivered retry, three unknown re-probes, then the merged reading. It fails on 5532128b48 with a third fire and passes here. The commit message gains one sentence on the allowance; learn-cron-dashboard.md already states that the tick observes normally once the bound is reached, which the fix makes true.

The branch is restacked on main 0b89e0c6f7: #9052's commit is replayed as a8cb184f99, patch-identical to #9052's head 79a98a7c96, so #9052's own approved head is not moved.

Verified on ad5aa6676f:

  • every test_autonudge*.py and test_monitor_*.py module, the conductor patrol, slot-close race, workflow nudge wiring and Slack composition modules, and main's monitor-loop counters (3,007 tests);
  • fix(autonudge): drain admitted mutations through gateway shutdown #9052's owning set with this PR's modules (1,782), and every test_slack_gateway*.py module with the boot-path test (1,087);
  • the facade-mirror, link-screen and dashboard-files composition guards (139);
  • the 24 script gates, the flake and wait ratchets, and the max-two-commit push guard.

The Opus 5.5 lane did not complete on 5532128b48 ("review incomplete"), so it re-runs on this head.

@rubencu

rubencu commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Every run on ad5aa6676f has finished, and every lane is clean: GPT 6.1 and Opus 5.5 report no blocking findings, and Design, First Principles and UX pass. The Sensitive Change Review and the Dependency License Gate pass on this head too.

The one red is not this change's. Backend Tests (3.12, 5) failed in test/test_prepare_pr_local_review.py (test_cli_exits_40_on_a_contract_that_escapes_the_repo and test_prompt_file_contracts_are_remapped_like_every_other_lane), each with a shutil.Error: the session-scoped parity seed repo's .git/objects directories vanished while a test was copying them. The Coverage Gate and PR Readiness reds follow from that shard. This PR touches no prepare-pr code, and the module passes locally on this head twice in a row (140 tests each). A re-run of shard 5 should clear it.

@rubencu

rubencu commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Restacked on #9052's new head 7fa6681592 (its test-split rebase and the folded refusal arm; details on #9052). The new head is 7ee3626ab4, one commit on #9052's head, and this PR's own seven files are patch-identical to ad5aa6676f. The branch carries #9052's head commit itself again.

Verified on 7ee3626ab4:

  • every test_autonudge*.py and test_monitor_*.py module, the conductor patrol, slot-close race, workflow nudge wiring and Slack composition modules, and main's monitor-loop counters (3,007);
  • this PR's own two test modules on their own (52), and every test_slack_gateway*.py module with the boot-path test (1,087);
  • the facade-mirror, link-screen and dashboard-files composition guards (139);
  • the 24 script gates, the flake and wait ratchets, and the max-two-commit push guard.

The shard-5 flake from ad5aa6676f no longer applies to this head.

A channel terminal turn that landed is recorded in terminal_delivered
and settled by a provider re-probe. A re-probe that cannot read the
subject (no target or probe, a raised or unreachable fetch, the
kernel's fallback, an observation-less wake) cleared the marker in the
base behavior, so one unreadable probe could cost a repeated terminal
turn on the next ordinary tick.

The re-probe now answers holds, gone or unknown. An unknown answer
keeps the delivered marker and counts it in memory, so the next quiet
ticks re-probe without delivering. After three unknown answers the
settlement-only branch steps aside and ordinary observation resumes,
below the IRQ kernel's six-failure blind backstop, but the marker
stays: a reading whose classification matches it settles the watch
without firing again, a definite still-open reading clears it so a
reopen and a later close still get their turns, and the backstop's
wake still fires. The observation-free follow-up allowance stays shut
while the marker is kept, as it does while a terminal turn is owed, so
the retry credit a busy session's refusal left standing cannot fire a
second final turn once the bound is exhausted. The count is not
persisted; a restart resets it, which only buys a few more quiet
re-probes. A retarget, a settlement, a removal, a fresh delivery or a
stop drops it.

Every marker change is staged and written before the live monitor
takes it, so no other snapshot can store a clear that its own write
then fails to make durable.
@rubencu

rubencu commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Replayed 7ee3626ab4 -> d1689c6bea onto #9052's round head a2b4e7e606 (on main 4533b1eb5b), which carries the fix for #9052's Opus 5.5 finding (the accepted dashboard monitor turn sat in AutoNudge's shutdown drain). All seven of this PR's per-file patch IDs are identical to the previous head.

Every lane on 7ee3626ab4 was clean and every run on it finished green. Checked locally on this head: the #9052 owning and #18648 tests (1,736), every test_slack_gateway*.py module and the boot-path test (1,087), the broad AutoNudge and monitor set (3,007), the facade-mirror, link-screen and dashboard-files guards (139), the script gates, the flake-pattern and wait-discipline ratchets, and the max-two-commit push guard. The new head's runs wait at action_required for a maintainer.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD: this still carries #9052, which is open with active change requests. Reviewed at d1689c6.

The branch's first commit, a2b4e7e, is #9052's head. #9052 is still OPEN, labelled needs-author-decision, with CHANGES_REQUESTED reviews from bolichen97 and iamwhatever that have not been dismissed. Merging this PR would land #9052 without its review. The maintainer and the author already agreed this PR waits for #9052. That has not changed since our 2026-10-13 comment.

This PR's own commit has grown since that comment (now 7 files, +671/-90). I read it and found no defect. Unknown re-probes keep the marker up to _DELIVERED_REPROBE_UNKNOWN_LIMIT, then ordinary observation settles a matching terminal without firing again. The follow-up credit is not spent while a delivered terminal is unsettled. One current-head item is unanswered: First Principles note item 5 says the inline still-open clear (gate.py#L1173-L1220) duplicates the gone clear in _settle_delivered_terminal. Either route it through one path or reply on the PR saying why the two must stay separate.

To clear this hold: #9052 merges, this branch is rebased so only its own commit sits on main, and item 5 has a reply. That rebased head will need a fresh review.

— crew-pr-reviewer (r120)

@rubencu

rubencu commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

On item 5 of the crew-pr-reviewer HOLD (First Principles note: the still-open clear in _monitor_tick_is_quiet duplicates the gone clear in _settle_delivered_terminal): agreed. Both stage and persist the same cleared terminal_delivered marker the same way: a staged copy written under _lock, memory updated only after the write, and the re-probe count dropped. They differ in where they run. The settlement path already holds the loop's mutation lock inside the shutdown drain. The tick path holds no mutation lock, so it re-checks the loop's membership and monitor identity inside _lock. Their log lines differ too.

The next push of this PR routes both through one helper, and each caller keeps its own guard. That push waits for #9052: this branch carries #9052's head until it lands, and is then rebased so only its own commit sits on main.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at d1689c6.

This branch still carries #9052's head (a2b4e7e) as its first commit. #9052 is still open with undismissed change requests from bolichen97 and from us. Merging this PR now would land #9052 without its review.

Thank you for the reply on First Principles item 5. Routing the still-open clear (gate.py#L1173-L1220) and the gone clear through one helper, with each caller keeping its own guard, answers it. That change is not on this head yet.

To clear the hold: #9052 merges, and this branch is rebased so only its own commit sits on main, with the shared helper. That rebased head needs a fresh review. I found no defect in this PR's own commit. CI is green on this head; I ran no PR code locally.

Reviewed head: d1689c6

— crew-pr-reviewer (r121)

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

Reviewed current head d1689c6bead37405572db7ea16a75befe969e5a9 as Tier 2. Deep review found no blocking issue.

Security check: monitor ownership, credential rollback, admitted mutation drain, and terminal replay remain fail closed across cancellation and shutdown. Auto-merge remains subject to branch protection.

@rubencu

rubencu commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

The one-helper change for both delivered-marker clears that I described in this comment is not in this merge; it is tracked as a separate follow-up, together with the gate.py/mutations.py split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants