diff --git a/docs/wiki/The-Dashboard.md b/docs/wiki/The-Dashboard.md
index 3b59f1ac..cf1f415e 100644
--- a/docs/wiki/The-Dashboard.md
+++ b/docs/wiki/The-Dashboard.md
@@ -48,6 +48,7 @@ One tab per session, in your order, and that order syncs across your devices.
| Yellow tab, blinking | The agent is waiting for input from you. |
| Red tab, blinking | A question or permission prompt is blocking the session. |
| No dot | The session is not running. |
+| Muted grey dot plus an `exited (137)` badge | The agent inside the pane has exited, with that exit code (or `exited (signal 9)`). A bare `exited` means tmux saw the pane die but did not report how, which is not the same as a clean `exited (0)`. Detailed sidebar and rail rows read `exited` in their pill. |

diff --git a/src/web/public/app.js b/src/web/public/app.js
index 8d521b68..5bfdfe43 100644
--- a/src/web/public/app.js
+++ b/src/web/public/app.js
@@ -360,6 +360,12 @@ function paneExitLabel(paneExit) {
return 'exited';
}
+// The tab's accessible name, with the exit appended when there is one. Shared
+// by the full render and applyPaneExitBadge() so the two cannot disagree.
+function paneExitAriaLabel(name, label) {
+ return label ? `${name} session, agent ${label}` : `${name} session`;
+}
+
// Add, update or remove one tab's exited-agent badge in place. Separate from
// the render loop so it can be exercised directly: this is the only path a
// session going live-to-exited ever takes, since that transition adds and
@@ -371,6 +377,10 @@ function applyPaneExitBadge(tab, paneExit) {
// `busy` for an exited pane by design, so without this a green or pulsing dot
// sits next to a badge saying the agent is gone.
tab.classList.toggle('tab-agent-exited', !!label);
+ // The tab's aria-label overrides its contents for the accessible name, and the
+ // badge is aria-hidden like its siblings, so the exit has to ride the label.
+ const name = tab.querySelector('.tab-name')?.dataset?.fullName;
+ if (name) tab.setAttribute('aria-label', paneExitAriaLabel(name, label));
if (!label) {
existing?.remove();
return;
@@ -378,6 +388,7 @@ function applyPaneExitBadge(tab, paneExit) {
if (!existing) {
const badge = document.createElement('span');
badge.className = 'tab-exited-badge';
+ badge.setAttribute('aria-hidden', 'true');
// Generated status text, like the status pills: it carries data-i18n-skip
// rather than a dictionary entry. Without it the translator would rewrite
// the badge and the next render pass would rewrite it back, because the
@@ -4863,16 +4874,30 @@ class CodemanApp {
_sidebarRichRow(id, session) {
if (typeof this._mobileOverviewState !== 'function') return null;
const state = this._mobileOverviewState(session, this.pendingHooks?.get(id));
+ // An exited agent (Ark0N/Codeman#446) overrides the LABEL, never the state:
+ // `state` keys SESSION_ACTIVITY_RANK and the sort, while `status` stays idle
+ // or busy for an exited pane by design, so without this the muted dot sits
+ // beside a pill saying "idle". A pending alert still wins, exactly as it
+ // does for the dot.
+ const exited = !!paneExitLabel(session.paneExit) && (state === 'idle' || state === 'working');
+ const exitAt = exited ? Number(session.paneExit.at) || 0 : 0;
return {
state,
- pill: this._sidebarRichPillLabel(state),
+ exited,
+ pill: exited ? 'exited' : this._sidebarRichPillLabel(state),
// What the pane's own footer says is still running in the background ("1 monitor",
// "2 shells"). A row that has one went quiet because the agent is waiting for that,
// which is a different thing from waiting for the user — so it rides BESIDE the
// state pill and never replaces it.
watching: typeof session.watching === 'string' ? session.watching : '',
createdAt: Number(session.createdAt) || 0,
- since: this._mobileOverviewSince ? this._mobileOverviewSince(state, session) : null,
+ since: exitAt
+ ? { key: 'exited', at: exitAt }
+ : exited
+ ? null
+ : this._mobileOverviewSince
+ ? this._mobileOverviewSince(state, session)
+ : null,
};
}
@@ -4905,7 +4930,8 @@ class CodemanApp {
parts.push('\u00B7');
parts.push(stamp(row.since.key, row.since.at, 'for', 'tab-meta-since'));
}
- parts.push(`${escapeHtml(row.pill)}`);
+ const pillMod = row.exited ? 'exited' : row.state;
+ parts.push(`${escapeHtml(row.pill)}`);
// The word is duplicated from mobile-overview.js for the same reason the pill labels
// above are: it is one word, and this file must render a complete row even when a
// stale cached mobile-overview.js has arrived without it.
@@ -4958,7 +4984,7 @@ class CodemanApp {
// that one goes through escapeHtml() because it is interpolated into markup, and the
// browser hands the decoded string back through `dataset`. `watching` is the only
// pane-derived value in this signature, which is why it is the only one escaped there.
- const sig = `${row.state}:${row.since ? row.since.at : 0}:${row.createdAt}:${row.watching}`;
+ const sig = `${row.state}${row.exited ? '+exited' : ''}:${row.since ? row.since.at : 0}:${row.createdAt}:${row.watching}`;
if (tab.dataset.tabMetaSig === sig) return;
tab.dataset.tabMetaSig = sig;
tab.dataset.tabState = row.state;
@@ -5582,7 +5608,7 @@ class CodemanApp {
const richMeta = this._sidebarRichMetaHTML(richRow);
const richClass = richRow ? ` tab-state-${richRow.state}` : '';
const richData = richRow
- ? ` data-tab-state="${richRow.state}" data-tab-meta-sig="${richRow.state}:${richRow.since ? richRow.since.at : 0}:${richRow.createdAt}:${escapeHtml(richRow.watching)}"`
+ ? ` data-tab-state="${richRow.state}" data-tab-meta-sig="${richRow.state}${richRow.exited ? '+exited' : ''}:${richRow.since ? richRow.since.at : 0}:${richRow.createdAt}:${escapeHtml(richRow.watching)}"`
: '';
// '' whenever the server said nothing about this pane's agent, which covers
@@ -5593,7 +5619,7 @@ class CodemanApp {
const inlineSessionActions = this.shouldInlineSessionActions();
const tabActionsHtml = `⚙⧉×`;
- parts.push(`
+ parts.push(`
${_tabIdx < 9 ? '' + (_tabIdx + 1) + '' : ''}
${loadState ? '' : ''}
@@ -5601,7 +5627,7 @@ class CodemanApp {
${mode === 'shell' ? 'sh' : mode === 'opencode' ? 'oc' : mode === 'codex' ? 'cx' : mode === 'gemini' ? 'gm' : mode === 'antigravity' ? 'ag' : mode === 'pi' ? 'pi' : mode === 'grok' ? 'gk' : mode === 'deepseek' ? 'ds' : mode === 'omp' ? 'om' : ''}
${tabLabel}
- ${paneExitBadge ? `${escapeHtml(paneExitBadge)}` : ''}
+ ${paneExitBadge ? `${escapeHtml(paneExitBadge)}` : ''}
${inlineSessionActions ? tabActionsHtml : ''}
detached
diff --git a/src/web/public/styles.css b/src/web/public/styles.css
index 1c723092..10d57f3f 100644
--- a/src/web/public/styles.css
+++ b/src/web/public/styles.css
@@ -18429,6 +18429,15 @@ html[data-tab-orientation='vertical'][data-tab-rail-detail='rich']:not(.tab-rail
color: color-mix(in srgb, var(--green) 45%, var(--text-muted));
}
+/* An exited agent (Ark0N/Codeman#446): neutral, like the muted dot beside it.
+ No green at all, since nothing is running behind this row. */
+html[data-sidebar-detail="rich"] .session-sidebar .tab-pill--exited,
+html[data-tab-orientation='vertical'][data-tab-rail-detail='rich']:not(.tab-rail-compact) .tab-rail .tab-pill--exited {
+ background: color-mix(in srgb, var(--text-muted) 10%, transparent);
+ border-color: color-mix(in srgb, var(--text-muted) 30%, var(--border));
+ color: var(--text-muted);
+}
+
/* Accent, deliberately none of the three above: a watching session is waiting for
work it started itself, not for the user, and the red and yellow here are spoken
for by sessions that ARE waiting for the user. */
diff --git a/test/session-pane-exit-ui.test.ts b/test/session-pane-exit-ui.test.ts
index 314bb35b..84a71032 100644
--- a/test/session-pane-exit-ui.test.ts
+++ b/test/session-pane-exit-ui.test.ts
@@ -60,6 +60,7 @@ describe('the exited-agent badge in a tab', () => {
const appJs = readFileSync(resolve(import.meta.dirname, '../src/web/public/app.js'), 'utf8');
const source = [
appJs.match(/function paneExitLabel\([\s\S]*?\n\}/)?.[0],
+ appJs.match(/function paneExitAriaLabel\([\s\S]*?\n\}/)?.[0],
appJs.match(/function applyPaneExitBadge\([\s\S]*?\n\}/)?.[0],
].join('\n');
const dom = new JSDOM('');
@@ -71,7 +72,8 @@ describe('the exited-agent badge in a tab', () => {
const makeTab = () => {
const tab = dom.window.document.createElement('div');
tab.className = 'session-tab';
- tab.innerHTML = 'w1-case';
+ tab.setAttribute('aria-label', 'w1-case session');
+ tab.innerHTML = 'w1-case';
return tab;
};
const badge = (tab: { querySelector: (s: string) => { textContent: string | null } | null }) =>
@@ -96,6 +98,27 @@ describe('the exited-agent badge in a tab', () => {
expect(badge(tab)?.hasAttribute('data-i18n-skip')).toBe(true);
});
+ it('hides the badge from assistive technology, like its sibling badges', () => {
+ const tab = makeTab();
+ applyPaneExitBadge(tab, { status: 0, at: 1 });
+ expect(badge(tab)?.getAttribute('aria-hidden')).toBe('true');
+ });
+
+ it('carries the exit on the tab accessible name instead, and drops it again', () => {
+ // The tab's aria-label overrides its contents, so the badge alone would leave
+ // a screen reader announcing an exited tab exactly like a live one.
+ const tab = makeTab();
+ applyPaneExitBadge(tab, { status: 137, at: 1 });
+ expect(tab.getAttribute('aria-label')).toBe('w1-case session, agent exited (137)');
+ applyPaneExitBadge(tab, undefined);
+ expect(tab.getAttribute('aria-label')).toBe('w1-case session');
+ });
+
+ it('builds the full render path accessible name from the same helper', () => {
+ expect(appJs).toContain('aria-label="${escapeHtml(paneExitAriaLabel(name, paneExitBadge))}"');
+ expect(appJs).toContain('');
+ });
+
it('updates the text in place rather than stacking a second badge', () => {
const tab = makeTab();
applyPaneExitBadge(tab, { status: 0, at: 1 });
@@ -135,6 +158,72 @@ describe('the exited-agent badge in a tab', () => {
});
});
+describe('the rich row pill of an exited session', () => {
+ // The detailed sidebar and rail classify rows through `_mobileOverviewState()`,
+ // which reads `status` and knows nothing about the exit, so without an override
+ // the muted dot sat beside a pill saying "idle".
+ const appJs = readFileSync(resolve(import.meta.dirname, '../src/web/public/app.js'), 'utf8');
+ const fn = (re: RegExp, name: string) => {
+ const m = appJs.match(re)?.[0];
+ if (!m) throw new Error(`${name} not found in app.js`);
+ return m;
+ };
+ type Row = { state: string; exited: boolean; pill: string; since: { key: string; at: number } | null };
+ const host = new Function(
+ `${fn(/function paneExitLabel\([\s\S]*?\n\}/, 'paneExitLabel')}
+ return {
+ ${fn(/ {2}_sidebarRichPillLabel\(state\) \{[\s\S]*?\n {2}\}/, '_sidebarRichPillLabel')},
+ ${fn(/ {2}_sidebarRichRow\(id, session\) \{[\s\S]*?\n {2}\}/, '_sidebarRichRow')},
+ _mobileOverviewState(session, hooks) {
+ if (hooks && hooks.has('permission_prompt')) return 'needs';
+ if (hooks && hooks.has('idle_prompt')) return 'waiting';
+ return session.status === 'busy' ? 'working' : 'idle';
+ },
+ _mobileOverviewSince(state, session) {
+ return { key: state, at: session.lastActivityAt };
+ },
+ };`
+ )() as { pendingHooks?: Map>; _sidebarRichRow: (id: string, s: unknown) => Row };
+
+ it('says exited, measured from when the exit was observed', () => {
+ const row = host._sidebarRichRow('s1', { status: 'idle', lastActivityAt: 5, paneExit: { status: 137, at: 42 } });
+ expect(row.state).toBe('idle');
+ expect(row.exited).toBe(true);
+ expect(row.pill).toBe('exited');
+ expect(row.since).toEqual({ key: 'exited', at: 42 });
+ });
+
+ it('keeps the classified state for sorting, so the home-screen order is unchanged', () => {
+ const row = host._sidebarRichRow('s1', { status: 'busy', lastActivityAt: 5, paneExit: { at: 42 } });
+ expect(row.state).toBe('working');
+ expect(row.pill).toBe('exited');
+ });
+
+ it('lets a pending permission dialog keep its own pill', () => {
+ host.pendingHooks = new Map([['s1', new Set(['permission_prompt'])]]);
+ try {
+ const row = host._sidebarRichRow('s1', { status: 'idle', lastActivityAt: 5, paneExit: { status: 0, at: 42 } });
+ expect(row.exited).toBe(false);
+ expect(row.pill).toBe('needs you');
+ } finally {
+ host.pendingHooks = undefined;
+ }
+ });
+
+ it('reads idle for a live session', () => {
+ const row = host._sidebarRichRow('s1', { status: 'idle', lastActivityAt: 5 });
+ expect(row.exited).toBe(false);
+ expect(row.pill).toBe('idle');
+ expect(row.since).toEqual({ key: 'idle', at: 5 });
+ });
+
+ it('styles the exited pill on both rich surfaces', () => {
+ const css = readFileSync(resolve(import.meta.dirname, '../src/web/public/styles.css'), 'utf8');
+ expect(css).toContain('html[data-sidebar-detail="rich"] .session-sidebar .tab-pill--exited');
+ expect(css).toContain('.tab-rail .tab-pill--exited');
+ });
+});
+
describe('what colour the status dot ends up', () => {
/*
* The dot renders from `status`, which stays `idle` or `busy` for an exited
diff --git a/test/session-sidebar-ux.test.ts b/test/session-sidebar-ux.test.ts
index 6b2ed047..12a87b77 100644
--- a/test/session-sidebar-ux.test.ts
+++ b/test/session-sidebar-ux.test.ts
@@ -84,7 +84,7 @@ describe('watching badge on a rich session row', () => {
// pill that says which one still decides the row; this badge only adds a fact.
const meta = app.slice(app.indexOf('_sidebarRichMetaHTML(row) {'));
const body = meta.slice(0, meta.indexOf('_sidebarRichStampText(timestamp, format) {'));
- expect(body).toContain('tab-pill tab-pill--${escapeHtml(row.state)}');
+ expect(body).toContain('tab-pill tab-pill--${escapeHtml(pillMod)}');
expect(body).toContain('tab-pill tab-pill--watching');
expect(body).toContain('Still running in the background:');
});
@@ -93,7 +93,7 @@ describe('watching badge on a rich session row', () => {
// The meta line is rebuilt only when this signature moves, so a badge left out of
// it would appear and disappear a render late, or not at all.
expect(app).toContain(
- 'const sig = `${row.state}:${row.since ? row.since.at : 0}:${row.createdAt}:${row.watching}`'
+ "const sig = `${row.state}${row.exited ? '+exited' : ''}:${row.since ? row.since.at : 0}:${row.createdAt}:${row.watching}`"
);
});
diff --git a/test/tmux-manager.test.ts b/test/tmux-manager.test.ts
index 32956117..0fd963e1 100644
--- a/test/tmux-manager.test.ts
+++ b/test/tmux-manager.test.ts
@@ -1003,6 +1003,11 @@ describe('parsePaneRows', () => {
expect(row.exitStatus).toBe(0);
});
+ it('still reads the pid when a trailing field is junk', () => {
+ // Carried over from the retired parsePaneList case 'splits on the first separator only'.
+ expect(pids('codeman-aaaa|1234|extra-field').get('codeman-aaaa')).toBe(1234);
+ });
+
it('calls a non-numeric dead flag unknown rather than false', () => {
const [row] = parsePaneRows('codeman-aaaa|1234|?||');
expect(row.dead).toBeUndefined();