[codex] Structure unavailable Bun PTY operations#3394
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR replaces generic Error throws with a structured error class for PTY unavailability cases. The runtime behavior is unchanged - errors are thrown in the same conditions, just with better structure for downstream handling. Includes appropriate test coverage. You can customize Macroscope's approvability policy. Learn more. |
Summary
Tests
vp test apps/server/src/terminal/BunPtyAdapter.test.tsvp checkvp run typecheckNote
Low Risk
Localized Bun PTY adapter error typing only; no auth, data, or broader terminal flow changes.
Overview
When Bun’s PTY lacks a terminal handle or
resize,BunPtyProcessno longer throws plainErrorstrings. It throwsBunPtyOperationUnavailableError, an EffectSchema.TaggedErrorClasswithoperation(write|resize),pid, and a derived message.A small test asserts the tag, fields, and message for the resize case.
Reviewed by Cursor Bugbot for commit bb36ed6. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure unavailable Bun PTY errors with tagged
BunPtyOperationUnavailableErrorclassReplaces generic
Errorthrows inBunPtyProcess.write()andBunPtyProcess.resize()with a newSchema.TaggedErrorClassnamedBunPtyOperationUnavailableError. The new error carries structuredoperation('write' | 'resize') andpidfields, and formats a deterministic message like'Bun PTY resize is unavailable for process 42.'. A test in BunPtyAdapter.test.ts validates the structure and message.Macroscope summarized bb36ed6.