Repository navigation
Conversation
os-lib registers its destroy-on-exit shutdown hook, and starts a thread that removes it, before starting the process. When the start fails (for example the agent CLI is not on PATH), both retry the start and print the failure as an uncaught exception. Spawn with destroyOnExit = false and register the hook only after the process has started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
When the agent CLI (e.g.
claude) is not on PATH, a run printed up to four lines like[orca] uncaught exception on thread 'subprocess-shutdown-hook-monitor': Cannot run program "claude". The failure itself was handled correctly; the lines were noise.Why
os-lib's
spawnregisters a shutdown hook, and starts a monitor thread that removes it, before it starts the process. When the start fails, the monitor thread tries to start the process again and dies with the error. The hook stays registered, and at JVM exit it tries the start once more and dies too. Each spawn attempt gives two lines.Fix
New
orca.subprocess.Spawn: calls os-lib withdestroyOnExit = false, and registers the shutdown hook only after the process has started (removed on process exit). The process is still destroyed on JVM exit, as before.Used by
OsProcCliRunner.spawnPiped,QuietProc.call/callCapped(so a missingghis covered too), and in the shell by the slug-naming call, session resume, the editor and the flow launch (Spawn.inheritingStdiofor the ones on the terminal's stdio). A few direct os-lib calls ofgit,bashandtestare left as they are.Not done: up-front CLI check
A run still creates its branch and commits the progress log before it finds the CLI missing. A check before setup needs a "is my CLI on PATH" method on each of the five backends (so test fakes don't trip it), and a decision on which roles to check: a flow may never use the review role, so refusing because its CLI is missing could break runs that work today. Left as a follow-up.
Testing
OsProcCliRunnerTestandQuietProcTest: starting a missing program throws to the caller and no os-lib thread dies. Both fail without the fix.SpawnTest: the shutdown hook is removed once the process exits.testFull,scalafmtCheckAllgreen.orca run quick.scwithclauderemoved from PATH prints no uncaught-exception lines.🤖 Generated with Claude Code