Skip to content

feat(autonudge): let a legacy loop declare it is waiting on a person - #21622

Open
kyleseaman wants to merge 2 commits into
fix/legacy-loop-agent-stopfrom
fix/legacy-loop-person-wait
Open

kyleseaman wants to merge 2 commits into
fix/legacy-loop-agent-stopfrom
fix/legacy-loop-person-wait

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A monitoring loop that has asked the user something can wait for their answer without spending its cycles or budget, and without being stopped.

A babysit loop that needs the user (approve a force-push by SHA, pick between two fixes) has nothing useful to do until they reply, yet it keeps firing a cycle every interval. Each cycle can only report "still waiting", spends one of the loop's cycles and its runtime budget, and trips the agent's own stall tripwire. A loop left waiting overnight ends on a spent bound, so the user comes back to a stopped loop rather than one waiting for them.

Stacked on PR #21621 (base fix/legacy-loop-agent-stop; #21377 below it is merged); review only this PR's two commits.

Restack onto the rebased #21621 (2026-11-16)

This PR's commit was restacked from 56d52517fa onto #21621 rebased on main. Where main changed the code it touched:

  • Prompt guidance moved. Main moved the monitor_update guidance out of src/kiro_crew/config/prompt.md into the kirocrew-dev/babysit skill (src/kiro_crew/builtin_skills/kirocrew-dev/babysit/SKILL.md), so the waiting_on_person sentence now lives in that skill's monitor_update bullet, word for word. This PR no longer edits prompt.md or its byte budget in test/test_prompt_compact_contract.py.
  • Card and agent sends. Main narrowed responsive_chat.notify_user_input's person check (person, card_origin). The human value this PR uses for human_input_generation and for the release now includes that narrowing, so a card's or an agent's send neither releases a declared wait nor counts as the person's reply.
  • Scrubbed frames. person_wait_expires_at / person_wait_ends_on_budget are set before main's per-field scrub in _serialize and in the state frame.
  • Budget wake. Main's runtime-budget wake skips a loop while waiting_on_person, which a declared wait sets, and the declared hold's expiry delay still bounds the sleep.
  • Main's newer gates. A docstring phrase the comment-history gate flags is reworded, and three until_parked(..., timeout=30) calls use the helper's default bound (flake-pattern ratchet K19).

Second commit, fix(autonudge): a turn opening for any sender leaves a declared person-wait held. Main added a release at every turn start, for any sender (dashboard/chat_turn/turn_entry.py, "a new turn started in the session"). This PR teaches release_approval_hold to end a declared wait too, so combined, a subagent completion, a cron or a conductor's send opening a turn released the wait as if the person had replied, and recorded person_wait_release: "person". The release path now takes person= (release_approval_hold_for → _schedule_release → release_approval_hold); the turn-start caller passes False and ends an approval hold only. A person's message, an answered approval and Nudge now keep True. Tests: test_a_new_turn_in_the_slot_does_not_release_a_declared_wait, test_a_new_turn_in_the_slot_still_releases_an_approval_hold, and test_dashboard_approval_window.py's turn-start release test now pins person=False; each failed before the fix.

UX Review fix (same second commit). The UX lane blocked eee6e71db0: pressing the labelled "Nudge now" ends the declared wait, so the button lost its label, shrank to the bolt, and Pause slid under the pointer that had just clicked. The label now stays until the popover closes (AutoNudgePopover.tsx, keepPlayLabel); a reopened popover on the released loop shows the plain bolt. The accessible name is unchanged. Test: Nudge now keeps its name until the popover closes, so the press that ends the wait does not slide Pause under the pointer (failed before the fix). It rides in the second commit rather than a third because PR Hygiene caps a PR at two commits; the second commit is the whole delta on top of this PR's reviewed commit.

