Skip to content

fix(job): drain stdio pipes before finalising on process exit#195

Merged
dlyongemallo merged 1 commit into
mainfrom
fix_uv_spawn_race
May 21, 2026
Merged

fix(job): drain stdio pipes before finalising on process exit#195
dlyongemallo merged 1 commit into
mainfrom
fix_uv_spawn_race

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

The uv.spawn exit callback called read_stop/try_close on stdout and stderr the moment the child exited, dropping any chunks still queued behind the exit notification. Symptom: DiffviewFileHistory intermittently shows fewer commits than the range contains, because the tail of git log's output never reaches on_stdout.

Defer finalisation until both the process has exited and both pipes have delivered EOF.

The `uv.spawn` exit callback called `read_stop`/`try_close` on stdout
and stderr the moment the child exited, dropping any chunks still
queued behind the exit notification. Symptom: `DiffviewFileHistory`
intermittently shows fewer commits than the range contains, because
the tail of `git log`'s output never reaches `on_stdout`.

Defer finalisation until both the process has exited and both pipes
have delivered EOF.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an intermittent truncation of job output by ensuring uv.spawn jobs don’t finalize until both (1) the child process has exited and (2) stdout/stderr pipes have reached EOF, preventing late queued chunks from being dropped (notably impacting git log output used by file history views).

Changes:

  • Update stdout/stderr reader callbacks to signal EOF via an on_eof hook.
  • Defer job finalization logic until process-exit and both stdio EOF signals have been observed.
  • Avoid closing stdout/stderr pipes from the process-exit callback to prevent dropping queued output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dlyongemallo dlyongemallo merged commit 6050446 into main May 21, 2026
11 checks passed
@dlyongemallo dlyongemallo deleted the fix_uv_spawn_race branch May 21, 2026 05:03
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.

2 participants