Skip to content

refactor(coder-templates/firewalled): direct-install Claude Code + boundary wrapper#53

Open
ausbru87 wants to merge 2 commits into
mainfrom
feat/firewalled-direct-install
Open

refactor(coder-templates/firewalled): direct-install Claude Code + boundary wrapper#53
ausbru87 wants to merge 2 commits into
mainfrom
feat/firewalled-direct-install

Conversation

@ausbru87

Copy link
Copy Markdown
Collaborator

Rewrites the firewalled template to install Claude Code and the Coder Boundary agent firewall directly in the agent startup_script, replacing the claude-code registry module (4.7.3) and its AgentAPI / Coder Tasks wiring. Method adapted from the Red Hat Summit 2026 demo template.

What changed

  • Removed: module "claude_code", resource "coder_ai_task", data "coder_task", the ai_prompt parameter, the effective_prompt local, and the provider >= 2.13.0 constraint that only coder_task needed.
  • Added (in startup_script):
    • Claude Code native install into ~/.local/bin (claude.ai/install.sh).
    • Standalone boundary binary install (coder/boundary/main/install.sh).
    • Pre-seeded ~/.claude/settings.json + ~/.claude.json (claude_settings / claude_config locals) to skip onboarding/trust dialogs and set the AI Gateway endpoint.
    • Boundary wrapper at ~/.local/bin/boundary-wrappers/claude that runs boundary --config <cfg> --jail-type landjail -- <real claude> --dangerously-skip-permissions "$@", with the wrappers dir prepended to PATH in the shell rc files so claude is jailed by default. --dangerously-skip-permissions removes Claude's interactive prompts (boundary is the security boundary).
    • Operator firewall smoke-test scripts under ~/demo/.
  • AI Gateway auth: coder_env CLAUDE_API_KEY + ANTHROPIC_AUTH_TOKEN (session token); agent env ANTHROPIC_BASE_URL / ANTHROPIC_API_BASE.
  • boundary.config.yaml.tftpl allowlist is unchanged. README.md rewritten to match.
  • Codex/OpenAI intentionally omitted: Claude-only firewall demo.

Validation

  • terraform fmt and terraform validate pass.
  • Pushed to the demo deployment (coder templates push firewalled); the plan preview shows only coder_env x4, the PVC, and the pod (no module / task resources). Running fw-egress-* workspaces are untouched (they stay on the prior version).
Why direct-install instead of the module

The claude-code 4.7.3 module bundles AgentAPI and the Coder Tasks chat UI, which surfaced Claude's interactive "Bypass Permissions mode" select-menu that could not be reliably suppressed. The boundary wrapper's --dangerously-skip-permissions removes that prompt entirely, so the firewall demo runs hands-off from a normal terminal / code-server session. The standalone boundary binary also avoids the coder boundary subcommand's login/license dependency (the agent only carries an agent token).

Generated by Coder Agents, on behalf of @ausbru87.

ausbru87 added 2 commits June 11, 2026 01:42
…undary wrapper

Replace the claude-code registry module (4.7.3) and its AgentAPI / Coder
Tasks wiring with a direct install in the agent startup_script, adapted
from the Red Hat Summit 2026 demo template.

- Remove module "claude_code", coder_ai_task, data "coder_task", the
  ai_prompt parameter, the effective_prompt local, and the provider
  >= 2.13.0 constraint that only coder_task needed.
- Install Claude Code natively into ~/.local/bin and the standalone
  boundary binary via their install.sh scripts.
- Pre-seed ~/.claude/settings.json and ~/.claude.json (new claude_settings
  and claude_config locals) so onboarding/trust dialogs are skipped and the
  AI Gateway endpoint is configured.
- Wrap claude with boundary at ~/.local/bin/boundary-wrappers/claude
  (boundary --config <cfg> --jail-type landjail -- <real claude>
  --dangerously-skip-permissions "$@") and prepend the wrappers dir to PATH
  in the shell rc files, so claude runs jailed by default and the
  --dangerously-skip-permissions flag removes Claude's interactive prompts.
- Stage operator firewall smoke-test scripts under ~/demo/.
- AI Gateway auth via coder_env CLAUDE_API_KEY + ANTHROPIC_AUTH_TOKEN
  (session token) and agent env ANTHROPIC_BASE_URL/ANTHROPIC_API_BASE.

Codex/OpenAI is intentionally omitted: this is a Claude-only firewall demo.
boundary.config.yaml.tftpl allowlist is unchanged. terraform validate and
fmt pass. README rewritten to match.

Generated by Coder Agents.
… Gateway auth

Claude Code warned "Auth conflict: Both a token (ANTHROPIC_AUTH_TOKEN) and
an API key (/login managed key) are set" because the template provided two
credentials at once: the ANTHROPIC_AUTH_TOKEN env var (bearer token) plus a
~/.claude.json primaryApiKey and a CLAUDE_API_KEY env var (API key).

Keep ANTHROPIC_AUTH_TOKEN (the documented AI Gateway client contract in
deploy/CONVENTIONS.md) as the single credential. Remove the
coder_env.claude_api_key resource and the claude_config.primaryApiKey so
Claude Code sees exactly one auth source and starts without the warning.
~/.claude.json still carries the onboarding and project-trust flags.

Generated by Coder Agents.
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