Skip to content

fix: set world-writable permissions on cluster log dir and files (#203)#220

Open
kaixinbaba wants to merge 1 commit into
stephengpope:mainfrom
kaixinbaba:fix/issue-203-log-dir-permissions
Open

fix: set world-writable permissions on cluster log dir and files (#203)#220
kaixinbaba wants to merge 1 commit into
stephengpope:mainfrom
kaixinbaba:fix/issue-203-log-dir-permissions

Conversation

@kaixinbaba

Copy link
Copy Markdown

Root Cause

The cluster worker container runs as the claude-code user, while the host process (in lib/cluster/execute.js) runs as root. When the root process creates the log directory and writes initial files (system-prompt.md, user-prompt.md, meta.json, trigger.json), they are created with restrictive permissions that prevent the worker container from:

  • Creating new files in the log directory (stdout.jsonl, stderr.txt)
  • Updating existing files (meta.json)

Solution

Added fs.chmodSync() calls to make files and directories world-writable:

  1. After fs.mkdirSync(logDir, { recursive: true }) → add fs.chmodSync(logDir, 0o777)
  2. After each fs.writeFileSync() for log files → add corresponding fs.chmodSync(filePath, 0o666)

This allows the worker container to read, write, and update all log files without permission errors.

Changed Files

  • lib/cluster/execute.js: Added 5 chmodSync calls

Testing

  • Syntax check: node --check lib/cluster/execute.js
  • Changes are minimal and isolated to log file permissions only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant