Repository navigation
fix(daemon): gate agent startup cwd after safe default fallback - #10035
Merged
nwparker merged 1 commit intoJul 24, 2026
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughDaemon agent startup now resolves an omitted 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
createPtySubprocess asserted assertSafeAgentStartupCwd on the raw opts.cwd before applying opts.cwd || getDefaultCwd(). An omitted cwd was treated as root-like and threw even though the post-fallback home default is safe — while LocalPtyProvider already gates the effective cwd after fallback. Compute requestedCwd first, then gate. Update the daemon unit test to assert omitted-cwd agent launch uses the safe default (stablyai#9578).
nwparker
force-pushed
the
fix/daemon-agent-startup-cwd-fallback
branch
from
July 23, 2026 11:49
b02027d to
f2134eb
Compare
Contributor
|
Thanks so much @innocarpe — verified the daemon now gates the agent-startup cwd on the effective cwd (matching LocalPtyProvider), and an explicit '/' still correctly throws. Proven + merged. 🙏 |
This was referenced Jul 27, 2026
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…lyai#10035) createPtySubprocess asserted assertSafeAgentStartupCwd on the raw opts.cwd before applying opts.cwd || getDefaultCwd(). An omitted cwd was treated as root-like and threw even though the post-fallback home default is safe — while LocalPtyProvider already gates the effective cwd after fallback. Compute requestedCwd first, then gate. Update the daemon unit test to assert omitted-cwd agent launch uses the safe default (stablyai#9578).
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.
fix(daemon): gate agent startup cwd after safe default fallback
Summary
Launching a recognized agent (e.g. OpenCode) through the daemon PTY path with no explicit workspace
cwdno longer fails with "Automatic agent startup command … requires a non-root workspace working directory."ELI5
Orca can auto-start coding agents in a terminal, and refuses to do so at the filesystem root because that's unsafe. When you don't pass a folder, it's supposed to fall back to your home directory first and then check safety — but the background daemon checked safety first, so "no folder" was mistaken for "root" and got rejected.
Root cause & fix
createPtySubprocesscalledassertSafeAgentStartupCwd(opts.cwd, …)before applying theopts.cwd || getDefaultCwd()fallback. An omitted/undefinedcwd is treated as root-like, so the guard threw even though the post-fallback default (safeHOME/USERPROFILE) would pass. The fix computesrequestedCwd = opts.cwd || getDefaultCwd()first and validates that effective cwd — matching the order the in-processLocalPtyProvideralready uses. Explicit root (cwd: '/') still rejects agent auto-start.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23.
pty-subprocess.test.tspasses on branch: Test Files 1 passed, Tests 109 passed.git checkout origin/main -- pty-subprocess.ts) while keeping the test makes it fail, proving the test captures the bug:npx oxlint src/main/daemon/pty-subprocess.ts→ no warnings/errors.origin/main; changed files:src/main/daemon/pty-subprocess.ts(fix),src/main/daemon/pty-subprocess.test.ts(test).Trade-offs
None — pure fix. Omitted-cwd agent startup now succeeds only when the default home is safe; explicit root-like paths still throw and plain shells at root are unchanged.
Regression risk
Effectively zero. The change only reorders fallback and guard so the daemon path validates the same effective cwd the in-process
LocalPtyProvideralready does; root rejection remains intact and is covered by the retained test. The one flipped test expectation previously encoded the bug itself.Credit to original author @innocarpe (Wooseong Kim). Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.