3.2 KiB
3.2 KiB
Phase 6: Cleanup & Polish - Execution Plan
Status: In Progress
Date: February 20, 2026
1. Old Harness References Found
Frontend Files (To Review/Update):
src/apps/officer-web/Screens/Dashboard/Chat/useClaude.tssrc/apps/officer-web/Screens/Dashboard/Chat/useOpenCode.tssrc/apps/officer-web/Screens/Dashboard/Chat/usePiMono.tssrc/apps/officer-web/Screens/Dashboard/Chat/ChatPanel.tsxsrc/apps/officer-web/Screens/Dashboard/Chat/EmbeddableChat.tsxsrc/apps/officer-web/Screens/Dashboard/Chat/Settings.tsxsrc/apps/officer-web/Screens/Dashboard/Chat/OpenCodeModelPicker.tsxsrc/apps/officer-web/Screens/Dashboard/Settings/ProfileSettings/TaskDefaults.tsxsrc/apps/officer-web/Screens/Dashboard/Settings/ServerSettings/AIHarnessesSection.tsxsrc/apps/officer-web/Screens/Dashboard/Settings/SystemSettings.tsxsrc/apps/officer-web/Screens/Dashboard/OnboardingAdmin/AIHarnessesCard.tsx
Backend Files (To Review/Update):
src/servers/api/scrape/scrape.ts- provider type referencessrc/servers/api/upload/upload.ts- provider type referencessrc/servers/api/server-settings/opencode.ts- can be removed entirelysrc/servers/api/server-settings/pi-mono.ts- can be removed entirelysrc/servers/api/server-settings/server-settings.ts- remove routessrc/servers/api/sessions/sessions.ts- update to use only Pi sessions
Type Files:
src/servers/api/chat-types.ts- Already updated with deprecation notice ✅src/apps/officer-web/state/types/user-settings.ts- check for provider types
2. Logging Infrastructure
Current State:
- No centralized logging utility
- Using
console.logdirectly in Pi harness files - Task logger exists (
src/servers/api/task-logger.ts) but is specific to tasks
Action Items:
- Create
src/servers/api/pi/logger.tswith structured logging - Add log levels (DEBUG, INFO, WARN, ERROR)
- Add timestamps and context
- Replace all console.log calls in Pi harness
3. Type Cleanup
Action Items:
- Review
chat-types.tsfor any unused legacy types - Ensure all Pi types are properly exported
- Check for duplicate type definitions
- Update provider type unions to only include 'pi'
4. Documentation
Edge Cases to Document:
- Session resumption with corrupted messages.json
- Pi process crash during streaming
- WebSocket disconnect/reconnect behavior
- Idle timeout edge cases (activity while timing out)
- Concurrent session handling per user
- CWD resolution when not provided
- File attachment handling
Documentation Files:
- Create
src/servers/api/pi/README.md - Document wire protocol examples
- Document session lifecycle
- Document error handling patterns
5. Final Verification
Tests:
- All TypeScript compiles without errors
- No references to old harnesses in active code paths
- Logging works consistently
- Documentation is complete and accurate
Implementation Order:
- Create logger utility
- Replace console.log calls with structured logging
- Remove old harness server-settings files
- Update sessions.ts to only use Pi
- Document edge cases
- Create Pi harness README
- Final verification and testing