mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 00:49:41 +02:00
fix(tui): sweep an attach status bar a killed terminal left behind
restore() runs after spawnSync returns, which covers detaching and the agent exiting inside the pane, but not the terminal dying while attached. Closing the window or dropping the SSH kills the TUI where it stands, and the bar it installed stays pinned on the session: the next attach wears a stale bar naming a different session, and the pane is a row shorter for good. Seen on the beta, where the tester closed the window instead of detaching. One sweep at startup, fire-and-forget so it can neither delay the first frame nor fail a start. Only a bar carrying our own marker is touched, and the marker is now the single source of the bar's own wording so the two cannot drift; a user's hand-written status bar on the same session is left exactly as it is. The session goes back to `status off`, which is how Codeman creates every pane it owns and the only state this bar is ever applied over.
This commit is contained in:
+6
-1
@@ -55,6 +55,7 @@ import { approvalAnswerForKey, newApprovalIds } from './tui-approvals.js';
|
||||
import { composerScroll, composerStep, composerText, createComposer, type TuiComposerState } from './tui-composer.js';
|
||||
import { formatAwayDigest } from './tui-digest.js';
|
||||
import {
|
||||
ATTACH_BANNER_MARKER,
|
||||
TuiClient,
|
||||
type TuiApprovalAnswer,
|
||||
type TuiEventStream,
|
||||
@@ -316,7 +317,7 @@ export function buildAttachBanner(options: {
|
||||
return {
|
||||
status: 'on',
|
||||
'status-style': 'bg=default,fg=default',
|
||||
'status-format[0]': `#[align=left] press #[bold]${chord}#[nobold] to detach, back to the codeman dashboard${right}#[default]`,
|
||||
'status-format[0]': `#[align=left] press #[bold]${chord}#[nobold] to detach, ${ATTACH_BANNER_MARKER}${right}#[default]`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -981,6 +982,10 @@ class TuiApp {
|
||||
await this.refresh();
|
||||
if (server) this.subscribe();
|
||||
|
||||
// Fire and forget: a bar stranded by a previous run is cosmetic, so it must
|
||||
// never delay the first frame or fail a start.
|
||||
void this.client.clearLeakedAttachBanners().catch(() => undefined);
|
||||
|
||||
return new Promise<number>((resolve) => {
|
||||
this.resolveExit = resolve;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user