Skip to content

fix(hive): bound hook stdin reads - #735

Open
HsienW wants to merge 1 commit into
HarnessMD:mainfrom
HsienW:fix/hook-stdin-deadline
Open

HsienW wants to merge 1 commit into
HarnessMD:mainfrom
HsienW:fix/hook-stdin-deadline

Conversation

@HsienW

@HsienW HsienW commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Hook shims previously started their Socket timeout only after stdin reached EOF. If a provider kept stdin open, the shim had no deadline of its own and could wait indefinitely. This addresses #278 M4 by bounding the stdin-read phase in all generated shims while preserving post-EOF Socket timeouts and existing provider output, exit, and permission behavior. The --status path retains its shorter timeout, and Antigravity still emits no stdout when an operation is allowed.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs
  • Build / CI

Evidence

Before

Running the new no-EOF regression test against the pre-change shims fails as expected. All nine cases reach the parent watchdog with hard_timeout=true and SIGKILL; the test reports 0 passed and 1 failed.

image

After

The same no-EOF test passes. All nine cases exit with code 0 before the parent watchdog, report hard_timeout=false, and do not forward input before EOF.

image

The generated-shim syntax and provider-contract test also passes for Claude/Codex, Antigravity, Gemini, and Grok.

image

How I tested it

  • OS: Windows, using PowerShell and Node subprocesses without starting the Electron UI.
  • Before: node --test --test-name-pattern 'stdin without EOF' .\test\hive-hook-stdin-deadline.test.cjs against the pre-change shims: 0 passed, 1 failed.
  • After: The same no-EOF command: 1 passed, 0 failed.
  • node --test --test-name-pattern 'generated hook shims preserve provider output' .\test\hive-hook-stdin-deadline.test.cjs: 1 passed, 0 failed.
  • node --test .\test\hive-hook-stdin-deadline.test.cjs: 6 passed, 0 failed, 0 skipped.
  • npm run typecheck: passed.
  • npm run build: passed.
  • git diff --check: passed.
  • On Windows, npm run test:focused reported 929 passed, 25 failed, and 14 skipped. The M4-specific suite passed all 6 tests, so the focused-suite checkbox remains unchecked.

Checklist

  • Before and after evidence is attached above, under both headings. Check this after uploading the images.
  • npm run typecheck passes.
  • npm run test:focused passes.
  • npm run build succeeds.
  • This PR is one change. Unrelated fixes belong in their own PR.
  • I read the diff myself before opening this, and there is no debug output, commented-out code, or unrelated formatting churn in it.
  • Any new UI derives from DESIGN.md / tokens.ts. Not applicable; this PR adds no UI.
  • If I added art, it's my own or compatibly licensed, and listed in ATTRIBUTION.md. Not applicable; this PR adds no art.

Start a bounded stdin-read phase in all four generated hook shims.
Settle EOF, timeout, error, and early close once; release stdin
handles on failure without forwarding input that has not reached EOF.

Preserve post-EOF Socket timeouts and provider stdout, exit, and
permission contracts. Add Windows Node subprocess tests covering
no-EOF cases, provider responses, UTF-8 chunks, Socket outcomes,
and generated shim syntax.
@HsienW
HsienW requested a review from chaitanyagiri as a code owner October 13, 2026 09:05

This branch has not been deployed

No deployments
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.

1 participant