Harden terminal WebSocket edge cases #37

Merged
jimmy merged 2 commits from dev into main 2026-03-15 23:22:09 +08:00
Owner

Fix all remaining edge cases in terminal WebSocket implementation:

  • Race condition: authRecoveryInFlight always reset via try-finally
  • Backend: error handling for stdin writes (BrokenPipeError/OSError)
  • Variable scope: fix shadowing issue with tabState
  • SSH cleanup: properly await conn.wait_closed()
  • Ping timeout: verify WebSocket instance before closing
  • Read task: graceful cancellation with timeout
Fix all remaining edge cases in terminal WebSocket implementation: - Race condition: authRecoveryInFlight always reset via try-finally - Backend: error handling for stdin writes (BrokenPipeError/OSError) - Variable scope: fix shadowing issue with tabState - SSH cleanup: properly await conn.wait_closed() - Ping timeout: verify WebSocket instance before closing - Read task: graceful cancellation with timeout
jimmy added 2 commits 2026-03-15 23:22:01 +08:00
feat: add tea (Gitea CLI) to claude-dev tooling
Deploy Claude Dev (Dev) / deploy-claude-dev-dev (push) Failing after 40s
d19707422d
fix: harden terminal WebSocket edge cases
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m44s
b742ab8fef
- Wrap tryRefreshSession in try-finally to ensure authRecoveryInFlight is always reset
- Fix variable scope issue: use const tabState instead of reassigning d
- Add error handling for process.stdin.write() to catch BrokenPipeError/OSError
- Verify WebSocket instance before closing in ping timeout callback
- Properly await conn.wait_closed() to prevent SSH connection leaks
- Gracefully cancel and wait for read_task with 2s timeout

These fixes prevent race conditions, resource leaks, and improve error recovery.
jimmy merged commit 69a198f723 into main 2026-03-15 23:22:09 +08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jimmy/nas-tools#37