hermes-agent/web/src/pages
Ben Barclay 86f2946fbe
fix(dashboard): recover the Chat tab when the agent session ends (NS-504) (#47674)
* fix(dashboard): recover the Chat tab when the agent session ends (NS-504)

In the dashboard Chat tab, when the agent process exits — the user types
`/exit`, or starts a new session that ends the current PTY child — the
`/api/pty` WebSocket closes with a normal code (not one of the
4401/4403/4404/4408/1011 rejection codes the server emits). The frontend
handled only those rejection codes; the normal-exit fallback just printed
"[session ended]" into the dead terminal and stopped, with `wsRef` nulled
and no respawn path. The only recovery was a full page refresh — exactly
the beta report ("typing /exit breaks functionality, no way to restart
without refreshing"; "starting a new session completely breaks the
agent").

On a clean/normal close the Chat tab now flips `sessionEnded` and renders
an in-place "Start new session" overlay (mirroring ChatSidebar's existing
reconnect affordance). Clicking it bumps a `reconnectNonce` that is a
dependency of the connect effect, so the effect tears down and re-runs,
spawning a fresh PTY in place — no page refresh. `onopen` clears the
flag so a successful reconnect dismisses the overlay.

An explicit button (rather than auto-respawn) is deliberate: if the agent
is crash-looping, auto-respawn would hide the failure and spin; the user
stays in control.

Verified against a live uvicorn `/api/pty` socket: a child that exits
closes with a non-rejection code (client sees close_code None / 1000-class),
which is precisely the branch that now sets sessionEnded=true. web
typecheck + vite build clean.

Reported via beta (NS-504).

* docs(assets): add NS-504 chat session recovery infographic
2026-06-18 10:05:26 +10:00
..
AnalyticsPage.tsx feat(dashboard): nous-blue theme, bulk sessions, schedule picker (#37383) 2026-06-02 12:37:40 -04:00
ChannelsPage.tsx Fix dashboard gateway profile scoping 2026-06-17 05:40:57 -07:00
ChatPage.tsx fix(dashboard): recover the Chat tab when the agent session ends (NS-504) (#47674) 2026-06-18 10:05:26 +10:00
ConfigPage.tsx fix(dashboard): Config page header shows the switched profile's config.yaml path (#44374) 2026-06-11 09:46:15 -07:00
CronPage.tsx refactor(cron): rebrand Cron Recipes -> Automation Blueprints 2026-06-11 10:49:47 -07:00
DocsPage.tsx fix(web): force light color-scheme on docs iframe 2026-05-07 04:55:47 -07:00
EnvPage.tsx feat(dashboard): enrich profiles dashboard and de-dupe channel env vars (#37872) 2026-06-03 10:37:36 -04:00
FilesPage.tsx Move folder creation into dialog 2026-06-10 09:53:12 -07:00
LogsPage.tsx Merge remote-tracking branch 'origin/main' into refactor/use-ds-primitives 2026-05-28 14:20:49 -04:00
McpPage.tsx feat(dashboard): complete admin panel — MCP catalog, enable/disable toggles, hook creation, system stats (#36736) 2026-06-02 00:16:11 -04:00
ModelsPage.tsx Update implementation to make it cleaner 2026-06-12 11:03:44 -07:00
PairingPage.tsx feat(dashboard): full administration panel — MCP, pairing, webhooks, credentials, memory, gateway, ops (#36704) 2026-06-01 02:58:02 -07:00
PluginsPage.tsx feat(plugins): install from a subdirectory within a repo (#42963) 2026-06-09 13:42:51 -04:00
ProfileBuilderPage.tsx feat(dashboard): clone profiles from any source 2026-06-13 07:33:58 -07:00
ProfilesPage.tsx fix(dashboard): scope chat sidebar model card to selected profile (#46665) 2026-06-15 12:50:19 -04:00
SessionsPage.tsx fix(webui): split merge-into-tail compaction so reply renders as its own bubble (#29824) 2026-06-12 15:41:57 -07:00
SkillsPage.tsx feat(dashboard): SKILL.md editor on Skills page + attach-skill selector in cron modals (#44231) 2026-06-11 06:10:27 -07:00
SystemPage.tsx Detect containerized dashboard update management 2026-06-15 20:08:39 -07:00
WebhooksPage.tsx Enable webhooks from dashboard page 2026-06-10 22:55:06 -07:00