Skip to content

feat(coder/agent-relay-cursor): add additional_args - #1199

Merged
matifali merged 3 commits into
mainfrom
claude/agent-relay-cursor-additional-args
Oct 22, 2026
Merged

matifali merged 3 commits into
mainfrom
claude/agent-relay-cursor-additional-args

Conversation

@matifali

Copy link
Copy Markdown
Member

Description

Adds an additional_args input to agent-relay-cursor for passing extra flags to the Cursor CLI's agent worker. This matches coder/registry#1198 for agent-relay-claude-code.

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 the start subcommand.

module "cursor_worker" {
  source   = "registry.coder.com/coder/agent-relay-cursor/coder"
  version  = "0.6.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: --pool, --idle-release-timeout, --auth-token-file, --auth-token (the token is kept off the command line on purpose), --computer-use, --share-desktop. A comment in main.tf and in start.sh.tftpl says to keep this list in sync with the worker command.

Type of Change

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

Module Information

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

Testing & Validation

  • Tests pass: terraform test, 16 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); ./scripts/terraform_validate.sh passes
  • Changes tested locally: rendered the start script with terraform console and ran it against a stub agent. Its argv was worker --pool p --idle-release-timeout 600 --auth-token-file … --name <two words $HOME \id` 'q' "d"> --verbose -t start`, with each value arriving unchanged.

Related Issues

None


Generated by Claude Code

matifali and others added 3 commits October 22, 2026 14:53
Add an additional_args map of flag to value, appended to
`cursor-agent worker` after the flags the module sets and before the
`start` subcommand. 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
additional_args may not set --pool, --idle-release-timeout,
--auth-token-file, --auth-token, --computer-use or --share-desktop.
Comments on both sides keep the list in sync with the worker command.

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

Copy link
Copy Markdown
Contributor

Module Scorecard Check

coder/agent-relay-cursor: 58 → 58

✅ Score unchanged at 58 / 100. This PR does not affect the module's scorecard; the results are still good.

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

Presentation & Onboarding — 6 / 17

Criterion Max Score Notes
Configuration-mode examples 12 6 The main example shows the default (install_cli = true) and the additional_args section shows a second full module block. However, computer_use = true and share_desktop = true are only described in the "Requirements" section without a dedicated module example block. No structured "modes" section exists; the major desktop/computer-use configurations lack standalone examples with sensible defaults.
Visual preview 5 0 No image, GIF, or video is embedded in the README. The frontmatter icon field points to a registry icon SVG, which does not count as a visual preview of the module in action.

Agent Integration — 5 / 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 auth path (Agent Relay session tokens) is documented, but there is no documentation of Coder governing routing, policy enforcement, or firewall rules for the agent.
Dashboard entry point 5 5 Two coder_app resources (cursor_web, cursor_desktop) are created conditionally when agent_relay_session_id is set. The README explicitly documents both: "Open in Cursor Web opens the cloud agent at https://cursor.com/agents/<id>" and "Open in Cursor Desktop opens it with cursor://anysphere.cursor-deeplink/background-agent?bcId=<id>."
Session continuity 5 0 The README does not document resuming an existing agent session across reconnects or relaunches. The --idle-release-timeout keeps the worker alive between turns, but no session-resume mechanism (native resume, session ID reuse, tmux/screen/boo) is documented.
Managed configuration 5 0 No documentation of managed MCP servers, settings files, policies, or workdir configuration. additional_args allows passing arbitrary CLI flags but does not constitute managed configuration in the rubric's sense.

Credential Hygiene — 20 / 20

Criterion Max Score Notes
Secrets marked sensitive 16 16 agent_relay_credential is declared ephemeral = true with mask_input = true in styling. The token is written to a file with umask 077 (mode 0600), passed via --auth-token-file (never on the command line), unset from the supervisor's environment, and deleted on worker exit. README examples contain no inline secrets or placeholder keys.
Non-hardcoded auth path 4 4 The README's "Worker credential" section documents that "The pool's service-account API key never leaves Agent Relay." The credential is minted per-claim by Cursor, stamped as an ephemeral parameter by Agent Relay, and the user never pastes a raw key into the template.

Restricted-Environment Readiness — 12 / 20

Criterion Max Score Notes
Mirrorable artifact source 5 0 The install URL https://cursor.com/install is hardcoded in install.sh.tftpl. No module input variable overrides this download URL. cli_binary overrides the binary path, and install_cli toggles the download, but neither replaces the download URL. No variable can point the installer to an internal mirror.
Bring-your-own binary 10 10 install_cli = false is documented in the README ("Bake the CLI into the image and set this to false for faster workspaces") and in the variable description. The install script short-circuits when the binary is on PATH; the start script unconditionally adds ~/.local/bin to PATH to find a baked-in CLI. Fully documented and tested.
Egress transparency 3 0 No dedicated README section enumerates external endpoints. The install URL (cursor.com/install), the worker's API connections, and the app URLs (cursor.com/agents/, cursor://) are mentioned in passing within their respective feature sections, but there is no "Network Requirements," "Egress," or "Air-gapped" section.
Runs without sudo 2 2 All scripts (install.sh.tftpl, start.sh.tftpl, status.sh.tftpl) operate exclusively under $HOME and use `curl

Engineering Quality — 10 / 10

Criterion Max Score Notes
Input quality 6 6 All 9 variables have clear descriptions, sensible defaults, and type constraints. cli_binary has a regex validation rejecting shell metacharacters. share_desktop validates that computer_use is true. serving_log_pattern rejects empty strings. additional_args has two validations: flag-name format and reserved-flag exclusion.
Test coverage 4 4 main.tftest.hcl (14 test runs) covers the parameter contract, script rendering, flag wiring, and validation failures. main.test.ts (15+ test cases) runs the actual install/start scripts in a container with a stub agent binary, exercising the full supervisor lifecycle (idle, working, serving, orphaned, done, failed), credential file handling, shell-injection resistance, and restart semantics.

Overall — 58 / 100

Raw 53 / 92 → round(53 / 92 × 100) = 58

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.

@matifali
matifali requested a review from dluman October 22, 2026 15:08

@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.

Same as #1198 for Cursor implementation; adding (map) string allows for much more dynamic module use. ✅

@matifali matifali added the version:minor Add to PRs requiring a minor version upgrade label Oct 22, 2026
@matifali
matifali merged commit 42faf5f into main Oct 22, 2026
6 checks passed
@matifali
matifali deleted the claude/agent-relay-cursor-additional-args branch October 22, 2026 15:10
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