Skip to content

feat(agent-relay-cursor): add the Agent Relay Cursor module - #1112

Open
Emyrk wants to merge 5 commits into
mainfrom
sm/agent-relay-cursor
Open

feat(agent-relay-cursor): add the Agent Relay Cursor module#1112
Emyrk wants to merge 5 commits into
mainfrom
sm/agent-relay-cursor

Conversation

@Emyrk

@Emyrk Emyrk commented Sep 11, 2026

Copy link
Copy Markdown
Member

Description

Adds coder/agent-relay-cursor, the template module for Agent Relay Cursor pools. It declares the agent_relay_* parameter contract the relay stamps on every build and verifies at startup, exports the Cursor CLI's CURSOR_API_KEY / CURSOR_AGENT_WORKER_ID, and runs agent worker ... start detached, publishing the worker lifecycle through an agent_relay_status agent metadata item that the template must declare on its coder_agent.

Moved from coder/agent-relay, where it was developed and tested against the daemon; that copy is retired in favor of this one.

  • Every relay parameter renders disabled with a "Set by Agent Relay on dispatch" placeholder; the credential is masked.
  • install_cli defaults to true and only downloads when the CLI is not already on PATH.
  • main.tftest.hcl covers the parameter contract and the rendered scripts. No main.test.ts yet; the scripts are exercised end to end by the relay's dogfood deployment.

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.1.0
Breaking change: [ ] Yes [x] No

Testing & Validation

  • Tests pass (terraform test, 7 runs)
  • Code formatted (bun fmt)
  • Changes tested locally (readmevalidation, terraform validate)

Related Issues

None


Opened by Coder Agents on behalf of @Emyrk.

Template module that declares the parameter contract Agent Relay stamps
on a build and runs the Cursor CLI worker detached, publishing its
lifecycle through the agent_relay_status agent metadata item. Moved from
coder/agent-relay, where it was developed against the daemon.
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Module Scorecard Check

coder/agent-relay-cursor: first scorecard, 70 / 100

No existing scorecard discussion found for Agent Relay Cursor; this is the initial score. A dedicated discussion is created after merge.

Full scorecard for this PR
Presentation & Onboarding Agent Integration Credential Hygiene Restricted-Environment Readiness Engineering Quality Overall
6 / 17 20 / 25 18 / 20 10 / 20 10 / 10 70 / 100
Drilldown

Agent Integration — 20 / 25

Criterion Max Score Notes
AI governance 10 10 README documents Agent Relay integration (which provides routing and policy enforcement) and credential management through service-account API keys. The module is explicitly designed for Agent Relay's governance model.
Dashboard entry point 5 0 No coder_app support documented or present in the module. This is a worker module that runs the Cursor CLI in the background.
Session continuity 5 5 README documents the --idle-release-timeout mechanism where workers persist after a session ends to handle follow-up requests. The worker continues across reconnects within the timeout window.
Managed configuration 5 5 README documents managed configuration through Agent Relay parameters: agent_relay_cursor_pool_name, agent_relay_cursor_idle_release_timeout, agent_relay_cursor_repo_url, and computer_use variable for managed worker settings.

Credential Hygiene — 18 / 20

Criterion Max Score Notes
Secrets marked sensitive 16 16 The agent_relay_credential parameter has mask_input = true in its styling (main.tf line 177). README examples avoid inline secrets, showing only placeholder text "Set by Agent Relay on dispatch". README section "Credential exposure" explicitly discusses the credential lifecycle.
Non-hardcoded auth path 4 2 The credential is provided through Agent Relay's parameter stamping mechanism (service-account API key), but this still involves pasting keys into the relay configuration. Not a fully external auth path like IAM/OAuth. Earns half for the indirection through Agent Relay rather than direct template exposure.

Presentation & Onboarding — 6 / 17

Criterion Max Score Notes
Configuration-mode examples 12 6 README shows one basic example with install_cli toggle. Documents computer_use = true mode and repo-scoped vs repo-less pools in Requirements section. Missing comprehensive examples for major configuration variations (e.g., custom binary paths, state file locations). Earns half.
Visual preview 5 0 No image, GIF, or video in README. Only an icon reference in frontmatter.

Restricted-Environment Readiness — 10 / 20

Criterion Max Score Notes
Mirrorable artifact source 5 0 The installer uses hardcoded `curl https://cursor.com/install -fsSL
Bring-your-own binary 10 10 README Requirements section states "bake it into the image for the fastest start" and documents that install_cli = false disables download when the CLI is already present. The cli_binary variable allows pointing to a pre-installed binary. Fully documented and implemented.
Egress transparency 3 0 No dedicated README section enumerating external endpoints. The cursor.com/install URL appears only in code comments and scattered mentions. Requirements mention "outbound access to cursor.com" but this is not a dedicated network/endpoints section.
Runs without sudo 2 0 The installer script uses `curl ...

Engineering Quality — 10 / 10

Criterion Max Score Notes
Input quality 6 6 All variables have clear descriptions. Sensible defaults: install_cli = true, cli_binary = "agent", state_file and log_file with reasonable paths, computer_use = false. The agent_id is properly typed as required. No validation blocks needed for these inputs.
Test coverage 4 4 Comprehensive .tftest.hcl covers parameter contract, worker wiring, computer_use modes, install_cli modes, and path overrides (7 test runs). TypeScript main.test.ts covers end-to-end behavior with container-based integration tests: idle state, missing binary, CLI presence detection, worker lifecycle, exit codes, and configuration overrides. Clear separation of concerns.

Overall — 70 / 100

Raw 64 / 92 → round(64 / 92 × 100) = 70

Tip

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


Scored against SCORECARD.md with claude-sonnet-4-5. Language-model scores are advisory.

@Emyrk
Emyrk marked this pull request as ready for review September 11, 2026 13:14
Stacked on #1112. Adds `main.test.ts` for `coder/agent-relay-cursor`.

Each case renders the module with `runTerraformApply`, runs the
`coder_script` body in a `lorello/alpine-bash` container, and reads back
`/tmp/agent-relay/worker-state`. A stub `agent` script stands in for the
Cursor CLI so the supervisor lifecycle is observed, not grepped for:

| case | asserts |
|---|---|
| no `CURSOR_API_KEY` | exit 0, `idle` |
| no CLI, `install_cli = false` | exit 1, `failed runner-agent-missing`
|
| CLI on PATH, `install_cli` default | "already present; skipping the
install", no download, `working <pid>` |
| worker start | argv is `worker --pool ... --idle-release-timeout 600
... start`, no `--computer-use`; worker env carries `CURSOR_API_KEY` /
`CURSOR_AGENT_WORKER_ID` |
| `computer_use = true` | `--computer-use` in argv |
| worker exits 3 | `done 3` |
| `cli_binary` + `state_file` overrides | binary at the override path
runs, state lands at the override path |

Plus the standard `testRequiredVariables` for `agent_id`.

Not covered: the real `curl https://cursor.com/install | bash` and the
real worker; both need the network and Cursor's side.

9 pass locally in ~15s. If this merges, the "No `main.test.ts` yet" line
in the #1112 body should be dropped.

---

_Opened by Coder Agents on behalf of @Emyrk._
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