Skip to content

[codex] Structure unavailable Bun PTY operations#3394

Merged
juliusmarminge merged 1 commit into
mainfrom
codex/structure-bun-pty-operation-errors
Jun 20, 2026
Merged

[codex] Structure unavailable Bun PTY operations#3394
juliusmarminge merged 1 commit into
mainfrom
codex/structure-bun-pty-operation-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • replace generic Bun PTY write/resize defects with a structured tagged error
  • include the unavailable operation and process id in diagnostics
  • derive the message from those attributes

Tests

  • vp test apps/server/src/terminal/BunPtyAdapter.test.ts
  • vp check
  • vp run typecheck

Note

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, BunPtyProcess no longer throws plain Error strings. It throws BunPtyOperationUnavailableError, an Effect Schema.TaggedErrorClass with operation (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 BunPtyOperationUnavailableError class

Replaces generic Error throws in BunPtyProcess.write() and BunPtyProcess.resize() with a new Schema.TaggedErrorClass named BunPtyOperationUnavailableError. The new error carries structured operation ('write' | 'resize') and pid fields, 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.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1f8f9f14-743a-4527-bd2f-d764b533bd32

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/structure-bun-pty-operation-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@juliusmarminge juliusmarminge merged commit 0675252 into main Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/structure-bun-pty-operation-errors branch June 20, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant