Skip to content

feat(coder/agent-relay-cursor): serve management endpoints and report session attachment - #1211

Merged
Emyrk merged 5 commits into
mainfrom
steven/agent-relay-cursor-session-attached
Oct 27, 2026
Merged

Emyrk merged 5 commits into
mainfrom
steven/agent-relay-cursor-session-attached

Conversation

@Emyrk

@Emyrk Emyrk commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Refs RELAY-56.

Serves the worker's management endpoints by default and adds a metadata script that reports whether the worker is running and holds a session.

  • New management_addr variable, default 127.0.0.1:3287, passed as --management-addr; empty disables the server.
  • New session_attached_metadata_script output reads the cursor_self_hosted_worker_session_active gauge from /metrics and prints one state from the table below.
  • New management_url output gives a URL reachable from inside the workspace; wildcard binds map to loopback.
  • --management-addr joins the reserved additional_args flags.
agent_relay_session_attached worker running session held when
attached yes yes cursor_self_hosted_worker_session_active > 0
unattached yes no gauge is 0: waiting for its claimed session, or released and still alive
stopped no no state is done, failed, idle, pending, or missing, or the recorded pid is dead or no longer the CLI
disabled not checked not checked management_addr = ""
error (non-zero exit) yes unknown /metrics unreachable or has no session gauge

Running means the supervisor recorded working <pid>, kill -0 <pid> succeeds, and /proc/<pid>/cmdline still names the CLI. The supervisor replaces that line with done <code> when the worker exits, including the normal idle release.

Agent context
  • Behavior change: workers now listen on loopback 127.0.0.1:3287 by default. Set management_addr = "" to opt out.
  • agent_relay_status stays separate: it reports worker lifecycle for reaping, while this key reports live attachment for keep-alive.
  • management_addr is validated as host:port (hostname, IPv4, or bracketed IPv6; port 1 to 65535) because it is rendered into the supervisor.
  • Open question: Cursor documents the gauge as 1 while a session is running and 0 when idle. It is unverified whether the idle-release window after a turn reads 1 or 0. If it reads 0, keep-alive lapses during the user's reading and typing time.
  • Companion to agent-relay#117, which should renew autostop only on a fresh attached sample.
  • Verified: terraform test 24/24, bun test 25/25, shellcheck clean on the rendered script. The gauge shape comes from Cursor's pool docs. The management server only starts after the worker authenticates, so it was not observed live.

Coder Agents on behalf of @Emyrk.

@linear-code

linear-code Bot commented Oct 26, 2026

Copy link
Copy Markdown

RELAY-56

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Module Scorecard Check

coder/agent-relay-cursor: 58 → 51

⚠️ Score regression: 58 → 51 (-7). Check the drilldown for which criteria dropped.

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

Presentation & Onboarding — 6 / 17

Criterion Max Score Notes
Configuration-mode examples 12 6 README shows examples for install_cli = true, additional_args, and management_addr. No example for computer_use / share_desktop modes, which are documented only in prose under Requirements.
Visual preview 5 0 No image, GIF, or video embedded in the README.

Credential Hygiene — 12 / 20

Criterion Max Score Notes
Secrets marked sensitive 16 8 README examples avoid inline secrets)Skip. The agent_relay_credential parameter is ephemeral = true and mask_input = true, but it is not marked sensitive = true.
Non-hardcoded auth path 4 4 README documents that the pool's service-account API key never leaves Agent Relay; Cursor mints a session token stamped as an ephemeral parameter)Skip. No raw keys are pasted into templates.

Restricted-Environment Readiness — 13.5 / 20

Criterion Max Score Notes
Mirrorable artifact source 5 0 The install path hardcodes curl https://cursor.com/install -fsSL | bash in install.sh.tftpl. No module input variable overrides the download URL. install_cli is a boolean skip toggle, not a URL override.
Bring-your-own binary 10 10 install_cli = false is documented and implemented; cli_binary overrides the binary path. The install step is a no-op when the CLI is already on PATH.
Egress transparency 3 1.5 No dedicated network/offline/air-gapped README section. Endpoints like cursor.com/install, cursor.com/agents, and the cursor:// deeplink appear only in scattered examples and variable descriptions.
Runs without sudo 2 2 install.sh.tftpl, start.sh.tftpl, status.sh.tftpl, and session_attached.sh.tftpl never invoke sudo; all paths use $HOME and unprivileged operations.

Engineering Quality — 10 / 10

Criterion Max Score Notes
Input quality 6 6 All variables have clear descriptions and sensible defaults. Validations cover cli_binary, share_desktop, management_addr, serving_log_pattern, and additional_args.
Test coverage 4 4 main.tftest.hcl covers the parameter contract, worker wiring, and script rendering. main.test.ts exercises the supervisor lifecycle, token handling, and metadata scripts in containers.

Agent Integration — 5 / 25

Criterion Max Score Notes
AI governance 10 0 No documentation of Coder AI Gateway or Agent Firewall. Agent Relay is mentioned, but it is not the same as either governance product.
Dashboard entry point 5 5 coder_app resources cursor_web and cursor_desktop are built in and documented in the README.
Session continuity 5 0 No documented resume/session ID support or persistent session manager (boo, tmux, screen). The worker lifecycle is documented, but not session continuation across reconnects or relaunches.
Managed configuration 5 0 No managed MCP, settings, policies, or workdir config. agent_relay_cursor_repo_url is a parameter, but the README says the template must clone it; the module does not manage it.

Overall — 51 / 100

Raw 46.5 / 92 → round(46.5 / 92 × 100) = 51

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.

@Emyrk
Emyrk marked this pull request as ready for review October 27, 2026 13:27
@Emyrk
Emyrk requested a review from matifali October 27, 2026 13:28
@Emyrk
Emyrk enabled auto-merge (squash) October 27, 2026 14:38
@Emyrk
Emyrk merged commit fc328c8 into main Oct 27, 2026
5 checks passed
@Emyrk
Emyrk deleted the steven/agent-relay-cursor-session-attached branch October 27, 2026 14:48
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.

2 participants