fix(fs): tolerate EACCES on existing mkdir targets (#319)

Add mkdirSafe/mkdirSyncSafe helpers that swallow EACCES/EPERM when the
target directory already exists with execute permission, and route all
recursive mkdir call sites through them so pre-existing directories
owned by another user do not break backend startup, file ops, or repo
mirroring.
This commit is contained in:
Chris Scott authored and GitHub committed 2026-07-23 22:51:17 -04:00
1 parent 8a8bdc18b0
commit 87f3d7f230
22 files changed
+210 -46

No files matched your search

+2 -1
View File
@@ -8,6 +8,7 @@ import { getWorkspacePath } from '@opencode-manager/shared/config/env'
import { broadcastSSHHostKeyRequest } from '../services/sse-aggregator'
import { executeCommand } from '../utils/process'
import { parseSSHHost, normalizeHostPort } from '../utils/ssh-key-manager'
import { mkdirSafe } from '../utils/fs-safe'
interface SSHHostKeyRequest {
id: string
@@ -40,7 +41,7 @@ export class SSHHostKeyHandler implements IPCHandler {
private async ensureKnownHostsFile(): Promise<void> {
try {
const configDir = path.join(getWorkspacePath(), 'config')
await fs.mkdir(configDir, { recursive: true })
await mkdirSafe(configDir)
try {
await fs.access(this.knownHostsPath)
} catch {