[PR #6561] Fix/nested cwd server handling #11975

Closed
opened 2026-02-16 18:16:54 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6561

State: closed
Merged: No


Fixed server failures when starting from deeply nested directories by changing process.cwd() to home directory at startup.

Added process.chdir(Global.Path.home) in serve and web command handlers to establish stable working directory
Updated server middleware fallback from process.cwd() to Global.Path.home for consistency
Added comprehensive regression tests validating the fix across multiple scenarios
The fix prevents "No such file or directory" errors that occurred when the server process's working directory became invalid or was deleted

Before:

https://github.com/user-attachments/assets/683f848a-ff62-4c5f-b3ca-2b1973f1d752

After:

https://github.com/user-attachments/assets/d9e77d2e-b0d9-4a4c-8271-9dac90f64e67

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6561 **State:** closed **Merged:** No --- Fixed server failures when starting from deeply nested directories by changing process.cwd() to home directory at startup. Added process.chdir(Global.Path.home) in serve and web command handlers to establish stable working directory Updated server middleware fallback from process.cwd() to Global.Path.home for consistency Added comprehensive regression tests validating the fix across multiple scenarios The fix prevents "No such file or directory" errors that occurred when the server process's working directory became invalid or was deleted Before: https://github.com/user-attachments/assets/683f848a-ff62-4c5f-b3ca-2b1973f1d752 After: https://github.com/user-attachments/assets/d9e77d2e-b0d9-4a4c-8271-9dac90f64e67
yindo added the pull-request label 2026-02-16 18:16:54 -05:00
yindo closed this issue 2026-02-16 18:16:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11975