Skip to content

claude adapter: let a workspace's .claude/settings.json widen headless --allowedTools - #1317

Open
matttready wants to merge 1 commit into
TraderAlice:devfrom
matttready:fix/headless-allowedtools-from-workspace-settings
Open

claude adapter: let a workspace's .claude/settings.json widen headless --allowedTools#1317
matttready wants to merge 1 commit into
TraderAlice:devfrom
matttready:fix/headless-allowedtools-from-workspace-settings

Conversation

@matttready

Copy link
Copy Markdown

Claude Code -p gates non-safe Bash on the --allowedTools flag only — it does not read project settings files for that decision (verified 2.1.258). So a scheduled headless run whose Issue needs a project-specific command (a committed wrapper, git push, alice-workspace inbox push) hits an auto-denied approval prompt with nobody to answer it, and fails silently.

composeHeadlessCommand now reads <cwd>/.claude/settings.json permissions.allow and appends its Bash(...) / mcp__* entries to the locked four-shim list. Opt-in per workspace by committing that file; workspaces that ship none are unchanged. sandbox is intentionally not forwarded.

Tests: ai-config.spec.ts gains merge + malformed-file cases; tsc clean, 107 pass.

Suggested labels: workflow:parallel, theme:safety, area:settings, area:workspace, review:deep.

🤖 Generated with Claude Code

…s --allowedTools

Claude Code `-p` decides the non-safe Bash surface from the `--allowedTools`
flag alone; it does not read project settings files for that gate (verified
against 2.1.258 -- permissions.allow in .claude/settings.json, the same key in
an inline --settings blob, and --setting-sources user,project,local were all
ignored, while a rule in the CLI flag worked). So a scheduled headless run in a
workspace whose Issue needs a project-specific command (e.g. a committed
wrapper script, `git push`, `alice-workspace inbox push`) hit an auto-denied
approval prompt with nobody to answer it, and the run failed silently.

composeHeadlessCommand now reads `<cwd>/.claude/settings.json`
`permissions.allow` and appends its `Bash(...)` / `mcp__*` entries to the
locked four-shim list. A workspace opts in by committing that file; workspaces
that ship none are unchanged. Malformed / missing file -> default untouched.

`sandbox` is intentionally not forwarded -- that is a separate knob.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YQRgbzfqMNh99YJFXEUJ7c
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the luokerenx4's Team Team on Vercel.

A member of the Team first needs to authorize it.

@matttready

Copy link
Copy Markdown
Author

Gentle nudge — this one is small (1 source file + tests) and unblocks a real operational failure.

What breaks without it: a scheduled/headless harness run (claude -p) whose Issue needs a project-specific command — a committed wrapper script, git push, alice-workspace inbox push — hits an auto-denied permission prompt with nobody to answer it, and the run fails silently. Claude Code -p decides the non-safe Bash surface from the --allowedTools flag alone; it does not read .claude/settings.json permissions.allow for that gate (verified against 2.1.258).

Fix: composeHeadlessCommand reads <cwd>/.claude/settings.json permissions.allow and appends its Bash(...) / mcp__* entries to the locked shim list. A workspace opts in by committing that file; workspaces that ship none are unchanged. sandbox is intentionally not forwarded.

Verified end-to-end in production: with the workspace file in place, previously-blocked scheduled paper-trading bots (bash run_live.sh …, python3 <bot>/runner.py …) fired on schedule and executed. npx tsc --noEmit clean, ai-config.spec.ts +2 cases (107 pass).

CI hasn't run — looks like it needs a maintainer to approve the workflow for this fork PR (the only check showing is an unrelated Vercel deploy-preview auth failure).

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