Local GPT review fix (same second commit). A local gpt-6.1-sol review of the restacked head blocked timers.py _held_tick_delay: a declared hold with nothing to read armed one timer for its whole time to expiry, up to 24 hours. asyncio sleeps on the monotonic clock, which stops while a Linux/macOS host is suspended, so after a resume past the expiry that timer still owed its full sleep, and the expired hold suppressed nudges for up to another day. A declared hold now ticks one read interval (SUBJECT_READ_SECS, 5 minutes) out, or at its expiry when that is sooner. Each tick re-reads the expiry on the wall clock and fires nothing before it, which is the cadence a held loop naming a pull request already had. Tests, each failing before the fix: test_a_subject_less_declared_hold_arms_no_more_than_one_read_interval, test_a_host_suspended_past_the_expiry_ends_the_hold_at_its_next_tick (the wall clock jumps past the expiry while the monotonic clock stands still, and the next tick records person_wait_release: "expired"), and test_a_tick_before_the_expiry_re_arms_one_read_interval_out_and_fires_nothing. Five existing tests that pinned the old one-tick-at-expiry delay now pin the read interval. The monitor-architecture spec says the same.

Recording (built SPA, stubbed API, the gateway's autonudge_state frame pushed when /fire is hit): the press, the released "Goal active" state with the label and both buttons where they were, then close and reopen showing the plain bolt. The harness asserts the label survives the press, Play's and Pause's x positions do not change, and the label is gone after reopening.

nudge-now-press.webm

Before the press: Waiting on you, labelled Nudge now

After the press: Goal active, Nudge now keeps its label, Pause has not moved

Reopened: the released loop's Play is the plain bolt

Why it matters

Waiting on a person is the normal state of an unattended PR babysit between approvals. Today the loop either burns budget re-asking or the agent stops it and has to be re-armed by hand. A declared wait keeps the loop alive and cheap, and resumes it the moment the person is back.

Kyle asked for this behaviour. It is recorded in docs/request-for-change/rfc-legacy-loop-reads-stops-waits.md § 2.4 (RFC PR #22165, docs only), which this stack rebases onto once it merges; this PR edits no RFC. § 2.4 amends the non-goal "Holding any loop other than a work-ledger watch" of rfc-work-ledger-person-wait-hold.md for this one case; the ledger trigger and release are unchanged.

Not a goal

  • Changing the work-ledger person-wait hold, which keeps its own trigger and release.
  • Releasing on Slack or Discord thread replies: those never reach the dashboard's release signal, so the declaration is refused there, including from a dashboard chat linked to a Slack or other channel thread, whoever sent the turn.
  • Structured monitors (monitor_watch), which do not use this hold.

What changed (motivation → approach → change)

It reuses the work-ledger hold's fields and budget credit, marked as declared, and releases on an approval hold's signs.

  • autonudge_service/person_wait.py (new): declare_person_wait sets or ends the declared hold on the caller's own legacy loop, arming its first pull-request read.
  • autonudge_service/model.py: persisted person_wait_declared.
  • autonudge_service/firing.py: a declared hold runs the held tick (subject_reads.hold_tick) instead of a cycle; the ledger neither holds nor releases it; _commit_person_wait refuses a loop removed or deactivated under the lock. The two holds never overlap.
  • autonudge_service/subject_reads.py: a declared hold on a gated loop naming one pull request reads it every 5 minutes like an approval hold (an ungated one reads nothing, and its sleep toward expiry is one plain sleep); a merge or close settles it, crediting the held span.
  • autonudge_service/timers.py: release_approval_hold and _schedule_release end a declared wait too when the caller proves a person is back (person=True), crediting its span and refusing after shutdown; a turn opening for any sender (person=False) ends an approval hold only; _held_tick_rearms and the reconciler treat it as an approval hold.
  • autonudge_service/mutations.py: revival clears the mark; src/kiro_crew/autonudge.py binds the new owner.
  • mcp_tools/control_parts/monitor.py, mcp_tools/control_parts/schemas.py, validation_parts/core_agent_schemas.py: monitor_update(waiting_on_person: bool), legacy only.
  • dashboard/session_directive_person_wait.py (new), wired from dashboard/session_directive_apply.py: true needs a person's own turn or the loop's own wake; refused for cron/app producers, Slack/Discord bindings and chats linked to a channel thread (that link-store read runs off the event loop; the write is bound to the authorized loop), structured monitors and paused loops. If the person replied during the declaring turn (dashboard/responsive_chat.py's turn generation), the loop is not held. false on a work-ledger hold says the hold is the ledger's.
  • dashboard/handlers/autonudge.py, slack/gateway_runtime/nudge_wiring.py: monitor_inspect and the state frame carry person_wait_declared.
  • website/src/components/AutoNudgePopover.tsx and website/src/components/autoNudgeLoop.ts: the title reads "Waiting on you" while the loop runs (a paused loop keeps its title), the status offers this chat or Nudge now (enabled while held).
  • A declared wait is bounded: it expires at the earlier of 24 hours (PERSON_WAIT_MAX_SECS) and the end of the runtime budget left when it started (on the runtime_elapsed clock, so a host suspend cannot expire it; after a restart, created_ts + max_runtime_secs), and the expired span is charged to that budget. A release past the deadline counts as the expiry, checked on a clock read after the deadline is computed; a failed expiry write on Nudge now answers 503. person_wait_release records why it ended (expired, person, agent); the loop row, the autonudge_state frame and monitor_inspect carry it, plus person_wait_expires_at while it holds. Declared over a work-ledger hold, it credits that span back and starts its own clock. The popover's held line leads with the outcome ("Nudges resume at 1:00 AM tomorrow (in 19h) if you don't reply.", or "The goal ends at ..." when the budget ends the wait); after an expiry: "No reply came in time, so nudges resumed.", minus the last clause when the expiry ended the loop
  • website/src/i18n/locales/*.json: the new title, status, end-time and expiry keys in every locale.
  • website/src/monitoring/automation.ts and website/src/components/SessionAutomationPopover.tsx: the automation normalizer and session popover carry the field.
  • docs/system-specs/modules/monitor-architecture.md, src/kiro_crew/builtin_skills/kirocrew-dev/babysit/SKILL.md: the declared hold, and the one sentence that allows a declaration only after a blocking question.

Backwards compatibility

Compatible: person_wait_declared defaults to false; waiting_on_person is a new optional monitor_update field; work-ledger holds and approval holds behave as they do on the base.

Removes nothing: no field, key, route or behavior is removed.

Tests

  • test/test_autonudge_declared_person_wait.py (new): a declared hold fires no cycle and spends neither bound, crediting the span back; a dashboard message releases it and a non-human send does not; an answered approval and Nudge now release it; ledger movement neither holds nor releases it, even when a declaration lands during the ledger read; a replacement loop armed during the declaring turn's mirror probe is not held; a declaration over a work-ledger hold starts its 24-hour clock at the declaration, and a re-declaration keeps its start; a declaration on a pull request arms its read, and the declaring turn's end keeps that read rather than the deadline (a wait with nothing to read arms a read-interval tick that reads nothing); a merged or closed pull request settles a declared hold on a gated loop and clears it on disk, spending none of the budget (its settlement clock pinned); a declared hold on an ungated loop survives its pull request merging, reading nothing and re-arming one read interval out; an open or unread one keeps it held and re-arms at the read interval; a person back during the read is not settled; the reconciler rescues a declared hold's read and leaves one with nothing to read unarmed; revival clears it; it survives a restart; declaring during an approval hold writes nothing and leaves the loop held; an unanswered approval during a declared wait records no approval hold; a row carrying both marks credits one span; a Stop queued ahead of the declaration or release is not resurrected; a reply before or during the declaration write leaves the loop unheld; the applier works from a person's turn and the loop's own wake and is refused for cron/app producers, Slack/Discord bindings, a Slack thread linked to a dashboard slot (a person's turn or the loop's own wake), structured monitors and paused loops; it combines with message; false releases, and on a ledger hold says so; a refused write after a combined patch reports the fields that landed; shutdown drains a declaration admitted before closure and refuses a declared wait's release after it; a person or agent release after the deadline is an expiry with no refund; a stored person_wait_release of [] or {} loads as "" and keeps the loop.
  • test/test_autonudge_declared_person_wait.py also: a wait declared after a host suspend keeps the runtime budget's remainder; test/test_autonudge_manual_fire.py: Nudge now on an expired wait whose expiry write fails answers 503; a person or agent release after a spent live budget is an expiry on a clock that moves during the check; an ungated declared wait's sleep runs no read.
  • website/src/test/AutoNudgePopover.test.tsx: the new status line, its time left and clock across midnight, no "Waiting on you" title on a paused loop, both expiry lines, Nudge now enabled past the deadline, and its visible label only while held; automationNormalizer.test.ts: the field.
  • Contract pins in test_autonudge_refactor_contract.py and test_autonudge_handlers_cov80.py.
  • Each review fix was revert-verified (its test goes red with the fix removed).

Manual verification

The built dashboard on loopback with stubbed APIs, captured by an uncommitted Playwright script, which asserts the status line equals the catalog copy, that the one Nudge now control is enabled with the deadline long past, and that its "Nudge now" label is visible. The babysit skill's sentence only lets an agent declare after it has asked the user a question in this chat, and names the 24-hour bound. Local gates: the related backend set, isort, flake8, black, mypy, comment-history, line cap, the flake-pattern ratchet, tsc -p tsconfig.app.json, the related vitest files and the i18n check.

Declared hold: title "Waiting on you", "The agent asked you a question. Reply in this chat, or press Nudge now to continue without answering. Nudges resume at 1:00 AM tomorrow (in 19h) if you don't reply." with Nudge now labelled and enabled

After an expiry: muted line "No reply came in time, so nudges resumed." under the goal's countdown

Declared hold that ends with the goal's runtime budget: "The goal ends at 3:41 AM (in 2h) if you don't reply."

After an expiry that spent the runtime budget: title "Paused", "Paused · time limit reached", and the muted line "No reply came in time."

Related Issues

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

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 17, 2026 14:34
@kyleseaman
kyleseaman requested review from dodgeblaster and removed request for a team October 17, 2026 14:34
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. The screenshots and the recording show the waiting state, the release, the label kept until the popover closes, and the "No reply came in time" line.

Notes

  • The text for a wait that ends when the runtime budget runs out (waiting_on_person_declared_ends_budget, "The goal ends at {{time}}…") and the person_wait_expired_inactive line appear in no screenshot. Attach one still of each so the copy that says the goal stops gets seen.
  • fmtRelative cuts the countdown down to whole hours, so "11:14 PM tomorrow (in 23h)" next to a 11:09 PM last fire looked wrong to the blind reader ("closer to 24 hours"). Round the countdown, or drop it when the day word is already there.
  • The reader could not see why nudges resume "a day away" on a 300-second timer. In waiting_on_person_declared_ends, add the reason, e.g. "If you don't reply, nudges resume at {{time}}, after the 24-hour wait limit."

[UX-REVIEWED] dd9a003

Description read

[DESCRIPTION-READ] e558d9e711ae17908d60a4b13d100f70264c2e73a692a11ab4523690abed10b7

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🔴 BLOCK

Premise-level review of dd9a003489f3faec5f5a1c8888d90747cb2c0b01 — 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: BLOCK

product-shape change without accepted RFC: this PR holds a legacy loop, which the base's implemented RFC excludes ("Holding any loop other than a work-ledger watch"). The RFC that would amend that exclusion is not on the base.

What this change ships

Inventory (10 items) — 9 justified

Intent: let a babysit loop that has asked the user something wait for their reply without spending cycles or budget, and without being stopped. This is an ADDITION.

  1. The agent can declare waiting_on_person: true/false on monitor_update (MCP schema plus validation field) — product shape, no recorded decision
  2. A held legacy loop fires no cycles and has its held time credited back to its budget — justified
  3. The babysit skill now tells the agent to declare a wait after asking the user a question — justified
  4. A person's reply, an answered approval or Nudge now ends the wait; any other sender opening a turn does not — justified
  5. A wait expires after at most 24h, and never past the loop's runtime budget — justified
  6. A held loop that names a pull request reads it every 5 minutes, and a merge or close settles the hold — justified
  7. A declared hold re-checks its expiry every 5 minutes, so a suspended host does not stretch it — justified
  8. The declaration is refused from Slack, Discord or a dashboard chat linked to a channel thread — justified
  9. The popover shows a "Waiting on you" state, its end time and an expiry line, in 14 locales — justified
  10. The Nudge now label stays until the popover closes — justified

Blockers

product-shape change without accepted RFC: declared person-wait on a legacy loop — item 1
Trigger: the base RFC list shows rfc-work-ledger-person-wait-hold.md:status: implemented, and that RFC lists "Holding any loop other than a work-ledger watch" as a non-goal. The description says the shape "is recorded in docs/request-for-change/rfc-legacy-loop-reads-stops-waits.md § 2.4 (RFC PR #22165, docs only), which this stack rebases onto once it merges". That file does not appear in the base RFC list.
Outcome: the shipped babysit skill and monitor_update change what a running loop does while it waits, and they reverse a recorded non-goal with no decision on record.
Clears when: an RFC covering a declared person-wait hold on legacy loops is merged with a non-draft status and the branch is pushed or rebased onto it, or a maintainer posts /ai-review override first-principles dd9a003489f3faec5f5a1c8888d90747cb2c0b01 product-shape: <decision>.

[FIRST-PRINCIPLES-REVIEWED] dd9a003

Description read

[DESCRIPTION-READ] aa18b73606a2c0745ca71c432413585644522c75f6211bada6bb103dbfef562a

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the declared wait reuses the existing hold fields, budget credit and release path, and only a sender that proves a person is back can end it.

Notes

  • person defaults to True on release_approval_hold, _schedule_release and release_approval_hold_for, so a new caller that leaves it out releases a declared wait for any sender. Requiring the keyword would stop a future turn-start-style caller from quietly ending the wait. The cost of the mistake is low: the loop just resumes its cycles.
  • The ## Backwards compatibility section falls past the [description TRUNCATED cut, so I did not judge reader listing. The take-away I checked was release_approval_hold's new person= keyword. Its in-tree callers either answer an approval, handle a person's message or are a manual fire, all of which keep the default, or are the turn start, which passes False.

[DESIGN-REVIEWED] dd9a003

Description read

[DESCRIPTION-READ] fd7fa294cdb5638db8e908bbaa03fd48280819d0bf5089b5031b45878e380e36

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

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] dd9a003

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

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] dd9a003

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable dd9a003489f3faec5f5a1c8888d90747cb2c0b01 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 17, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-agent-stop branch from a7a099d to 658ee07 Compare October 18, 2026 21:18
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-person-wait branch from c7dee41 to 4c89dc5 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-agent-stop branch from 658ee07 to cdac1cb Compare October 18, 2026 22:45
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-person-wait branch from 4c89dc5 to 73108ab Compare October 18, 2026 22:48
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision 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-agent-stop branch from cdac1cb to 0998665 Compare October 18, 2026 23:35
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-person-wait branch from 73108ab to bdb8c73 Compare October 18, 2026 23:36
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Oct 18, 2026
@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: checking Automated validation is still running labels Oct 20, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-person-wait branch from 99eceb0 to 964cac2 Compare October 20, 2026 05:06
@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 20, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-person-wait branch 2 times, most recently from 3581a0a to c45ccfa Compare October 20, 2026 05:54
@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=35099d78930c needs-a-decision

The amendment of rfc-work-ledger-person-wait-hold's non-goal is RFC #22165 § 2.4, a docs-only PR against main that the maintainer asked for instead of an override. It clears when that PR merges and this stack is rebased onto it; merging it is the maintainer's call.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=2fe3489fe350 needs-a-decision

The pull-request read is part of the recorded shape, not an addition: RFC #22165 § 2.4 'Held' says a declared wait reads its one named pull request each held tick and settles on merge or close, reusing § 2.1 so a held babysit loop does not sit paused on a finished subject. It is the same decision the maintainer is merging, so it clears with the same merge and rebase.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=8469f1c89703 needs-a-decision

Covered by RFC #22165 § 2.4, including the prompt.md sentence (declare only after a question the agent cannot proceed without, 24-hour bound). This branch is rebased onto main once the maintainer merges #22165; no override will be posted.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=5ea228060aeb rebutted

The question is the agent's last message in this same chat, directly behind the popover, which is why the line says 'Reply in this chat'. The popover has no copy of it to show: the hold records that the agent is waiting, not what it asked, and duplicating model text into the loop record is out of scope here.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=cbe0b71ae2e8 rebutted

The title 'Waiting on you' and the line 'The agent asked you a question' state that the regular nudges are stopped while it waits; the end line then says when they come back. Repeating 'nudges are paused' would lengthen a status the previous round asked to shorten.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=3bc69141bca7 rebutted

Kept as designed: the visible 'Nudge now' label appears only while the wait holds because that is when the button means something new (continue without answering). It is the same control in the same place with the same accessible name before and after.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=73e6f97dd1f4 rebutted

Both strings are pinned by tests that render them: 'The goal ends at …' in SessionAutomationPopover.test.tsx (the bridge case with the runtime budget) and AutoNudgePopover.test.tsx, and 'No reply came in time.' in the expiry test's inactive branch. The attached frames show the two common states; Screenshot Evidence passes on this head.

@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 20, 2026
@kyleseaman
kyleseaman force-pushed the fix/legacy-loop-agent-stop branch from 70e7db7 to e3775ea Compare October 23, 2026 20:31
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 23, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=6e84f856c4cb needs-a-decision

Covered by RFC #22165 § 2.4, including the prompt.md sentence (declare only after a question the agent cannot proceed without, 24-hour bound). This branch is rebased onto main once the maintainer merges #22165; no override will be posted.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=dc6b1620be5a rebutted

Accepting the adjudication (downgraded, disproportionate remedy). A suspend can only make a declared wait end later, by at most the suspended time, and a person coming back releases it at once; nothing is lost and every other asyncio.sleep idle interval in the service slips the same way. The budget bound itself already runs on the runtime_elapsed clock. A suspend-aware wall-clock recheck in the reconciler for this one path is not added.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=19ca346c3827 fixed

Fixed in 9e465fd. sleep_until_cycle now takes one plain sleep for any loop held for a person (_holds_for_a_person: an approval hold or a declared wait), both on entry and when a hold lands mid-sleep, where it previously skipped only approval holds. A held loop reads only through hold_tick, and only a gated one reads at all. New test test_an_ungated_declared_wait_sleeps_without_reading_its_pull_request sleeps an hour on a gate=False declared wait naming a pull request and asserts no read and one 3600 s sleep. It fails on 68c9f30 and passes with the fix.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=b2c4f1f3f516 fixed

Fixed in 9e465fd. Both release paths (_release_approval_hold_admitted in timers.py and _commit_person_wait in firing.py) now ask the new model.person_wait_has_expired, which computes the expiry first and reads the wall clock after it, so a spent live budget projected as now-plus-zero always counts as expired. The two other expiry checks already read the clock after the projection. New tests test_a_late_person_release_on_a_spent_live_budget_is_an_expiry and test_a_late_agent_release_on_a_spent_live_budget_is_an_expiry run on a clock that moves forward on every read, with the live budget anchor in place. Both fail on 68c9f30 (release recorded as person and agent, budget refunded) and pass with the fix.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=1eb31b4990d0 needs-a-decision

Covered by RFC #22165 § 2.4, which amends the base RFC's non-goal and records the prompt.md sentence (declare waiting_on_person: true only after a question the agent cannot proceed without; bounded by 24 hours or the remaining runtime budget). This branch is rebased onto main once the maintainer merges #22165; no override will be posted.

A babysit loop that has asked the user something (approve a force-push by
SHA, choose between two fixes) kept firing a cycle every interval that could
only report it was still waiting, spending its cycle cap and runtime budget
until a bound stopped it. monitor_update(waiting_on_person=true) now declares
that wait: the loop fires no cycle and spends neither bound, and it is
released by the same signs a person is back that end an approval hold (a
message in the dashboard chat, an answered approval, Nudge now), or by the
agent passing false. A declared hold on a loop that names one pull request
reads it every five minutes, like an approval hold, and settles the loop when
the pull request merges or closes; a loop naming none arms nothing. True is
refused from cron/app producers, on Slack and Discord bindings (their replies
never reach the release), for structured monitors and for inactive loops.
The popover shows "Waiting on you · reply in this chat or press Nudge now to
resume."
…n-wait held

main's turn-start release (turn_entry, any sender) reached release_approval_hold,
which this PR taught to end a declared person-wait too, so a subagent completion,
cron or conductor send released the hold as if a person had replied. The release
now takes person=; the turn-start caller passes False and ends an approval hold
only.

Also keep the Nudge now label until the popover closes: pressing it ends a
declared wait, which dropped the label and shrank the button to its icon,
sliding Pause under the pointer that had just clicked.

Also tick a declared hold at least every SUBJECT_READ_SECS. asyncio sleeps on
the monotonic clock, which stops while a host is suspended, so a hold armed for
its whole 24-hour expiry still owed that sleep after a resume past the expiry
and stayed held up to another day. Each tick re-reads the wall-clock expiry and
fires nothing before it.
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Pushed dd9a003489f3faec5f5a1c8888d90747cb2c0b01, two commits on #21621's b597169a7cf453d6ccc8862b312722a620876bf2.

UX Review block on eee6e71db0 (Nudge now lost its label and slid Pause under the pointer): fixed in the second commit. The label now stays until the popover closes (AutoNudgePopover.tsx, keepPlayLabel). A popover reopened on the released loop shows the plain bolt, and the accessible name is unchanged. A vitest test covers it and failed before the fix. The recording and three stills are in the description. UX Review passes on dd9a003489f3faec5f5a1c8888d90747cb2c0b01.

Local GPT review finding (timers.py _held_tick_delay): a declared hold with nothing to read armed one timer for its whole time to expiry, up to 24 hours. asyncio sleeps on the monotonic clock, which stops during a host suspend, so after a resume past the expiry the hold stayed held for up to another day. It is fixed in the second commit: a declared hold now ticks one read interval (5 minutes) out, or at its expiry when sooner. Each tick re-reads the wall-clock expiry and fires nothing before it. Three new tests failed before the fix, including a suspend simulation where the wall clock jumps while the monotonic clock stands still. A fresh gpt-6.1-sol review of the second commit found nothing, and the GPT 6.1 Review lane passes on dd9a003489f3faec5f5a1c8888d90747cb2c0b01.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

UX Review notes on dd9a003489f3faec5f5a1c8888d90747cb2c0b01:

  • Stills for the budget-ending wait and the stopped-loop expiry: taken. Both are now in the description. One shows a declared hold whose wait ends with the runtime budget ("The goal ends at … (in 2h) if you don't reply."). The other shows an expiry that spent the budget, where the popover reads "Paused · time limit reached" with "No reply came in time." Both come from the built SPA with a stubbed API, and the harness checks each line against the catalog copy. This is a description-only change, with no new commit.
  • Rounding the "in Nh" countdown: left as is. The countdown comes from fmtRelative in i18n/format, the app-wide relative-time formatter, which the app SDK also exports. Rounding it here would change every relative time in the app, so that belongs in its own change.
  • Naming the 24-hour limit in waiting_on_person_declared_ends: left as is. It is a copy change in every locale catalog this PR edits (13 files), and the line already gives the exact time nudges resume. The 24-hour bound is stated in the babysit skill the agent reads before declaring. The 300-second figure in the form is the nudge interval, which does not apply while the loop is held.

This branch has not been deployed

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

Labels

readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant