Skip to content

docs: explain how to restrict Claude Code sessions on Agent Relay - #32519

Open
matifali wants to merge 5 commits into
mainfrom
docs/agent-relay-self-hosted-only
Open

matifali wants to merge 5 commits into
mainfrom
docs/agent-relay-self-hosted-only

Conversation

@matifali

Copy link
Copy Markdown
Contributor

Adds a "Keep sessions on self-hosted environments" section to the Agent Relay for Claude Code page. Admins ask how to force every Claude Code session onto a self-hosted environment, and the answer depends on the surface:

  • Cloud sessions: an Owner can hide Anthropic-hosted environments.
  • Claude Desktop: disableDesktopLocalSessions turns off local sessions, and an empty sshHostAllowlist turns off SSH sessions.
  • CLI: no equivalent setting.

Sources: Deploy self-hosted environments to production, Desktop: Turn off local sessions, Desktop: Restrict which SSH hosts users can connect to, disableDesktopLocalSessions reference.

@matifali matifali changed the title docs: explain how to keep Claude Code sessions on self-hosted environments docs: explain how to keep Claude Code sessions on Agent Relay Nov 20, 2026
@matifali matifali changed the title docs: explain how to keep Claude Code sessions on Agent Relay docs: explain how to restrict Claude Code sessions on Agent Relay Nov 20, 2026

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this answers a question admins keep asking. I checked every claim against Anthropic's current docs: the Owner setting that hides Anthropic-hosted environments, the disableDesktopLocalSessions behavior and version, and sshHostAllowlist turning SSH off when empty and being read only from managed settings. All of them are accurate, and the three code.claude.com anchors resolve.

I'm leaving this as a comment instead of an approval because two gaps undercut the section's goal of keeping every session on a self-hosted environment:

  1. Missing surfaces. The IDE extensions and Remote Control both run Claude Code on the developer's own computer, and none of the listed settings covers them. See the inline comment on the CLI bullet.
  2. Settings that silently don't apply. Desktop reads these keys from only the highest-ranked managed source, so an admin who puts this JSON in the wrong source gets no effect and no warning. See the inline comment on the JSON block.

There's also a smaller accuracy fix for the picker description. None of this needs a restructure; the suggestions are drop-in.


This review was generated by Coder Agents on behalf of @nickvigilante.

Comment thread docs/agent-relay/claude-code.md Outdated
- **Claude Desktop SSH sessions:** Turning off local sessions leaves SSH sessions available.
Set `sshHostAllowlist` to an empty array in managed settings to turn them off too.
Claude Desktop reads this setting from managed settings only.
- **Claude Code CLI:** The CLI ignores both settings, so developers can still run Claude Code on their own computers.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The IDE extensions have the same gap as the CLI. Anthropic's sshHostAllowlist reference says that only the Desktop app reads the key, and that the CLI and IDE extensions don't.

Remote Control is a second route that none of these settings covers. It lets a developer drive a session on their own computer from claude.ai, the mobile apps, or Desktop, and hiding Anthropic-hosted environments doesn't affect it. On Team and Enterprise plans, it's off until an Owner turns it on, and disableRemoteControl turns it off per device (Remote Control requirements).

Suggested change
- **Claude Code CLI:** The CLI ignores both settings, so developers can still run Claude Code on their own computers.
- **Claude Code CLI and IDE extensions:** Neither reads these settings, so developers can still run Claude Code on their own computers.
- **Remote Control:** Remote Control lets a developer drive a session on their own computer from claude.ai, the Claude mobile apps, or Claude Desktop.
On Team and Enterprise plans, Remote Control stays off until an Owner turns it on in [Claude Code admin settings](https://claude.ai/admin-settings/claude-code).
To turn it off on a device, set `disableRemoteControl` to `true` in managed settings.

{
"disableDesktopLocalSessions": true,
"sshHostAllowlist": []
}

@nickvigilante nickvigilante Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Admins can deploy this JSON and see no effect. By default, Desktop reads disableDesktopLocalSessions and sshHostAllowlist from only the highest-ranked managed source. An organization that uses server-managed settings and puts these keys in a local managed-settings.json or MDM profile gets them silently ignored. Anthropic's Restrict which SSH hosts section warns about this explicitly.

Separately, with managedSourcesBehavior: "merge", an empty sshHostAllowlist in one source doesn't turn off SSH for hosts that another source lists (reference).

Suggested change
}
```
Deliver these keys from the highest-ranked managed source on each device, such as server-managed settings if your organization uses them.
By default, Claude Desktop reads the keys from that source only and ignores them in lower-ranked sources without a warning.
If you set `managedSourcesBehavior` to `"merge"`, an empty `sshHostAllowlist` in one source doesn't turn off SSH for hosts that another source allows.
Refer to [How Claude Code combines managed sources](https://code.claude.com/docs/en/managed-settings#how-claude-code-combines-managed-sources).

Comment thread docs/agent-relay/claude-code.md Outdated
Comment on lines +310 to +311
Quit and reopen Claude Desktop to apply the settings.
The environment picker then shows the developer's computer and the SSH section as turned off by the organization.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two accuracy tweaks:

  • Per Anthropic's Local sessions on managed devices, the entry for the developer's computer is grayed out with the tooltip Disabled by your organization. I couldn't find a source for an SSH section shown as turned off by the organization. Describing only the documented state is safer.
  • The quit-and-reopen step comes from server-managed settings, which Desktop fetches at launch and doesn't cache. Scoping it that way keeps it accurate for MDM and file delivery. A blanket restart is harmless, so this part is optional.
Suggested change
Quit and reopen Claude Desktop to apply the settings.
The environment picker then shows the developer's computer and the SSH section as turned off by the organization.
If you deliver the settings as server-managed settings, have developers quit and reopen Claude Desktop, which fetches them at launch.
The entry for the developer's computer in the environment picker then appears grayed out with the tooltip **Disabled by your organization**.

Copy link
Copy Markdown
Contributor Author

@nickvigilante can you take this to completion and merge? Thanks This should also get back-ported to 2.39 release docs.

@BobbyHo

BobbyHo commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

/coder-agents-review Please limit the review to P0, P1, and P2 issues only.

@coder-agents-review

coder-agents-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-11-23 20:00 UTC by @BobbyHo
Spend: $6.67 / $100.00

Review history
  • R1 (2026-11-23): 8 reviewers, 7 P2, COMMENT. Review

deep-review v0.13.0 | Round 1 | 61aec9b..7daf0d5

Last posted: Round 1, 7 findings (7 P2), COMMENT. Review

Finding inventory

Finding inventory: PR #32519

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P2 Open docs/agent-relay/claude-code.md:296 sshHostAllowlist Claude Desktop version floor (v2.26454.0) missing R1 Netero Yes
CRF-2 Note Note (body) docs/agent-relay/claude-code.md:287 check-docs CI failure is a runner loss, not a broken link R1 Netero No
CRF-3 P2 Open docs/agent-relay/claude-code.md:313 Server-managed delivery without an on-device copy leaves Desktop unrestricted until the fetch succeeds R1 Mafuuu, Pen Botter, Kite Yes
CRF-4 P2 Open docs/agent-relay/claude-code.md:299 Surface list omits Cowork, which the Desktop keys do not restrict R1 Mafuuu, Kite Yes
CRF-5 P2 Open docs/agent-relay/claude-code.md:290 Surface list omits Code Review and Claude Security, which always run on Anthropic infrastructure R1 Leorio Yes
CRF-6 P2 Open docs/agent-relay/claude-code.md:292 Hiding Anthropic-hosted environments is scoped to the picker; scheduled tasks and Claude Tag sessions use saved or scoped environments R1 Pariston Yes
CRF-7 P2 Open docs/agent-relay/claude-code.md:297 Empty sshHostAllowlist also blocks Claude Desktop connections to Coder workspaces, with no allowlist alternative given R1 Pariston Yes
CRF-8 P2 Open docs/agent-relay/claude-code.md:313 Section restates Anthropic settings rules that content guidelines say to link instead R1 Pariston Yes
CRF-9 P3 Dropped by orchestrator (downgraded to P3; below the requested P0 to P2 scope) docs/agent-relay/claude-code.md:299 "Neither reads these settings" does not name the settings R1 Gon No

Contested and acknowledged

Round log

Round 1

Netero first pass: 1 P2, 1 Note; no P0, panel proceeded. Law not run (effective additions 36). Full panel, round 1, focused docs-only diff: Pariston, Mafuuu (core), Pen Botter (documentation trigger), Razor (documentation trigger), Gon and Leorio (once-per-PR floor), Mafu-san (agent-style PR text), Kite (random wildcard from distilled set). Requester limited the review to P0 to P2. Cross-check: verified CRF-1, CRF-3, CRF-4, CRF-5 against fetched code.claude.com markdown (settings-reference, desktop.md lines 1949, 2007 to 2010, 2019, self-hosted-environments.md line 46, code-review.md line 90). CRF-6 and CRF-7 rest on reasoning from Anthropic wording plus Coder's claude-desktop.md; mechanism unverified and marked so in the posted comments. CRF-9 downgrade: keep-argument was that an admin could read the CLI bullet as "managed settings do nothing for the CLI" and skip disableRemoteControl; dropped because the next bullet names disableRemoteControl as a per-device setting and Remote Control is off by default on Team and Enterprise. CRF-8 interacts with CRF-1 and CRF-3: linking each key's reference entry fixes both. 7 P2 posted. Reviewed against 61aec9b..7daf0d5.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR adds a section to the Agent Relay for Claude Code page on keeping Claude Code sessions on self-hosted environments. The review is limited to P0 to P2 as requested and has 7 P2 findings. The finding that the section restates Anthropic's settings rules (line 313) is an alternative to adding the missing version floor and on-device copy details; choose one of the two routes.

Notes:

  • docs/agent-relay/claude-code.md:287: the failed check-docs job's annotation reads "The hosted runner lost communication with the server." Every link in the new section resolves, so re-running the job should clear it.

🤖 This review was automatically generated with Coder Agents.

Self-hosted environments are then the only choices in the environment picker.
- **Claude Desktop local sessions:** Set `disableDesktopLocalSessions` to `true` in managed settings to turn off Code sessions on the developer's computer.
This requires Claude Desktop v1.37937.0 or later.
- **Claude Desktop SSH sessions:** Turning off local sessions leaves SSH sessions available.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [CRF-1] The section gives the Claude Desktop version that disableDesktopLocalSessions needs but not the version that sshHostAllowlist needs. (Netero)

Anthropic's settings reference says sshHostAllowlist requires Claude Desktop v2.26454.0 or later, while line 295 gives only v1.37937.0. A device between those versions applies the local-session block, ignores the empty allowlist, and keeps SSH sessions. Add "This requires Claude Desktop v2.26454.0 or later." to this bullet.

🤖

}
```

Deliver these keys from the highest-ranked managed source on each device, such as server-managed settings if your organization uses them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [CRF-3] Delivering the keys only as server-managed settings leaves Claude Desktop unrestricted until its launch-time fetch succeeds. (Mafuuu, Pen Botter, Kite)

Anthropic's Turn off local sessions and distribute SSH connections says: "If you deliver server-managed settings, also keep a copy of the three keys in the highest-ranked MDM policy or managed settings file on each computer." Desktop keeps no cached copy, so a developer who opens Desktop offline or with the fetch blocked gets local and SSH sessions back. Add a sentence that server-managed delivery also needs the same keys in the highest-ranked MDM policy or managed settings file on each device.

🤖

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

+1 on this one. Since Desktop doesn't cache server-managed settings, a sentence like this after "Deliver these keys from…" might cover it:

If you deliver the keys as server-managed settings, also put them in the highest-ranked MDM policy or managed settings file on each device. Claude Desktop doesn't cache server-managed settings, so the device's copy applies until Desktop fetches them.

- **Claude Desktop SSH sessions:** Turning off local sessions leaves SSH sessions available.
Set `sshHostAllowlist` to an empty array in managed settings to turn them off too.
Claude Desktop reads this setting from managed settings only.
- **Claude Code CLI and IDE extensions:** Neither reads these settings, so developers can still run Claude Code on their own computers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [CRF-4] The surface list leaves out Cowork, which runs Claude Code on the developer's computer and is not restricted by either Desktop key. (Mafuuu, Kite)

The Desktop section this page links lists what the keys leave alone as "the CLI, Cowork, and cloud sessions", and says "none of the keys applies to Cowork sessions or Cowork scheduled tasks". An admin who deploys the JSON block believes local work in Claude Desktop is blocked, while Cowork in the same app still runs on the developer's computer. Add a Cowork bullet next to this one.

🤖

## Keep sessions on self-hosted environments

