Skip to content

fix(tui): clean up controlling input on guard setup errors - #571

Merged
agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
fix/441-console-setup-cleanup
Oct 24, 2026
Merged

agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
fix/441-console-setup-cleanup

Conversation

@agenteinstinct1-max

Copy link
Copy Markdown
Collaborator

Issue for this PR

Refs #441

Type of change

  • Bug fix

What does this PR do?

Narrow post-merge follow-up to #570 review findings F2/F3. If raw-hook assignment or timer setup throws after opening CONIN$, guard setup now restores/cleans up before propagating the error. Guard installation is moved inside the lifecycle cleanup try so its failure also closes the resolved terminal stream. Normal successful guard behavior is unchanged.

The invalid-handle fixture now uses 0xffffffffffffffff, the float64 representation bun:ffi returns for INVALID_HANDLE_VALUE on x64, instead of the nonrepresentative -1 fixture. The production comparison was already correct.

#441 stays open for actual Windows console/editor acceptance. These tests model boundaries and do not raise a real CTRL_C_EVENT or establish Windows runtime success.

How did you verify your code works?

Bun1.3.14/Linux: helper+editor16passed/54assertions; lifecycle failure+stdin routing+launcher policy7passed/24assertions. Focused helper/new-test TypeScript check passes. Full local package typecheck is not claimed; exact-head CI and independent review remain required.

Tests execute actual transpiled product sources. New raw-setter and timer-throw regressions fail on pre-fix product code (2failures); the lifecycle guard-install failure regression also fails on pre-fix code (source cleanup count0 instead of1). Restoring fixes returns all green. No existing assertion removed, timeout changed or skip added.

Win32 API contract source: https://learn.microsoft.com/en-us/windows/console/console-handles . The CreateFile CONIN$ handle is independent of redirected standard input. Actual FFI/console behavior remains unverified locally.

Screenshots / recordings

No Windows console screenshot available; runtime acceptance remains outstanding.

Checklist

  • Narrow leak paths and representative invalid-handle fixture covered
  • Pre-fix failures and restored green reproduced
  • Exact-head CI and independent review
  • Real Windows console acceptance

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kilo-code-bot

kilo-code-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • packages/opencode/src/cli/cmd/run/runtime.lifecycle.ts
  • packages/opencode/test/cli/run/runtime.guard-cleanup.test.ts
  • packages/tui/src/terminal-win32.ts
  • packages/tui/test/terminal-win32.test.ts

Reviewed by free · Input: 28.5K · Output: 2.5K · Cached: 149.6K

@agenteinstinct1-max
agenteinstinct1-max merged commit 99a1fe9 into dev-vibecoded Oct 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant