Repository navigation
fix(monitor): let the owner clear a stopped automation record - #9788
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of The change is well-scoped and I've verified the conventions it relies on ( Design-Verdict: PASS Builds the exact operation the retention rule always presupposed, at the existing authz chokepoint, with the race closed where the state lives. [DESIGN-REVIEWED] d9bdf18 |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of All evidence reviewed: blind read reconciled against the diff, all four screenshots inspected, backend error strings checked, and the legacy goal button confirmed to fire the irreversible DELETE directly with no confirmation step. UX-Verdict: CONCERNS The monitor clear is understood and guarded; the legacy goal's identical irreversible erase is one unguarded, grey, single click. Watch
Suggestions
[UX-REVIEWED] d9bdf18 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All counts I need are run. Assembling the review. First-Principles-Verdict: PASS The relabels rest on "a blind reader refused to press it" — an observation asserted in the description only; confirm that read actually happened. What this change shipsInventory (10 items) — 10 justifiedIntent: let the owner remove a stopped monitor's retained record so the session can watch something else — a FIX (repro in description; negative controls show 8/9 new tests fail on base).
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] d9bdf18 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsFINDING -- website/src/components/SessionAutomationPopover.tsx:695 -- Self-armed crew/member monitors can stop, but [GPT-REVIEWED] d9bdf18 False positive or not applicable? A repository writer can comment: |
A user-stopped monitor record is retained as evidence and refuses a re-arm,
which is deliberate. The way out that refusal names did not exist: DELETE
/api/autonudge/{loop_id} routed a structured monitor into stop_monitor, which
returns an already-terminal loop unchanged, then answered ok. The dashboard's
own button reported success and removed nothing, and the restart route only
revives the same subject. A session that stopped watching one pull request
could never watch another one.
DELETE now splits by state. A live monitor is still stopped, retaining its
outcome. An already-terminal one is cleared through a new
authorize_and_clear_monitor: owner-gated, audited as monitor_clear, and
refusing a live monitor, a future-version record and a wake in flight.
The popover's button says Clear record instead of Stop loop once the loop is
inactive, since that press removes the row rather than stopping anything.
4a7d393 to
b566180
Compare
b566180 to
faca578
Compare
Review round 1 on the clear path.
GPT (blocking): the terminal-state checks ran before the audit, and the audit's
to_thread yields the event loop, so a close-rollback restore landing in that
window met an unconditional remove and lost a live watch. The removal now
re-takes the decision inside the service's own lock hold via a new
clear_terminal_monitor, and refuses with 409 when the row moved on.
UX (blocking): a blind reader would not press "Clear record" because the popover
shows nothing called a record, so the one control that unsticks the session went
unpressed. The label names the object ("Clear stopped goal"), the status reads
"Stopped" instead of the resumable-sounding "Paused", and a help line names both
exits because the erase has no undo.
Design (concerns): the verb's meaning was decided by server state, so a stale
"Stop loop" press could erase a record that went terminal in between. The DELETE
now carries the pressed intent and the server 409s on a mismatch.
First principles (subtractions): dropped the zero-consumer `cleared: true`
response key and the unused `auto-nudge-stop` test id.
faca578 to
d9bdf18
Compare
Follow-through on the UX review of #9788, which merged with the finding open. Both surfaces now erase a stopped automation for good, but only the monitor's was guarded: the legacy goal view's "Clear stopped goal" fired the DELETE on one plain grey click. A blind reader named it: "this delete button is plain grey with no warning colour, which makes it easier to hit by mistake" and "I cannot tell whether it deletes instantly with no are-you-sure". The legacy control is now danger-coloured unconditionally (not on :hover, which a touch viewport never produces) and asks first, reusing the monitor surface's two-step. The confirmation replaces the primary CTA rather than sitting beside it, so the row keeps its two-control cap. Both confirm labels now restate the action and its object, because neither confirm row renders a question: "Yes, clear it" answered one that was never asked. They read "Clear goal for good" and "Clear monitor for good".
Follow-through on the UX review of #9788, which merged with the finding open. Both surfaces now erase a stopped automation for good, but only the monitor's was guarded: the legacy goal view's "Clear stopped goal" fired the DELETE on one plain grey click. A blind reader named it: "this delete button is plain grey with no warning colour, which makes it easier to hit by mistake" and "I cannot tell whether it deletes instantly with no are-you-sure". The legacy control is now danger-coloured unconditionally (not on :hover, which a touch viewport never produces) and asks first, reusing the monitor surface's two-step. The confirmation replaces the primary CTA rather than sitting beside it, so the row keeps its two-control cap. Both confirm labels now restate the action and its object, because neither confirm row renders a question: "Yes, clear it" answered one that was never asked. They read "Clear goal for good" and "Clear monitor for good".
Follow-through on the UX review of #9788, which merged with the finding open. Both surfaces now erase a stopped automation for good, but only the monitor's was guarded: the legacy goal view's "Clear stopped goal" fired the DELETE on one plain grey click. A blind reader named it: "this delete button is plain grey with no warning colour, which makes it easier to hit by mistake" and "I cannot tell whether it deletes instantly with no are-you-sure". The legacy control is now danger-coloured unconditionally (not on :hover, which a touch viewport never produces) and asks first, reusing the monitor surface's two-step. The confirmation replaces the primary CTA rather than sitting beside it, so the row keeps its two-control cap. Both confirm labels now restate the action and its object, because neither confirm row renders a question: "Yes, clear it" answered one that was never asked. They read "Clear goal for good" and "Clear monitor for good".
Reverts #5185 and its three follow-ups (#9788, #9845, #10190), which replaced the composer's generic monitor/auto-nudge popover with a pull-request-only "Bounded pull request monitor" form. The composer trigger opens AutoNudgePopover again, so a session can arm a goal loop for any target from the dashboard instead of being asked for a GitHub pull request URL. The frontend automation-record layer #5185 introduced goes with it: SessionAutomationPopover, MonitorRadar, the monitoring/automation normalizer and its contract.json, the per-slot REST automation snapshots in ChatPage / ChatSidebar / chatSlice / useWebSocket, and the sessionAutomationPopover catalog block in all 13 i18n catalogs. The follow-ups' clear-a-stopped-record path goes with it too, since both surfaces it guarded were part of that layer. The monitor_watch MCP tool and the src/kiro_crew/monitoring structured-monitor engine are untouched: agents can still arm, inspect and stop a bounded monitor. Only the fields and routes #5185 itself added for the dashboard surface are removed with it. Conflict resolutions worth naming, all preserving post-#5185 unrelated work: - The 13 i18n catalogs plus en.manual.json keep every key intervening commits added; only the sessionAutomation / bounded-monitor keys are removed. - ChatSidebar keeps its pending_decision status row and ChatPage its extended dependency list; ChatSliceCoverage keeps the fetchSlots import a later commit started using. - learn-cron-dashboard.md keeps the provider-evidence and legacy-cap paragraphs that landed after #5185, and drops the AutomationRecord SPA spec block. - The babysit skill no longer points at the removed Clear stopped monitor control. - The throwaway temp-screenshots evidence files from #9845 and #10190 are deleted rather than restored.
Reverts the dashboard layer of #5185 and its follow-ups (#9788, #9845, with a pull-request-only "Bounded pull request monitor" form. The composer trigger opens AutoNudgePopover again, so a session can arm a goal loop for any target from the dashboard instead of being asked for a GitHub pull request URL. The frontend automation-record layer #5185 introduced goes with it: SessionAutomationPopover, MonitorRadar, the monitoring/automation normalizer and its contract.json, the per-slot REST automation snapshots in ChatPage / ChatSidebar / chatSlice / useWebSocket, and the sessionAutomationPopover catalog block in all 13 i18n catalogs. The generic popover keeps the clear-stopped-record control #9788 and #9845 added: a stopped record is cleared with a confirm two-step that sends DELETE ?intent=clear, so an agent-armed monitor that was stopped by a session close or user stop still has an exit from the dashboard. Nothing under src/kiro_crew/ or test/ changes. The monitor_watch MCP tool, the src/kiro_crew/monitoring engine, the backend clear route and the retention refusal are all as on main. A committed capture harness, website/scripts/capture-goal-popover-generic.mjs, opens the built SPA, clicks "Set a goal" and fails if the popover carries a pull request URL field or a "legacy goal loop" call to action.
Reverts the dashboard layer of #5185 and its follow-ups (#9788, #9845, with a pull-request-only "Bounded pull request monitor" form. The composer trigger opens AutoNudgePopover again, so a session can arm a goal loop for any target from the dashboard instead of being asked for a GitHub pull request URL. The frontend automation-record layer #5185 introduced goes with it: SessionAutomationPopover, MonitorRadar, the monitoring/automation normalizer and its contract.json, the per-slot REST automation snapshots in ChatPage / ChatSidebar / chatSlice / useWebSocket, and the sessionAutomationPopover catalog block in all 13 i18n catalogs. The generic popover keeps the clear-stopped-record control #9788 and #9845 added: a stopped record is cleared with a confirm two-step that sends DELETE ?intent=clear, so an agent-armed monitor that was stopped by a session close or user stop still has an exit from the dashboard. Nothing under src/kiro_crew/ or test/ changes. The monitor_watch MCP tool, the src/kiro_crew/monitoring engine, the backend clear route and the retention refusal are all as on main. A committed capture harness, website/scripts/capture-goal-popover-generic.mjs, opens the built SPA, clicks "Set a goal" and fails if the popover carries a pull request URL field or a "legacy goal loop" call to action.
Reverts the dashboard layer of #5185 and its follow-ups (#9788, #9845, #10190), which replaced the generic goal-loop popover with a pull-request-only "Bounded pull request monitor" form. The composer trigger opens AutoNudgePopover again, so a session can arm a goal loop for any target from the dashboard instead of being asked for a GitHub pull request URL. The frontend automation-record layer #5185 introduced goes with it: SessionAutomationPopover, MonitorRadar, the monitoring/automation normalizer, the per-slot REST automation snapshots in ChatPage / ChatSidebar / chatSlice / useWebSocket, the dead api.monitorClear client method, and the sessionAutomationPopover catalog block in all 13 i18n catalogs. website/src/monitoring/contract.json stays: test/test_monitor_persistence.py reads it as the backend parity artifact. Two fixes #5185 carried incidentally stay in the restored wiring. The goal-loop seed and the autonudge_state frame fold channel slot keys (slack:<ts>) to the dashboard filename form (slack_<ts>) through website/src/utils/dashboardSlotKey.ts, matching _normalize_slot_key on the backend, so a channel-bound loop lights its sidebar row. Every seed takes its own generation, so two overlapping reconnect seeds cannot let the older snapshot overwrite the newer one, and ChatPage's per-slot loop fetch is dropped when a live autonudge_state frame for that slot lands first. The popover keeps the viewport-fit classes (max-h / overflow-y-auto, stacked number fields on narrow widths). The generic popover keeps the clear-stopped-record control #9788 and #9845 added: a stopped record is cleared with a confirm two-step that sends DELETE ?intent=clear, so an agent-armed monitor that was stopped by a session close or user stop still has an exit from the dashboard. The popover's fresh-state defaults change in two small ways: Max cycles starts at 24 (0 still means no cap, and an existing loop's 0 is shown as 0), and the helper text says a Stop loop button appears while the loop runs and that the stop-file name in the goal is filled in at start (components.autoNudgePopover.stop_loop_hint, all 14 catalogs). Nothing under src/kiro_crew/ or test/ changes. The monitor_watch MCP tool, the src/kiro_crew/monitoring engine, the backend clear route and the retention refusal are all as on main. A committed capture harness, website/scripts/capture-goal-popover-generic.mjs, opens the built SPA, clicks the composer trigger in three stubbed states (no loop, active loop, stopped record plus its confirm row) and fails if the popover carries a pull request URL field or a "legacy goal loop" call to action. Its frames are committed under temp-screenshots/goal-popover-generic/.
Reverts the dashboard layer of #5185 and its follow-ups (#9788, #9845, #10190), which replaced the generic goal-loop popover with a pull-request-only "Bounded pull request monitor" form. The composer trigger opens AutoNudgePopover again, so a session can arm a goal loop for any target from the dashboard instead of being asked for a GitHub pull request URL. The frontend automation-record layer #5185 introduced goes with it: SessionAutomationPopover, MonitorRadar, the monitoring/automation normalizer, the per-slot REST automation snapshots in ChatPage / ChatSidebar / chatSlice / useWebSocket, the dead api.monitorClear client method and its stale test mock, and the sessionAutomationPopover catalog block in all 13 i18n catalogs. website/src/monitoring/contract.json stays: test/test_monitor_persistence.py reads it as the backend parity artifact. Three behaviours #5185 carried incidentally stay in the restored wiring. The goal-loop seed, the autonudge_state frame and ChatPage's per-slot listener fold channel slot keys (slack:<ts>) to the dashboard filename form (slack_<ts>) through website/src/utils/dashboardSlotKey.ts, matching _normalize_slot_key on the backend, so a channel-bound loop lights its sidebar row and its live frames reach the open popover, and a monitor's frame feeds the sidebar the same agent-turn accounting the REST seed does. Every seed takes its own generation, so two overlapping reconnect seeds cannot let the older snapshot overwrite the newer one, and ChatPage's per-slot loop fetch is dropped when a live autonudge_state frame for that slot lands first. When that fetch fails, the popover says so and withholds Save / Start / Trigger behind a Retry loading button instead of offering an empty editor whose Start the existing loop would refuse. The popover keeps the viewport-fit classes (max-h / overflow-y-auto, stacked number fields on narrow widths). A structured monitor armed through the MCP monitor tools reaches the legacy slot read as a reduced row with no message, banner or stop-file path. The popover recognises both transports of that row (the REST read withholds message; the live autonudge_state frame carries a monitor object, so isReducedMonitorRow keys on either) and shows only what the backend will honour: a notice that an agent armed a bounded monitor, the schedule line, Stop loop while it runs, and the clear-stopped-record two-step once it stops. Save, Start and Trigger, which the backend refuses for that row with structured_monitor_requires_monitor_api, are not rendered for it. AutoNudgeLoop.message is optional to say so; the one other reader (MembersPage's patrol row) falls back to an empty string. The generic popover keeps the clear-stopped-record control #9788 and #9845 added: a stopped record is cleared with a confirm two-step that sends DELETE ?intent=clear, so an agent-armed monitor that was stopped by a session close or user stop still has an exit from the dashboard. The popover's fresh-state defaults change in two small ways: Max cycles starts at 24 (0 still means no cap, and an existing loop's 0 is shown as 0), and the helper text says a Stop loop button appears while the loop runs and that {{STOP_FILE}} in the goal is replaced with a real file path at start (components.autoNudgePopover.stop_loop_hint; the moustache is passed as an interpolation value so i18next renders it literally). The three new strings and the reworded hint are translated in all 11 human catalogs; en-XA is regenerated. Nothing under src/kiro_crew/ or test/ changes. The monitor_watch MCP tool, the src/kiro_crew/monitoring engine, the backend clear route and the retention refusal are all as on main. A committed capture harness, website/scripts/capture-goal-popover-generic.mjs, opens the built SPA, clicks the composer trigger in five stubbed states (no loop, active loop, stopped record plus its confirm row, reduced monitor row, failed slot snapshot), fails if the popover carries a pull request URL field or a "legacy goal loop" call to action, and clips each frame under 2000px. Its frames are attached to the pull request, not committed. The two harnesses that photographed the removed surface, capture-goal-clear-record.mjs and capture-monitor-trigger-centering.mjs, go with it; the clear-record flow is state 03 of the generic harness.
…tdev#9788) * fix(monitor): let the owner clear a stopped automation record A user-stopped monitor record is retained as evidence and refuses a re-arm, which is deliberate. The way out that refusal names did not exist: DELETE /api/autonudge/{loop_id} routed a structured monitor into stop_monitor, which returns an already-terminal loop unchanged, then answered ok. The dashboard's own button reported success and removed nothing, and the restart route only revives the same subject. A session that stopped watching one pull request could never watch another one. DELETE now splits by state. A live monitor is still stopped, retaining its outcome. An already-terminal one is cleared through a new authorize_and_clear_monitor: owner-gated, audited as monitor_clear, and refusing a live monitor, a future-version record and a wake in flight. The popover's button says Clear record instead of Stop loop once the loop is inactive, since that press removes the row rather than stopping anything. * fix(monitor): close the clear's TOCTOU and name what it erases Review round 1 on the clear path. GPT (blocking): the terminal-state checks ran before the audit, and the audit's to_thread yields the event loop, so a close-rollback restore landing in that window met an unconditional remove and lost a live watch. The removal now re-takes the decision inside the service's own lock hold via a new clear_terminal_monitor, and refuses with 409 when the row moved on. UX (blocking): a blind reader would not press "Clear record" because the popover shows nothing called a record, so the one control that unsticks the session went unpressed. The label names the object ("Clear stopped goal"), the status reads "Stopped" instead of the resumable-sounding "Paused", and a help line names both exits because the erase has no undo. Design (concerns): the verb's meaning was decided by server state, so a stale "Stop loop" press could erase a record that went terminal in between. The DELETE now carries the pressed intent and the server 409s on a mismatch. First principles (subtractions): dropped the zero-consumer `cleared: true` response key and the unused `auto-nudge-stop` test id.
…otdev#9845) Follow-through on the UX review of kirodotdev#9788, which merged with the finding open. Both surfaces now erase a stopped automation for good, but only the monitor's was guarded: the legacy goal view's "Clear stopped goal" fired the DELETE on one plain grey click. A blind reader named it: "this delete button is plain grey with no warning colour, which makes it easier to hit by mistake" and "I cannot tell whether it deletes instantly with no are-you-sure". The legacy control is now danger-coloured unconditionally (not on :hover, which a touch viewport never produces) and asks first, reusing the monitor surface's two-step. The confirmation replaces the primary CTA rather than sitting beside it, so the row keeps its two-control cap. Both confirm labels now restate the action and its object, because neither confirm row renders a question: "Yes, clear it" answered one that was never asked. They read "Clear goal for good" and "Clear monitor for good".
Problem / Motivation
A session that stops watching one pull request can never watch another one.
monitor_stopretains its outcome, and_stopped_row_is_replaceablerefuses to let a re-arm displace a consumer-recorded stop. That rule is deliberate. The way out it names -- its owner must clear it first -- did not exist:monitor_watch/add_monitor: refused withthe session's stopped automation is retained as evidence. The rule working.DELETE /api/autonudge/{loop_id}: routed a structured monitor intostop_monitor, which returns an already-terminal loop UNCHANGED, then answered{"ok": true}. The goal popover's own button reported success and removed nothing.POST /api/monitors/{id}/restart: revives the SAME monitor, so it can only re-watch the subject the user stopped watching.Observed: an agent session called
monitor_watchfor a pull request, gotFailed to start structured monitor: the session's stopped automation is retained as evidence and is not replaceable by a re-arm; its owner must clear it first, and the stopped row could not be cleared from anywhere in the product.Why it matters
The slot is permanently spent. Every later
monitor_watchon that session is refused, the dashboard's Clear/Stop button silently no-ops, and the only remaining instruction to the user is one the product cannot carry out. The user's workaround is to abandon the chat session.It also makes the button lie:
stop()callsonChange(null)on a 200, so the popover empties itself while the row is still on disk and returns on the next fetch.What changed (motivation -> approach -> change)
Root cause: one HTTP verb served two different operations and only implemented one.
stop_monitoris correctly idempotent (an already-terminal record is returned unchanged), so routing every structured-monitor DELETE through it made the second press unreachable.DELETE /api/autonudge/{loop_id}now splits by state:authorize_and_stop_monitor, which writes the evidence.authorize_and_clear_monitor, which REMOVES the row.The new authorizer lives in
autonudge_authz.pybeside its siblings (the security chokepoint is transport-agnostic by design) and is owner-gated, audited asmonitor_clearwithcritical=Trueaudit-or-deny, and refuses:The removal is CONDITIONAL.
AutoNudgeService.clear_terminal_monitorre-takes the terminal-state decision inside the same_lockhold that removes the row, because the audit hands off to a thread and yields the event loop: arestore_monitor_after_failed_session_closelanding in that window would otherwise meet an unconditional delete and lose a live watch. The row moving on answers 409, not a silent success.The DELETE also accepts an optional
intent=stop|clearand 409s on a mismatch, so the verb's meaning comes from the label the user pressed rather than from whatever state the record reached in flight. Optional, so an older bundle keeps working.The retained-evidence rule itself is untouched. Clearing is an owner action in the browser, not something an agent can reach:
monitor_watchis still refused, and its message now names where to clear.Frontend, structured surface (the one a stuck user actually sees): the session-automation popover's terminal state offered only Restart monitor, which revives the same subject, so the panel had no way to free the session at all. It now offers Clear stopped monitor beside Restart, behind the same confirm the stop control uses, plus a line naming both exits and the finality of this one.
Frontend, legacy goal view: once the loop is inactive the popover's left button reads Clear stopped goal instead of Stop loop, the status line reads Stopped rather than the resumable-sounding Paused, and a help line names both exits (
Start loop resumes this goal. Clear stopped goal removes it for good.) because the erase has no undo. The label names the goal rather than an internal noun: a blind reader refused to press "Clear record" since the popover shows nothing called a record. Correct for legacy loops too, where DELETE already removed the row.Tests
New
test/test_monitor_clear_retained.py(18 tests) against the REALAutoNudgeService:monitor_clear,critical=True, with the owning slot key.to_thread, and asserts it reached that window at all.USER_STOPretained.POST /api/monitors/{id}/clearroute: it frees the slot, refuses a live monitor (409), refuses a non-owner (403), and 404s on an unknown id.intentpreconditions both ways: a stop-intent press against a just-terminal record is refused rather than erasing it, a clear-intent press against a live monitor is refused rather than stopping it, an unknown intent is a 400, and a request with no intent still clears (older bundles).website/src/test/AutoNudgePopover.test.tsx: the label, the status wording and the help line are asserted in both directions, plus that each press sends its ownintent.website/src/test/SessionAutomationPopover.test.tsx: the clear is offered on a stopped monitor and absent on a live one, one press only asks, the confirm callsmonitorClear, and Cancel erases nothing.Negative controls, both verified:
autonudge_authz.pyandhandlers/autonudge.pyreverted toorigin/main, 8 of the original 9 tests fail on the row still being present. Restored, all pass.svc.clear_terminal_monitorback tosvc.remove), the restore-window test fails (assert True is False) and passes again once restored -- so that test measures the lock hold, not the guards above it.Local runs: 1126 backend tests matching
autonudge or monitorpass; 1967 vitest files pass;npm run typecheck,lint,jscpd, 1837 electron tests,npm run i18n:checkall green. Two pre-existing environment failures unrelated to this diff (test_autonudge.py::TestSentinelPathRepair::test_unnormalized_path_escaping_legacy_is_preservedfails identically on pristineorigin/main;test_transcribe.pycannot importimageio_ffmpeg).Gates run locally: black baseline, comment-history, sync-io-in-async, builtin-skill-scope, docs-lint, brand, error-code contract, feature-map (
FEATURE_MAP_BASE_REF).Manual verification
Reproduced against the running gateway's own store: the retained row (
outcome: user_stop) blocked everymonitor_watchon its slot, and the popover's button left it in place.The screenshot harness below is not a still: frame 2 PRESSES the button and asserts the
DELETEwas issued and the popover closed, so the press is proven to do something.Screenshots / video
node website/scripts/capture-goal-clear-record.mjsdrives the real built SPA with stubbed/api/**and exits non-zero unless each frame renders what this PR claims.Stopped monitor -- the clear sits beside Restart, and the exits line says what each one does:
One press only asks, because the erase has no undo:
The two control frames
Live monitor -- no clear control at all:
Stopped legacy goal loop -- the goal view's own button, status and help line:
Related Issues
No existing issue. Adjacent but different: #9194 (an arm that returns success without arming -- here the tool returned a clear failure and the refusal was correct) and #7410 (an armed loop has no visible running state).
Pattern harvest
Rule candidate: review-prompt
Pattern: an idempotent no-op reached through a route that promises a state change -- the handler returns success because the service call is legitimately idempotent, so the caller cannot tell "already done" from "cannot be done here". Worth asking of any DELETE/stop/cancel route that dispatches into a state machine: is there a state in which this verb is unreachable, and does the response say so?
Checklist
babysitbuilt-in skill)Round 1 review fixes (
4a7d393b9)to_thread, which yields, so a concurrent close-rollback restore met an unconditionalsvc.removeclear_terminal_monitorre-takes the decision inside the removal's own_lockhold; 409 when the row moved onintent=stop|cleartravels with the DELETE; 409 on mismatchcleared: trueanddata-testid="auto-nudge-stop"had zero consumersRound 2 (
faca57826)Rebased onto current
main, which is what the review lanes needed: the round-1 patch artifact was 203 files of base drift (First Principles flagged it, and GPT's only blocking finding was inplatform/governance.py, a file this PR does not touch). The rebase brings the diff back to its own 30 files.The rebase also moved the surface under the fix.
mainnow rendersSessionAutomationPopoverin the composer, and its terminal branch offered Restart monitor alone, so the stuck case this PR exists to fix had NO exit in the UI a user actually reaches. Added there:POST /api/monitors/{id}/clear, the sibling of/stopand/restart, routing to the sameauthorize_and_clear_monitor.api.monitorClearand a Clear stopped monitor control in the terminal branch, behind its own confirm.Also took the two UX suggestions from round 1: the wake-in-flight and intent-mismatch refusals no longer render internal vocabulary ("wake", "automation") into the popover's error notice.
Round 3 (
faca57826): addedPOST /api/monitors/{id}/clearto the feature map's Monitor loops row, the one genuine GPT finding on the previous head.Round 4 (
d9bdf18bb): an intent-less DELETE no longer clears. A pre-upgrade tab had no clear control, so it can only have meant stop; inferringclearfrom the record state for such a request reopened the same hazard the intent closes, by the legacy path. Clearing now requires an explicitintent=clear, and an old bundle keeps its old harmless no-op.