Skip to content

fix: release host terminals after usage scans - #32

Open
MayankBansal12 wants to merge 3 commits into
mainfrom
fix/issue-28-terminal-lifecycle
Open

fix: release host terminals after usage scans#32
MayankBansal12 wants to merge 3 commits into
mainfrom
fix/issue-28-terminal-lifecycle

Conversation

@MayankBansal12

@MayankBansal12 MayankBansal12 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • let host scan commands exit naturally instead of holding their shells with an infinite sleep loop
  • read final output and exit status after the terminal exits
  • use clean close for completed commands, reserving force close for timeout or cancellation
  • log terminal cleanup failures
  • cap collection at three concurrent terminals per machine

Why

On bb 0.40.0 for macOS, repeated forced closes can leak PTY resources. The prior keep-alive loop and nine parallel scans accelerated that leak until bb could no longer open terminals.

Fixes #28

@MayankBansal12

Copy link
Copy Markdown
Owner Author

Follow-up validation: bb only exposes terminal output while a session is running, so reading after natural exit caused HTTP 409 failures across all collectors. The branch now uses a bounded handshake: capture output while running, send a release line, then wait for natural exit. The shell fallback is capped at 30 seconds—there is no infinite hold.

Live-tested with an isolated copy of the actual plugin restricted to the current machine. Codex, Claude, fx, Grok, Pi, Prime, Antigravity, OpenCode, and OpenCode Go all completed without terminal-output 409s. The temporary test plugin was removed afterward.

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.

Scan loop holds a PTY with sleep 3600; on bb 0.40.0 that exhausts macOS ptmx

1 participant