Announce a session's end when it is actually over, and for closes too
ci / android head (push) Successful in 3m17s
ci / desktop nightly (push) Successful in 41s
ci / build and test (push) Successful in 2m27s
ci / api image (push) Successful in 28s

The phone's notification kept saying '1 shell connected' after the
shell was gone, and both close routes were at fault. A shell exiting on
its own raised SessionEnded from inside its run's finally block — where
the run task is by definition not yet complete, so the LiveSessionCount
the keep-alive reads still counted the dead shell, and nothing fired
later to correct it. A tab closed by hand announced nothing at all, by
a recorded decision that assumed every subscriber was the closer; the
keep-alive is not, and a close it never heard about left the
notification claiming a shell over nothing.

The end is now announced from a continuation after the run completes,
and CloseSessionAsync announces after its own drain — every subscriber
was already a reconcile-to-reality handler, so the echo the old remark
feared costs nothing. Shutdown stays silent: it is dismantling the
subscribers along with the sessions.
This commit is contained in:
2026-08-09 13:01:14 +02:00
parent 506d2803a2
commit e936ab4646
6 changed files with 132 additions and 33 deletions
+10
View File
@@ -348,6 +348,16 @@ runtime or the receipt is silently invisible — the service still runs, but not
to show, at most once, with no result read back: a refusal costs the notification and nothing else, which is
what the manifest's own comment on the permission says.
**And a fourth correction, found by the notification refusing to come down.** "1 shell connected" outlived
the shell, both ways a shell can close. A shell exiting on its own announced `SessionEnded` from inside its
run's own finally block — where the run task is by definition not yet complete, so the
`LiveSessionCount` the keep-alive reads from that event still counted the session that had just ended, and
nothing fired afterwards to correct it. A tab closed by hand announced nothing at all, by a recorded
decision that assumed every subscriber was the closer. Both reversed in `TerminalWorkspace`: the end is now
announced from a continuation after the run has actually completed, and `CloseSessionAsync` announces too,
after its own drain — the event's remark carries the reversal, and `SessionEnded`'s subscribers were all
already "reconcile to reality" handlers for which a second announcement is harmless.
### Phone first
About 360dp wide. The tablet route was cheaper — a landscape tablet is close to the existing 880×560 minimum