Skip to content

fix(ca,sandbox): idle-sleep copy, retire --base-image-digest - #1369

Merged
codyde merged 5 commits into
masterfrom
fix/ca-idle-sleep-copy-and-template-digest
Nov 17, 2026
Merged

codyde merged 5 commits into
masterfrom
fix/ca-idle-sleep-copy-and-template-digest

Conversation

@codyde

@codyde codyde commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Updates Cloud Agent help and messages for idle sleep, and retires --base-image-digest, which the API stopped accepting in August.

Changes

  • Help for ca, ca start, ca ssh, ca desktop, code, the ca create message and docs/cloud-agents.md say an idle agent sleeps after 5 minutes, that sleeping ends its processes, and that connecting wakes it.
  • Disconnect and session-ended notes (ca ssh, code, TUI) say the agent sleeps after 5 minutes with no SSH client, network traffic or agent turn, which ends its processes. For agents created before 2026-10-08 00:37 UTC they keep the old "still running until railway ca sleep" note (ca::sleeps_when_idle, a created_at heuristic, unit tested).
  • ca desktop: rerun advice is scoped to OpenCode (agents created since Oct 8 restart its server on wake; rerun railway ca desktop --opencode if it can't connect). Claude and Codex just reconnect. The wake note no longer uses a warning icon.
  • --keep-awake stays a hidden no-op, and bare railway ca --keep-awake now opens the TUI like railway ca instead of the launcher.
  • sandbox template build --base-image-digest is hidden and stops with "Base images are no longer configurable; templates build on the default sandbox image."
  • sandbox create --template refuses a stored template built on a custom base image and says to rebuild it. Before, it failed at the API with "Sandbox checkpoint not found". The legacy field stays in the local config and is never sent.
  • baseImageDigest is removed from the CLI's copy of SandboxTemplateInput in schema.json (one-field edit; the rest of the file is unchanged).
  • access.rs comment: the CLOUD_AGENTS flag is enforced by the CLI and dashboard, not on create by the API.

Verification

  • Idle conditions: monorepo controllers/cloudAgent/idleSleep.ts (no active SSH, no outbound network, no busy workload) and vm-init controller/idle_sleep.go (under 8 KiB sent per poll; busy marker covers a running or waiting agent turn).
  • 5-minute timeout: CLOUD_AGENT_IDLE_SLEEP_SECONDS in controllers/cloudAgent/create.ts, from #41923.
  • baseImageDigest removal: backboard #36421 (Aug 25); "Sandbox checkpoint not found" comes from controllers/sandboxes/create.ts.
  • Production: agents created after the Oct 8 deploy sleep on their own; agents without idle sleep in their spec never did.
  • Config: a test parses a whole RailwayConfig that contains the legacy baseImageDigest, so a parse failure (which regenerates the config and drops the token) would be caught.
  • cargo fmt, build, test (1949 unit passed, 6 ignored; integration 6, 5, 10, 5, 4 passed), clippy: no new warnings against origin/master.

The railway ca sleep wake bug and the OpenCode/Codex setup "port occupied" bug are fixed in #1370.

🤖 Generated with Claude Code

codyde and others added 2 commits November 17, 2026 08:17
Since backboard #41923 (2026-10-07), new cloud agents power off after 5
minutes with no SSH session, outbound traffic or agent turn, and wake on
SSH, HTTP or API. Since #39843 the SSH relay wakes a sleeping agent on
any SSH connection. Help, the create and disconnect messages, and the
cloud-agents guide still said agents have no idle timeout and that a
desktop app can't wake one.

- Help for `ca`, `ca start`, `ca ssh`, `ca desktop` and `code`, the create
  message, and the disconnect/session-ended notes now describe idle sleep.
- The desktop setup note says connecting over SSH wakes the agent, and to
  run `railway ca wake` and retry if the app times out.
- The hidden `--keep-awake` help says it is ignored and doesn't prevent
  idle sleep.
- The guide notes agents created before 2026-10-07 don't sleep on their own.
- The access.rs comment now says the CLOUD_AGENTS flag is enforced by the
  CLI and dashboard, not the API.

Wording only; no lifecycle behavior changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…epts

Backboard #36421 removed baseImageDigest from SandboxTemplateInput, so
`railway sandbox template build --base-image-digest` fails, and so does
`railway sandbox create --template` for a stored template that recorded
a digest. The server pins the default base image itself.

- Drop the flag and the field from the CLI's copy of SandboxTemplateInput
  in schema.json (a one-field edit; the rest of the file is byte-identical).
- Drop baseImageDigest from StoredSandboxTemplate. Existing records that
  carry it still parse (serde ignores the unknown field) and lose it on
  the next config write; a test covers this.
- Drop baseImageDigest from `sandbox template list --json`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codyde codyde added the release/patch Author patch release label Nov 17, 2026
codyde and others added 3 commits November 17, 2026 09:04
…unch

`--keep-awake` is a hidden no-op kept for old scripts, but `is_bare()`
still read it, so `railway ca --keep-awake` skipped the TUI and opened
the launcher. A flag that does nothing should not change what runs, so
`is_bare()` now ignores it. That is less surprising than documenting the
side effect: the flag stays fully inert, `railway ca --keep-awake`
behaves exactly like `railway ca`, and `railway code --keep-awake` (which
never reads `is_bare()`) is unchanged.

- Its hidden help now says it is ignored and has no effect on sleep.
- The controllers/cloud_agent.rs module comment no longer says
  `--keep-awake` declines to sleep.
- A test pins that `--keep-awake` alone is still a bare invocation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to the idle-sleep copy. "Powers off" becomes "sleeps", which
matches task.rs, agent.rs and railwayapp/docs#1454, and the text says
plainly that sleeping ends processes.

- Disconnect and session-ended notes (`ca ssh`, `code`, the TUI) no
  longer say "still running and powers off after 5 idle minutes", which
  invited leaving a job running. They now say the agent sleeps after 5
  minutes with no SSH client, network traffic or agent turn, which ends
  its processes.
- Agents created before the idle-sleep deploy (monorepo #41923,
  2026-10-08 00:37 UTC) keep a spec without idle sleep, so for those the
  notes keep the previous text: still running until `railway ca sleep`.
  `ca::sleeps_when_idle` compares `created_at` to that cutoff; it is a
  heuristic and says so. The TUI agent now carries `created_at` for this.
- `ca desktop`: help and the guide scope the rerun advice to OpenCode
  (agents created since Oct 8 restart its server on wake; rerun
  `railway ca desktop --opencode` if it can't connect). OpenCode's
  completion line mentions idle sleep. The wake note drops the yellow
  `!`, and the final line no longer says "stops the compute bill" for
  agents that sleep on their own.
- docs/cloud-agents.md: what counts as idle (no SSH client attached,
  almost no network traffic, no coding agent working or waiting), and the
  cutoff date corrected from Oct 7 to Oct 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…egacy templates

Follow-up to removing `--base-image-digest`.

- The flag is back, hidden, and stops with "Base images are no longer
  configurable; templates build on the default sandbox image." This
  matches how retired flags are handled elsewhere (`--keep-awake`, #1351,
  #854) instead of failing with clap's "unexpected argument".
- `StoredSandboxTemplate.base_image_digest` is back as a legacy optional
  field: read and written so old records round-trip, never sent to the
  API. `sandbox template list --json` reports it again.
- A stored template that has one used to fail at the API with "Sandbox
  checkpoint not found" (without the digest, its recipe names a
  checkpoint that was never built). `sandbox create --template` now
  stops first and says to rebuild it with `railway sandbox template
  build`.
- The serde test now parses a whole `RailwayConfig` containing the
  legacy field, since a config parse failure regenerates the file and
  drops the user's token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codyde codyde changed the title fix(ca,sandbox): idle-sleep copy, drop --base-image-digest, fix flag comment fix(ca,sandbox): idle-sleep copy, retire --base-image-digest Nov 17, 2026
@codyde
codyde marked this pull request as ready for review November 17, 2026 17:05
@codyde codyde added release/skip Author no release and removed release/patch Author patch release labels Nov 17, 2026
@codyde
codyde merged commit bce9b21 into master Nov 17, 2026
10 checks passed
@codyde
codyde deleted the fix/ca-idle-sleep-copy-and-template-digest branch November 17, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/skip Author no release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant