Skip to content

fix: terminal PTY write/resize errors silently swallowed#747

Merged
xiaolai merged 1 commit intomainfrom
fix/audit-698
Apr 8, 2026
Merged

fix: terminal PTY write/resize errors silently swallowed#747
xiaolai merged 1 commit intomainfrom
fix/audit-698

Conversation

@xiaolai
Copy link
Copy Markdown
Owner

@xiaolai xiaolai commented Apr 8, 2026

Closes #698

Summary

  • Replace empty .catch(() => {}) blocks in all 7 PTY IPC calls with proper error logging
  • pty_write and pty_resize failures use ptyWarn (persisted to log file in production) — these indicate data loss or geometry mismatch
  • pty_kill, pty_pause, pty_resume, pty_close failures use terminalLog (dev-only debug) — fire-and-forget semantics are acceptable
  • Added ptyWarn logger to src/utils/debug.ts
  • Non-Error rejection values handled via instanceof guard

Test plan

  • 6 new tests verifying error logging for write, resize, kill, pause, resume, and non-Error values
  • All 19 PTY tests pass
  • pnpm check:all passes (lint + coverage + build)

🤖 Generated with Claude Code

Replace empty `.catch(() => {})` blocks in PTY IPC calls with proper
error logging. Write and resize failures use `ptyWarn` (persisted to
log file in production) since they indicate data loss or geometry
mismatch. Kill, pause, resume, and close use `terminalLog` (dev-only
debug) since fire-and-forget semantics are acceptable there.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@xiaolai xiaolai added the audit Codebase audit finding label Apr 8, 2026
@xiaolai
Copy link
Copy Markdown
Owner Author

xiaolai commented Apr 8, 2026

VERIFIED — All 7 silent .catch(() => {}) blocks in src/lib/pty.ts are replaced with appropriately-leveled logging (ptyWarn for write/resize, terminalLog for kill/pause/resume/close), with proper error narrowing and matching test coverage.

@xiaolai xiaolai enabled auto-merge (squash) April 8, 2026 14:46
@xiaolai xiaolai merged commit 3ec96b6 into main Apr 8, 2026
8 checks passed
@xiaolai xiaolai deleted the fix/audit-698 branch April 8, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit Codebase audit finding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit] terminal: PTY write/resize errors silently swallowed

1 participant