Skip to content

fix: dashboard session lifecycle — filter exited, distinguish agents, fix ordering - #112

Merged
aterrylu merged 2 commits into
mainfrom
terry/dashboard-session-fixes
Apr 7, 2026
Merged

fix: dashboard session lifecycle — filter exited, distinguish agents, fix ordering#112
aterrylu merged 2 commits into
mainfrom
terry/dashboard-session-fixes

Conversation

@aterrylu

@aterrylu aterrylu commented Apr 7, 2026

Copy link
Copy Markdown
Owner

Summary

PR #110 shipped "persist exited sessions" — GET /api/sessions now returns exited sessions alongside live ones. The dashboard didn't handle this properly, causing three bugs:

  • Exited sessions rendered as broken terminals in AGENTS sidebar — each got an xterm.js + WebSocket that perpetually reconnected (no PTY server-side)
  • Projects section couldn't distinguish autonomOS agents — all sessions looked the same, and resuming exited agents used bare POST /api/sessions without template/config
  • Agent ordering broke on restartremapSessionIds used a "session:" prefix that paneOrder keys never had

Changes

Bug 1: Filter exited sessions from AGENTS sidebar

  • fetchSessions() now filters status === "exited" so they never enter state.sessions
  • Exited sessions never get terminals, preventing reconnect loops

Bug 2: Distinguish autonomOS agents in Projects section

  • Server (projects.ts): Cross-references GET /api/projects sessions with getPersistedSessions() to enrich with isAutonomosAgent, autonomosStatus, template, manager, project
  • Dashboard (Sidebar.tsx): Exited agents show gray dot + "exited" label; template name in metadata row
  • Resume (store.ts): Exited autonomOS agents resume via POST /api/sessions/:id/resume (re-resolves template, restores full config) instead of bare session creation
  • Server error details surfaced in status bar (was generic "failed to resume session")

Bug 3: Fix agent ordering after restart

  • remapSessionIds paneOrder remap was dead code — looked for "session:" prefix but sessionOrderKey() returns raw claudeSessionId. Fixed to match actual key format.

Test plan

  • Start server with exited sessions in ~/.autonomos/sessions.json
  • Verify AGENTS sidebar shows only live sessions (no broken terminals)
  • Verify Projects section shows autonomOS agents with template label
  • Verify exited agents show gray dot + "exited" label
  • Click exited autonomOS agent → verify it resumes with full config via /resume endpoint
  • Restart all agents via settings → verify pane ordering is preserved
  • Verify non-autonomOS project sessions still resume normally

🤖 Generated with Claude Code

aterrylu and others added 2 commits April 7, 2026 03:28
… fix ordering

- Filter exited sessions from AGENTS sidebar (fetchSessions rejects
  status=exited so broken terminals with reconnect loops are never created)
- Enrich project sessions with autonomOS metadata (isAutonomosAgent,
  autonomosStatus, template) via GET /api/projects cross-referencing
  persisted sessions
- Visual distinction in Projects sidebar: gray dot + "exited" label for
  exited autonomOS agents, template name in metadata row
- Resume exited autonomOS agents via POST /api/sessions/:id/resume
  (re-resolves template and restores full config) instead of bare resume
- Surface server error details in resume failure status instead of
  generic "failed to resume session"
- Fix paneOrder remap in remapSessionIds — keys are raw claudeSessionId
  (no "session:" prefix), so the old prefix-stripping was dead code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aterrylu
aterrylu marked this pull request as ready for review April 7, 2026 10:31
@aterrylu
aterrylu merged commit c5881af into main Apr 7, 2026
1 check passed
@aterrylu
aterrylu deleted the terry/dashboard-session-fixes branch April 7, 2026 10:31
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.

1 participant