debug: add comprehensive logging for terminal command flow

Phase 1 of systematic debugging: Gather evidence

Added detailed logging to trace the complete command flow:
- launchCommand: Shows when called, terminalId, command, WebSocket state
- waitForTerminalReady: Shows waiting period and ready state
- handleTerminalMessage: Shows all messages from backend with details
- WebSocket message content logged before sending

Also fixed duplicate 'ready' message (removed line 113-116).

Now when user creates "Claude Code CLI" terminal, console will show:
1. launchCommand called with terminalId and command
2. Waiting for terminal ready
3. Ready message received (or timeout)
4. Command sent to WebSocket
5. All backend messages logged

This will reveal exactly where the flow breaks.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
uroma
2026-01-19 19:03:27 +00:00
Unverified
parent d834a64d62
commit 2c7037b9b7
2 changed files with 22 additions and 13 deletions

View File

@@ -109,12 +109,6 @@ class TerminalService {
console.log(`[TerminalService] WebSocket connected for terminal ${terminalId}`);
// Send ready message to client to indicate PTY is ready for input
ws.send(JSON.stringify({
type: 'ready',
terminalId: terminalId
}));
// Handle incoming messages from client (user input)
ws.on('message', (data) => {
try {