daemon: profile daemon wedges with "Failed to get current directory" after its spawn directory is deleted #793
Unanswered
alleneubank
asked this question in
Troubleshooting and Bugs
Replies: 1 comment
|
Confirmed on current I opened #795 to start background daemons from AI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
The auto-spawned per-profile daemon inherits the client's working directory. Every request runs
CwdGuard::change_to(req.cwd), which captures the daemon's owncurrent_dir()so it can restore it afterwards. Once the spawn directory is deleted (a removed git worktree, for instance)getcwdfails and every request for that profile errors until the daemon is killed.Repro (v1.34.1, macOS; same on Linux)
fnox.toml:Root cause
start_background_for_contextinsrc/daemon.rsdetaches the daemon withsetsidand null stdio but never sets a working directory, so the daemon keeps the client's cwd for its whole lifetime.CwdGuard::change_toinsrc/daemon.rscallsstd::env::current_dir()before switching to the request cwd; with the spawn directory gone that call fails on every request.Fix
Spawn the daemon with
current_dir("/")next to the existingsetsid; each request already switches to the client's cwd. A PR with that one-line change and a bats regression test is ready to open.Sent with Claude Code Fable
AI-assisted — Tool: Claude Code 2.1.257; model: anthropic/claude-fable-5-1; version: unavailable.
All reactions