Agent Relay only serves sessions that a developer sends to a self-hosted environment.
Anthropic offers settings that keep sessions on self-hosted environments, but none of them covers every Claude Code surface:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [CRF-5] The surface list leaves out Code Review and Claude Security, whose sessions always run on Anthropic infrastructure. (Leorio)

Anthropic's self-hosted environments overview says "Claude Security and Code Review sessions don't route to them yet", and the Code Review page says reviews "don't run in self-hosted environments". None of the listed controls changes this, so an Owner who turns Code Review on has sessions outside self-hosted environments after following every bullet. Add a bullet saying these two surfaces stay on Anthropic infrastructure and are kept off only by leaving them turned off.

🤖

Agent Relay only serves sessions that a developer sends to a self-hosted environment.
Anthropic offers settings that keep sessions on self-hosted environments, but none of them covers every Claude Code surface:

- **Cloud sessions:** An Owner can hide Anthropic-hosted environments for the whole organization on the [Cloud environments](https://claude.ai/admin-settings/cloud-environments) admin page.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [CRF-6] Hiding Anthropic-hosted environments may not move cloud sessions that skip the environment picker, such as cloud scheduled tasks and Claude Tag channel sessions. (Pariston)

Anthropic scopes the setting to the picker ("To make self-hosted environments the only picker option"), while a scheduled task keeps the environment saved on the task and a Tag channel session uses the environment set on its nearest scope or the organization default. Anthropic does not document whether hiding changes those saved or scoped environments; hiding them and running an existing scheduled task that uses an Anthropic-hosted environment settles it. Until then, tell Owners to make a self-hosted environment the organization default and to check the environment on existing scheduled tasks and Tag channels.

🤖

- **Claude Desktop local sessions:** Set `disableDesktopLocalSessions` to `true` in managed settings to turn off Code sessions on the developer's computer.
This requires Claude Desktop v1.37937.0 or later.
- **Claude Desktop SSH sessions:** Turning off local sessions leaves SSH sessions available.
Set `sshHostAllowlist` to an empty array in managed settings to turn them off too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [CRF-7] An empty sshHostAllowlist may also block Claude Desktop's connections to Coder workspaces, which Coder documents as supported, and the page offers no alternative. (Pariston)

docs/workspaces/workspace-access/claude-desktop.md says "Claude Desktop can list your running Coder workspaces, so you can connect to them from the app", and those sessions run on the deployment's own infrastructure. Anthropic's docs do not describe that integration; connecting to a workspace from Desktop with the allowlist set to [] shows whether the key governs it. If it does, add that admins who want to keep workspace connections can list their workspace hostnames instead of an empty array, and link the Claude Desktop page.

🤖

}
```

Deliver these keys from the highest-ranked managed source on each device, such as server-managed settings if your organization uses them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [CRF-8] Lines 294 to 319 restate Anthropic's settings rules, which docs/.style/content-guidelines.md says to link instead. (Pariston)

The guidelines exclude "Duplicated third-party documentation" because "Ours would immediately start drifting from them." This section already differs from Anthropic's pages: it copies one version floor but not the sshHostAllowlist floor, and it omits the on-device copy requirement for server-managed delivery. As an alternative to adding those details, keep line 289 and one line per surface that names the control and the gap, and link each key to its Anthropic reference entry instead of restating version floors, source ranking, merge rules, and tooltip text.

🤖

nickvigilante added a commit that referenced this pull request Nov 24, 2026
Updates the Agent Relay docs for general availability and for
agent-relay v0.17.0, and adds the version requirements table from
RELAY-61.

- **Beta to GA:** the sidebar state goes from `[premium, beta]` to
`[premium]`, and every page drops its beta callout.
The monitoring and SIEM notes now say metric names, log messages, and
fields can change between releases, and tell readers to review alerts
when they upgrade.
Anthropic's own "public beta" line for self-hosted environments stays,
because Anthropic's docs still say public beta.
- **Version requirements:** `setup.md` gets one table of minimum
versions for Coder, Agent Relay, the Terraform provider, both modules,
and the Claude Code CLI.
The "v0.16.0 or later" qualifiers across the pages are removed, because
the table sets a single GA baseline.
Module examples move to 1.0.1, the latest tag. Its only change from
1.0.0 is in the README.
- **v0.17.0, Claude Code poll loop**
([agent-relay#189](coder/agent-relay#189)):
after it handles a session, a pool claims the next one right away and
waits 5 seconds only after an empty or failed poll.
The "one session every 5 seconds" claim and the provisioner sizing
formula that depended on it are replaced in `claude-code.md`.
`siem.md` lists the renamed `backoff` log field, which replaces
`interval`.
- **v0.17.0, redelivery**
([agent-relay#165](coder/agent-relay#165)): if
Anthropic redelivers a session while its previous workspace still has a
start build or a delete in progress, Agent Relay fails the session
instead of building again.
This is covered in the build budget, setup failure, and reap delay text,
plus a new troubleshooting entry.
- **`install_cli`:** the docs no longer say `install_cli = true` removes
the Claude Code CLI minimum.
The modules skip the install when a CLI is already on `PATH` and never
upgrade it.

## Open questions

- **GA versions (Steven Masley, per RELAY-61):** the table uses the
latest versions as of today: Coder 2.39, Agent Relay v0.17.0, Terraform
provider v2.20.0, and modules 1.0.0.
If GA ships with newer releases, the table, the early access upgrade
steps, and the `claude-code.md`/`cursor.md` module notes need the new
numbers.
- **Stability at GA:** should the monitoring and SIEM pages promise
anything about metric and log stability, or does "can change between
releases" stay?
- **Backport:** the v0.16.0 docs were backported to `release/2.39`
(#32122). This PR probably needs the same once the GA versions are
settled.

Related: #32519 adds a section to `claude-code.md` in a different part
of the page. It shouldn't conflict.

<details>
<summary>Verification notes and decision log</summary>

Verified against agent-relay `v0.16.0...v0.17.0`:

- `serviceclaudecoderunners/poller.go` `pollLoop`: `drain` polls again
right after each handled hint (`maxHintsPerPoll = 1`).
`pollIntervalDefault` (5s) is the startup delay and the backoff after
`ErrEmptyPoll`, a retryable poll error, or a license lapse. The relay
sets no limit on concurrent builds (README, Claude Code pools).
- `workspacedispatcher/dispatcher.go` `reconcile`: with
`TerminalOnUnfinishedBuild` (set to `redelivered(hint.Attempt)` in
`serviceclaudecoderunners/dispatch.go`), `blocksRedelivery` (START or
DELETE pending, starting, or canceling, or deleting) sends the
non-retryable nack `agent-relay: the previous workspace was not ready
for this session; send a new message to retry` and logs `redelivery
found a predecessor build or delete in progress, failing current work
order`. `retirePredecessorLocked` runs only for a START that isn't
deleting. It cancels the build through `settleBuild`, then deletes the
workspace. A running delete is left alone.
- A new message is a first delivery, and `AwaitDeleting: true` makes it
wait for the delete and then build fresh.
- `poller.go`: the `poll loop started` record's field is now `backoff`.
No other code emits `interval`.
- No CLI flags, environment variables, Helm values, or metric names
changed between v0.16.0 and v0.17.0.
- Registry `agent-relay-{claude-code,cursor}` v1.0.1 `main.tf`
`install_cli`: "A CLI already in the image is used as is and never
upgraded."

Decisions:

- The table states one GA baseline instead of a matrix with one row per
relay release. RELAY-61 narrowed the scope to "latest versions as of
GA", and the relay doesn't check module pairing at runtime, so older
rows couldn't be verified.
- The Claude Code CLI minimum of 2.1.224 is kept. Neither the relay nor
the module checks it, so it's left as stated policy.
- Not documented: the example image bumps (#156, #181, #183), the
mock-clock refactor (#166), and the test-only PRs, because users see no
change.

Checks: `make lint/emdash`, `make lint/docs-manifest`, `make
lint/docs-html`, markdownlint, and Vale (no new alerts compared with
`main`).
A `doc-check` self-check found 3 blocking accuracy findings: the
`install_cli` wording twice, and the redelivery cleanup wording. All 3
are fixed.

</details>

Refs DOCS-1797, RELAY-61

> Generated by Coder Agents on behalf of @nickvigilante.
@linear-code

linear-code Bot commented Nov 25, 2026

Copy link
Copy Markdown

AIGOV-833

This branch was previously deployed

1 inactive (outdated) deployment
main — 2fcdbea4 Deployed Nov 20, 2026 by matifali via cla #261281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants