Let headless claude runs write in their own Workspace - #1339
Conversation
--allowedTools covers Bash only, so Write/Edit fell through to the permission prompt claude -p has nobody to answer. Headless Issues that write a report, append to a watchlist, or update a map lost their output and reported every Write/Edit call denied by the sandbox. pi passes --approve and agy passes --dangerously-skip-permissions under Docker; claude was the only adapter that could not persist. acceptEdits grants file writes and leaves Bash gated, so the allowlist keeps its meaning instead of being replaced by a blanket bypass. Verified against Claude Code 2.1.237: auto and dontAsk are both no-ops headless, they still escalate to an unanswerable prompt, so acceptEdits is the only mode that works. Write-class Bash stays denied, so git commit in an Issue body still fails. Narrow Bash(git add:*) / Bash(git commit:*) prefixes are a separate follow-up.
|
@eutialia is attempting to deploy a commit to the luokerenx4's Team Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
🔵 Needs a closer look
It changes runtime permission behavior for a headless agent process and depends on external Claude Code flag semantics/compatibility that can’t be fully validated from the diff alone.
Pull request overview
Enables non-interactive Claude Code (claude -p) runs to successfully perform file Write/Edit operations within a Workspace by explicitly setting a headless-specific permission mode, preventing tool calls from falling through to an unanswerable prompt during scheduled/automated runs.
Changes:
- Add a headless-only
--permission-mode acceptEditsflag to the Claude adapter’s headless argv. - Update the headless argv composition test to assert the new flag is present in the expected position.
File summaries
| File | Description |
|---|---|
| src/workspaces/adapters/claude.ts | Adds a dedicated headless permission mode constant and passes --permission-mode acceptEdits for claude -p runs. |
| src/workspaces/adapters/ai-config.spec.ts | Updates the composeHeadlessCommand expectation for Claude to include the new permission-mode flag. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
claude code usually has this kind of strange actions. Thanks for your PR . I will merge it after 0.91.0 launch. |
Summary
claude -p) pass--allowedToolscovering only theBash(alice*)prefixes, so every Write and Edit falls through to a permission prompt nobody can answer. Scheduled Issues that write a report, append to a watchlist, or update a map lose their output, and the session record shows each Write and Edit denied.--permission-mode acceptEditsto the headless argv. File writes inside the Workspace are granted, Bash stays gated by the allowlist.--dangerously-skip-permissionsalso unlocks arbitrary Bash;autoanddontAskstill escalate to an unanswerable prompt in-pmode (checked on Claude Code 2.1.259); shipping a permissions block in the Workspace.claude/settings.local.jsonchanges the settings contract Alice writes and would apply to interactive sessions.Included increments
fix(workspaces): let headless claude runs write in their own Workspace(src/workspaces/adapters/claude.ts,ai-config.spec.ts)Verification
npx tsc --noEmit(root, coverssrc/): cleannpx vitest run src/workspaces/adapters/ai-config.spec.ts: 105 passedBoundary touch
Non-goals
git commitinside an Issue body still fails. Bash grants belong to the individual Workspace, not the adapter, so they are out of scope here.