Skip to content

feat(live): add Reset Live Sessions - #587

Merged
umputun merged 13 commits into
masterfrom
reset-live-sessions
Sep 11, 2026
Merged

feat(live): add Reset Live Sessions#587
umputun merged 13 commits into
masterfrom
reset-live-sessions

Conversation

@umputun

@umputun umputun commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Live panes created without the session host, or whose host has exited, can lose agterm's permission attribution and prompt again when a new Claude Code version requests the microphone. Restarting agterm does not repair those panes. #574 added the host for panes created from then on and left earlier panes to be recreated by hand; this is the migration it did not include.

Adds Help > Reset Live Sessions… and agtermctl zmx reset --force. The reset quits and reopens agterm, preserves the layout, and recreates the affected panes through the session host, replaying captured commands where possible. Already supervised panes keep their processes. Running work in affected panes stops; agent conversations may need manual resume. The reset requires dialog confirmation or --force.

  • Runs only while Live is configured and active. Captures commands and requires a checked snapshot save before writing the marker; removes it if the relauncher cannot start.
  • Consumes the marker before killing and only narrows the confirmed targets: each must still be claimed, have the same leader PID, and remain orphaned.
  • Kills in one bounded batch and checks every selected leader even if the batch fails. Unconfirmed panes receive neither captured replay nor their durable command.
  • Writes the control reply before triggering quit. An unrelated request's reply cannot trigger it.

result.liveReset contains the confirmed session and pane counts plus pending: true. The tree and zmx list expose liveReset.pending as a pane count and liveReset.last as this launch's reset outcome, omitting liveReset when neither exists. Partial resets are reported.

An isolated Debug check reset four affected panes across three sessions, including a split. All five panes were supervised afterward; the unaffected pane kept its leader PID and the host kept its PID.

plan: docs/plans/completed/20260910-reset-live-sessions.md

Live panes created without the session host lose agterm attribution when their
creating app exits. The plan adds Help > Reset Live Sessions and zmx.reset. A
confirmed reset quits cleanly, ends the selected daemons at the next launch, and
recreates those panes through the session host, replaying captured commands
where possible.
…sessions reset

LiveReset joins pane claims to zmx leaders and keeps the orphaned and
app-attributed panes; narrow re-checks a marker against the launch's own
claims and listing and only ever shrinks it; outcome derives pane counts for
suppression and distinct session totals for the notification. The marker
store renames before decoding so a crash mid-reset never replays it.
…ons reset

The dispatcher refuses without --force before the host is reached, like
zmx.kill. The reply carries the confirmed session and pane counts, and the
tree top level and the zmx list header gain an optional liveReset read-back
for the pending set and the last consumed outcome.
A conflicted claim walk emitted duplicate targets that could reach the marker
and trap the no-inventory path's unique-key dictionary. The survivor sentence
now speaks only for the surviving commands, since a mixed session's other pane
restores normally.
…ive sessions reset

The listing keeps unreadable rows so a consumer can tell absent from
unreadable, the batched kill takes an explicit timeout and reports only a
diagnostic Bool, and leadersExited polls a pid group under an injected clock.
ControlServer.liveResetSelection joins the claim walk to the listing through
the same host-pid resolution the tree uses.
…ve sessions reset

LiveResetCoordinator holds the confirmed selection and refuses in a fixed
order; the delegate skips the quit alert for it and arms the marker only after
the checked snapshot save, removing it when the relauncher cannot start. The
connection thread quits only after the zmx.reset reply frame is written, and
only for that request. The relauncher waits on the old pid in a detached shell
and reopens the bundle through open with the state directory passed by --env.
…he Live sessions reset

The consumer runs once the library exists and before the ordinary reap: it
consumes the marker first, narrows it against the current claims and listing,
kills the confirmed daemons in one batch and polls every leader whatever the
batch reported. A pane whose leader survives is suppressed on the seed policy
beside the denylist, so it attaches with neither its replay nor its durable
command. The outcome is recorded on the app and posted once notifications are
registered. The held-write control tests now wait on entered expectations.
Help > Reset Live Sessions… shows only while Live is both the configured and
the launched mode. The tree top level and the zmx list header carry the
pending pane count and the last consumed outcome, omitted when neither exists.
The user guide, the command reference, the bundled skill, the troubleshooting
pages and the control-api and windows rules describe the Help item, zmx.reset,
its refusals, the reply-before-quit rule, the narrowing at launch and the
read-back fields.
…show menu refusals

A reset confirmed before a switch away from Live no longer arms or skips the
quit alert, and a launch that did not get Live discards the marker without
killing, since an ordinary seed cannot suppress a survivor. The listing and
the batched kill are clamped to the remaining budget and a batch that cannot
start in time leaves every selected pane suppressed. The Help item presents a
refusal in user words; a cancel stays silent.
Copilot AI lite review requested due to automatic review settings September 11, 2026 02:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@umputun
umputun merged commit ebfcc74 into master Sep 11, 2026
8 checks passed
@umputun
umputun deleted the reset-live-sessions branch September 11, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants