Skip to content

fix(gate): treat a process that exits mid-read as gone - #589

Merged
kixelated merged 1 commit into
mainfrom
fix/gate-esrch
Nov 9, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/gate-esrch

Conversation

@kixelated

@kixelated kixelated commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

On Linux, a read of /proc/<pid>/stat that races the process's exit fails with ESRCH, not ENOENT. processStart and alive treated only ENOENT as gone, so the race threw out of the gate's admission check. A merge group failed this way in moq-dev/quest#586. The land fixer also reported it on main for moq-dev/quest#555.

Behavior

processStart and alive now treat ESRCH like ENOENT: the process is gone, so processStart returns undefined and alive returns false. Any other read error still throws.

The other /proc/<pid> reads already treat every error as gone (interrupt.ts, land-fixer.ts, the test helper). worktree.ts reads no /proc/<pid> file, so it needs no change.

Caused by

Validation

  • New unit tests inject a failing stat read for one process, without timing. Without the fix, the ESRCH case fails with ESRCH: no such process, read. With it, ENOENT and ESRCH both read as gone, and EACCES still throws.
  • just check and just test, run through quest gate, pass.

Public API: none.

Models

Size: XS

Implementer: Claude, claude-haiku-5-5, high effort

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, low effort
  • Session: 01a1c1f4-e2c7-7e90-8b39-5b7d88763454, round 1
  • Head: adcfbc6
  • Base: origin/main at 12bd047
  • Score: 9/10, The change correctly treats ESRCH during Linux process-stat reads as an exited process while preserving other errors and includes focused regression coverage; code inspection found no defects, but tests were not run as instructed.
  • Findings: none

(Written by Claude Haiku 5.5 with high)

Linux reports a /proc/<pid>/stat read that races the process's exit as
ESRCH rather than ENOENT. processStart and alive caught only ENOENT, so
the race threw out of the gate's admission instead of reading the process
as gone. The failure reached a merge group in
#586.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@pullfrog

pullfrog Bot commented Nov 9, 2026

Copy link
Copy Markdown

Pullfrog  | Review this ➔

@kixelated
kixelated marked this pull request as ready for review November 9, 2026 20:17
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 215c52a2-1239-4a83-913f-731c3e1dd54e
Commits

Reviewing files that changed from the base of the PR and between 12bd047 and adcfbc6.

Files selected for processing: 3

  • src/cli/gate.ts
  • src/cli/supervise.ts
  • test/gate.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed head: adcfbc6

No actionable findings in the reviewed changes.

Direction: recognizing ESRCH alongside ENOENT at both process-liveness callers handles the exited-process race without turning permission or other unexpected read failures into false “gone” results. The focused mock covers both callers and both disappearance codes, preserves EACCES failures, and resets its injected read failure after each case.

Verification limits: GitHub-only static review of all changed files and surrounding liveness logic. No repository code, tests, builds, or live /proc race reproduction performed. At inspection, GitHub reported the build and both Linux platform checks successful, with the Windows checks still running; the PR author's local test results were not independently rerun.

(Written by review (OpenAI))

@kixelated
kixelated added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 3302e8a Nov 9, 2026
22 checks passed
@kixelated
kixelated deleted the fix/gate-esrch branch November 9, 2026 21:06
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