Skip to content

feat: Graceful shutdown, 80% budget warnings, LiteLLM analytics, and interactive git diffs#8

Merged
akhilsinghcodes merged 3 commits into
mainfrom
features/bugfixes_enhancements
Jun 12, 2026
Merged

feat: Graceful shutdown, 80% budget warnings, LiteLLM analytics, and interactive git diffs#8
akhilsinghcodes merged 3 commits into
mainfrom
features/bugfixes_enhancements

Conversation

@akhilsinghcodes

Copy link
Copy Markdown
Owner

Overview

This release delivers 6 major features to Agents Fleet: graceful shutdown for Claude/Codex CLIs, 80% budget warning notifications, LiteLLM spend analytics integration, an interactive git diff viewer, one-click session resume, and crash recovery.

What's New

🛑 Graceful Shutdown

  • Proper shutdown sequences for claude and codex agents
  • Sends Ctrl+C then /exit instead of force-killing processes
  • 5-second graceful timeout before fallback to hard kill
  • Captures resume commands from PTY output for session continuity

🚨 Budget Warning Notifications

  • Native browser notifications + in-app toast when sessions reach 80% budget
  • Works even when browser notifications are blocked
  • One warning per session (deduplicates multiple triggers)
  • Supports both USD and token budget tracking
  • Prevents silent runaway costs

📊 LiteLLM Spend Analytics

  • Fetches real spend data from LiteLLM proxy (/spend/logs, /user/daily/activity)
  • Header stats, weekly chart, daily breakdown, and budget tracking
  • By-model and by-repo spend breakdowns
  • Weekly budget resets Sunday; projects and flags over-budget warnings
  • Matches Agents Fleet UI layout for consistency

🔍 Interactive Git Diff Viewer (NEW COMPONENT)

  • Side-by-side diff display with line-by-line numbering for old and new versions
  • Paired removed/added lines render adjacent for easy comparison
  • File-level grouping with context lines and syntax coloring
  • Handles binary and malformed diffs gracefully

⏮️ One-Click Session Resume

  • Automatically captures claude --resume <uuid> and codex resume <uuid> commands
  • Stores as session artifacts in the Artifacts tab
  • Resume button spawns a new shell session instantly — no copy-paste needed
  • Backfilled across all historical sessions in the database
  • Copy-to-clipboard fallback for manual execution

🔧 Crash Recovery

  • Orphaned sessions (marked 'running' at startup) are auto-marked 'stopped'
  • Logs recovery events with crypto-backed session markers
  • Prevents ghost sessions after server crashes

Files Changed (35 files, +1,331/-1,054 lines)

Core Changes

Server (6 files):

  • db.ts — Crash recovery logic for orphaned sessions
  • gitArtifacts.ts — Capture resume commands from PTY
  • processManager.ts — Graceful shutdown and 80% budget warning logic
  • routes/dashboard.ts — Dashboard endpoints
  • routes/sessions.ts — Session lifecycle endpoints
  • ws.ts — Budget warning WebSocket broadcasts

Web UI (9 files):

  • App.tsx — App-wide refactoring
  • ClaudeSdkChat.tsx — Claude SDK improvements
  • Dashboard.tsx — Spend analytics dashboard redesign
  • LiteLLMChat.tsx — LiteLLM chat enhancements
  • GitDiffViewer.tsx (NEW) — Interactive diff viewer component
  • SessionArtifacts.tsx — Resume artifact UI and GitDiffViewer integration
  • TerminalPane.tsx, TerminalReplay.tsx — PTY improvements
  • api.ts — LiteLLM spend API endpoints

Shared Types (2 files):

  • index.ts — WsServerMessage budget_warning type
  • modelPrices.ts — Model pricing data

Documentation & Assets

  • README.md — Updated feature highlights and screenshots
  • ROADMAP.md — Product roadmap
  • 14 new screenshots — Budget warnings, resume artifacts, LiteLLM analytics, git diff viewer
  • 2 updated screenshots — Re-encoded for better quality and file size

Testing Notes

  • Graceful shutdown: Requires running against claude or codex CLI
  • Budget warnings: Trigger at 80% of budget_tokens or budget_usd
  • LiteLLM integration: Requires proxy /spend/logs and /user/daily/activity endpoints configured
  • Crash recovery: Runs on server startup; check logs for [crash-recovery] messages
  • Resume commands: Auto-captured from PTY output; visible in Artifacts tab
  • Git diff viewer: Handles all standard git diff formats; gracefully degrades on binary files

Backwards Compatibility

  • All changes are additive or internal refactoring
  • No breaking API changes
  • Existing sessions continue to work as before

Related Issues

  • Closes #[issue-number] (if applicable)

Screenshots Included

  • Budget warning notifications (browser + toast)
  • LiteLLM spend analytics dashboard
  • Interactive git diff viewer (side-by-side)
  • Session resume artifact with one-click button

@akhilsinghcodes akhilsinghcodes merged commit 4767f79 into main Jun 12, 2026
1 check passed
@akhilsinghcodes akhilsinghcodes deleted the features/bugfixes_enhancements branch June 12, 2026 09:32
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