Skip to content

fix: prevent terminal corruption during background bun install#2451

Merged
code-yeongyu merged 4 commits intodevfrom
fix/issue-2238-v2
Mar 11, 2026
Merged

fix: prevent terminal corruption during background bun install#2451
code-yeongyu merged 4 commits intodevfrom
fix/issue-2238-v2

Conversation

@code-yeongyu
Copy link
Owner

@code-yeongyu code-yeongyu commented Mar 11, 2026

Summary

  • recreate the closed fix: prevent terminal corruption during background bun install #2369 fix on top of current dev
  • add a piped output mode to runBunInstallWithDetails() so background bun install no longer inherits the active terminal output
  • update the auto-update checker and regression tests to use silent background installs and only surface captured logs on failure

Testing

  • bun test src/cli/config-manager/bun-install.test.ts src/hooks/auto-update-checker/hook/background-update-check.test.ts
  • bun run typecheck
  • bun run build

Fixes #2238


Summary by cubic

Prevents terminal corruption by running background bun install in silent pipe mode. Adds output control to runBunInstallWithDetails() and updates the auto-update checker to use it, surfacing captured logs only on failure or timeout.

  • Bug Fixes
    • Added outputMode ("inherit" | "pipe", default "inherit") to runBunInstallWithDetails(); in pipe mode, capture stdout/stderr via Bun stream-to-text.
    • Log captured output only when the install fails or times out; keep the active terminal clean otherwise.
    • Improved timeouts: kill hung processes, handle non-resolving exited, and return timedOut: true with a clear error.
    • Auto-update checker now calls runBunInstallWithDetails({ outputMode: "pipe" }) and logs failure messages.
    • Tests cover piped output, failures, and timeouts; added Bun type refs in both related test files.

Written for commit de2b073. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Confidence score: 3/5

  • There is a concrete regression risk in src/cli/config-manager/bun-install.ts: the timeout handler still awaits process exit, which can permanently hang if the child process is stuck.
  • Because this is a high-severity, high-confidence issue (7/10, 9/10) affecting timeout safety in CLI install flow, merge risk is moderate rather than minimal.
  • Pay close attention to src/cli/config-manager/bun-install.ts - timeout logic can block indefinitely instead of failing fast.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/cli/config-manager/bun-install.ts">

<violation number="1" location="src/cli/config-manager/bun-install.ts:106">
P1: Awaiting process exit unconditionally inside the timeout handler defeats the timeout's protection. If the process is stuck, this causes a permanent hang.

To safely log the output without blocking the timeout return, handle the promise asynchronously.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

code-yeongyu and others added 4 commits March 11, 2026 20:50
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@code-yeongyu code-yeongyu merged commit 3f364cc into dev Mar 11, 2026
7 checks passed
@code-yeongyu code-yeongyu deleted the fix/issue-2238-v2 branch March 11, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: There is a problem of incorrect rendering.

1 participant