Skip to content

feat(coder/agent-relay-claude-code): add additional_args - #1198

Merged
matifali merged 3 commits into
mainfrom
claude/code-server-extra-args-nque0n
Oct 22, 2026
Merged

matifali merged 3 commits into
mainfrom
claude/code-server-extra-args-nque0n

Conversation

@matifali

@matifali matifali commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Description

Adds an additional_args input to agent-relay-claude-code for passing extra flags to claude self-hosted-runner. coder/registry#1199 makes the same change to agent-relay-cursor.

additional_args is a map of flag to value. Each key goes to the CLI exactly as written, so the admin decides between a long flag (--flag) and a short one (-f). The value comes next as a separate argument, and an empty value passes the flag alone. The flags go after the ones the module sets and before --exec-path.

module "claude_code_runner" {
  source   = "registry.coder.com/coder/agent-relay-claude-code/coder"
  version  = "0.3.0"
  agent_id = coder_agent.main.id
  # Passed as: --another-flag --some-flag value
  additional_args = {
    "--another-flag" = ""
    "--some-flag"    = "value"
  }
}
  • Verbatim values: the map is base64-encoded into the start script, one argument per line. The script shell-quotes each argument with printf %q before writing it into the detached supervisor, so values reach the CLI unchanged: spaces, quotes, $VAR and backticks are not split or expanded.
  • Validation: keys must look like --name or -n, and values can't contain newlines.
  • Flags the module sets are rejected: --capacity, --base-dir, --exit-if-unused-min, --exec-path. Use the base_dir and exit_if_unused_min inputs instead. A comment in main.tf and in start.sh.tftpl says to keep this list in sync with the runner command.

The name additional_args is the most common one in the registry; code-server and ttyd already use it.

Type of Change

  • New module
  • New template
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Module Information

Path: registry/coder/modules/agent-relay-claude-code
New version: v0.3.0
Breaking change: [ ] Yes [x] No — the new input defaults to {}, which leaves the runner command unchanged.

Testing & Validation

  • Tests pass: terraform test, 12 passed (new: empty default, rendering and base64 encoding, rejecting a malformed key, rejecting a flag the module sets). I added a container test in main.test.ts, but it could not run here because the runner has no Docker daemon.
  • Code formatted (bun fmt)
  • Changes tested locally: rendered the start script with terraform console and ran it against a stub claude. Its argv received --verbose, --name followed by two words $HOME \id` 'q' "d"unchanged, and-tfollowed byx y. The default {}` produces the same command as before.

Related Issues

None

🤖 Generated with Claude Code

https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt

Add an additional_args map of flag to value, appended to
`claude self-hosted-runner` after the flags the module sets. Each flag
is passed exactly as written (--long or -s, the admin's choice),
followed by its value as the next argument; an empty value passes the
flag alone. Values reach the CLI verbatim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt
@matifali
matifali requested a review from dluman October 22, 2026 14:52
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Module Scorecard Check

coder/agent-relay-claude-code: 52 → 59

✅ Score improvement: 52 → 59 (+7).

Theme Before After
Presentation & Onboarding 6 / 17 12 / 17
Integration 0 / 25 0 / 25
Credential Hygiene 20 / 20 20 / 20
Restricted-Environment 12 / 20 12 / 20
Engineering Quality 10 / 10 10 / 10
Overall 52 / 100 59 / 100
Full scorecard for this PR
Presentation & Onboarding Agent Integration Credential Hygiene Restricted-Environment Readiness Engineering Quality Overall
12 / 17 0 / 25 20 / 20 12 / 20 10 / 10 59 / 100
Drilldown

Presentation & Onboarding — 12 / 17

Criterion Max Score Notes
Configuration-mode examples 12 12 README documents the two major modes: install_cli = true (default, downloads CLI) shown in the primary example, and install_cli = false (baked image) documented in the Requirements section. additional_args has a dedicated example block. cli_binary override is documented. All variables carry sensible defaults.
Visual preview 5 0 No image, GIF, or video embedded in the README. The frontmatter icon field points to a Claude SVG, which is an icon, not a visual preview of the module in action.

Agent Integration — 0 / 25

Criterion Max Score Notes
AI governance 10 0 No mention of Coder AI Gateway or Agent Firewall anywhere in the README or source. The credential is a work-order JWT stamped by Agent Relay, but there is no documented integration with AI Gateway routing or Agent Firewall policy enforcement.
Dashboard entry point 5 0 No coder_app resource is declared and the README does not document a dashboard entry point. The module is a headless runner dispatched by Agent Relay.
Session continuity 5 0 No documentation of resuming an existing agent session across reconnects or relaunches. No mention of session-ID-based resume, boo, tmux, screen, or any persistent session manager. The agent_relay_session_id parameter is for Agent Relay deduplication, not user-facing session continuity.
Managed configuration 5 0 No documented support for managed MCP servers, settings files, policies, or workdir configuration. base_dir sets the checkout directory and additional_args passes CLI flags, but neither constitutes managed configuration in the rubric sense.

Credential Hygiene — 20 / 20

Criterion Max Score Notes
Secrets marked sensitive 16 16 agent_relay_credential is styled with mask_input = true in its coder_parameter block. The README states "the credential is masked." No inline secrets or placeholder keys appear in any README example.
Non-hardcoded auth path 4 4 The README documents that Agent Relay stamps a single-use work-order JWT on each build; the user never pastes a raw key. The credential flows through coder_env → SELF_HOSTED_RUNNER_ENVIRONMENT_SECRET, entirely managed by the relay.

Restricted-Environment Readiness — 12 / 20

Criterion Max Score Notes
Mirrorable artifact source 5 0 The install URL https://claude.ai/install.sh is hardcoded in install.sh.tftpl. No module input variable overrides this URL. cli_binary overrides the binary path, not the download source; install_cli is a boolean toggle. No variable can point the installer at an internal mirror.
Bring-your-own binary 10 10 install_cli (default true) can be set to false to skip the download entirely. The README explicitly documents: "Bake the CLI into the image and set this to false for faster workspaces." The install script checks command -v and short-circuits when the binary is already present.
Egress transparency 3 0 No dedicated README section enumerates external endpoints contacted at install or runtime. The install script contacts claude.ai / downloads.claude.ai and the runner contacts Anthropic's API, but these are only visible in source code, not in a documented network/air-gapped section.
Runs without sudo 2 2 No script invokes sudo. The install step writes to ~/.local/bin; the start step creates directories under $HOME. All operations work as an unprivileged user.

Engineering Quality — 10 / 10

Criterion Max Score Notes
Input quality 6 6 All nine variables carry clear descriptions and sensible defaults. cli_binary has a regex validation restricting it to a command name/path. exit_if_unused_min validates whole-number ≥ 0. additional_args has two validations: flag-format regex and reserved-flag rejection.
Test coverage 4 4 main.tftest.hcl covers the parameter contract (names, ephemeral flags, styling/masking), runner wiring, install-CLI behavior, additional-args encoding, and path overrides. main.test.ts runs the actual install and start scripts in a container with stub binaries, exercising the full supervisor lifecycle (idle, working, serving, done, failed, orphaned), the permissions wrapper, IS_SANDBOX enforcement, and shell-injection safety of serving_log_pattern.

Overall — 59 / 100

Raw 54 / 92 → round(54 / 92 × 100) = 59

Tip

You can run this locally by telling your agent: "review this module against .github/scorecard/SCORECARD.md".


Scored against SCORECARD.md with solstice-1. Language-model scores are advisory.

…sets

additional_args may not set --capacity, --base-dir,
--exit-if-unused-min or --exec-path. Comments on both sides keep the
list in sync with the runner command. Also replaces the README example
flag with a placeholder, since --verbose is not a documented
self-hosted-runner flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2TMgCPW8SL8kUCB28L4dt

@dluman dluman left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will enable semantic, reasonable approach to accessing additional environment settings to customize module behavior for org. workflows. ✅

Looks reasonable to me providing (map)string

@matifali matifali added the version:minor Add to PRs requiring a minor version upgrade label Oct 22, 2026
@matifali
matifali enabled auto-merge (squash) October 22, 2026 15:11
@matifali
matifali disabled auto-merge October 22, 2026 15:15
@matifali
matifali merged commit fc34e6d into main Oct 22, 2026
5 checks passed
@matifali
matifali deleted the claude/code-server-extra-args-nque0n branch October 22, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version:minor Add to PRs requiring a minor version upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants