[bug] On Windows, runCommandHook in LIFEOS/CODEX/Bridge.ts does not stop at the hook…

Open Beginner friendly
#2,830 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bun, typescript
Domain
cli

Research direction

Start at runCommandHook in LIFEOS/CODEX/Bridge.ts and read the timeout handler together with the close listener that currently decides when the promise resolves. Reproduce by passing a SessionStart hook of sleep 8 with timeout: 2 through bridge() via deps.settings and timing the call. The fix is the reporter's: on win32, run taskkill /PID <child.pid> /T /F while the parent link still exists, then resolve as timed out without waiting for close. Done means the bridge returns near the timeout on Windows and no child process is left behind.

Written by the indexing model from the issue text.

Description

What happened

On Windows, runCommandHook in LIFEOS/CODEX/Bridge.ts does not stop at the hook timeout. The timer kills Git sh.exe, but the hook child process (bun, sleep) keeps running and holds the stdout and stderr pipes, so the close event fires only when the child ends and the bridge waits with it. Measured: a hook running sleep 8 with timeout 2 took 8.1 s. A local patch fixed it: on win32, run taskkill /PID /T /F before child.kill and resolve as timed out (2.1 s with sleep 60, no leftover processes).

Summary

On Windows, killing the hook's sh.exe does not kill the process it started, and that child keeps the pipes open, so runCommandHook resolves only when the child exits on its own. A hung hook holds the Codex bridge past its timeout, up to Codex's own hook timeout.

Repro: a SessionStart hook sleep 8 with timeout: 2 passed to bridge() through deps.settings takes about 8 s instead of about 2 s.

Fix that worked locally: in the timeout handler, on win32 run taskkill /PID <child.pid> /T /F before child.kill() (while the parent link still exists), then resolve as timed out without waiting for close. With sleep 60 and timeout: 2 the bridge returned in 2.1 s and no sleep process was left.

Details

  • Kind: bug
  • LifeOS version: 8.761.0

Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.

Dominant language
TypeScript
Stars
19.8k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from danielmiessler/LifeOS

All issues in danielmiessler/LifeOS

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.