- Move leftSidebarMode from URL state to local useState in unified-shell,
avoiding force-dynamic router round-trip that made the button appear broken - Replace fileURLToPath(new URL(..., import.meta.url)) with process.cwd()
in bb-pi-bootstrap.ts — import.meta.url is a webpack:// URL in Next.js,
causing cross-realm TypeError when passed to Node.js fileURLToPath()
1.6 KiB
1.6 KiB
Phase 6 - Runtime Hardening
Status: Planning Created: 2026-03-07 Goal: Improve robustness of embedded Pi runtime, reconnect behavior, and error recovery
Current Issues
- Session disconnect requires manual restart
- Stuck/hung agents have no clear diagnostics
- Drift between TUI Pi loader and embedded Pi loader
- No automatic recovery from failures
Implementation Plan
Step 1: Session Health Monitoring
- Add heartbeat check for orchestrator session
- Detect when session is unresponsive
- Show clear status in UI
Files:
src/lib/pi-daemon-adapter.ts- health checksrc/lib/embedded-daemon.ts- monitoring
Step 2: Automatic Reconnect
- On session disconnect, attempt reconnect
- Preserve conversation history
- Show reconnect status to user
Files:
src/lib/pi-daemon-adapter.tssrc/components/shared/left-panel.tsx- reconnect UI
Step 3: Stuck Agent Diagnostics
- Detect agents stuck in "spawning" for too long
- Provide diagnostic information
- Allow user to cancel/retry
Files:
src/lib/worker-session-manager.tssrc/components/agents/agent-status-panel.tsx
Step 4: Error Recovery UX
- Clear error messages when things fail
- Retry buttons for failed operations
- Logs for debugging
Files:
- Error handling across runtime components
- UI for error display
Blocked Items
None identified.
Success Criteria
- Session health monitored and shown in UI
- Automatic reconnect on disconnect
- Stuck agents detected and reported
- Clear error messages with recovery options
Estimated Effort
3-4 hours