Visitar URL original
Support remote mode in `service list` by jdc123 · Pull Request #283 · gofixpoint/amika · GitHub
Skip to content

Support remote mode in service list - #283

Merged
jdc123 merged 4 commits into
mainfrom
fix-service-list-remote
Jul 14, 2026
Merged

jdc123 merged 4 commits into
mainfrom
fix-service-list-remote

Conversation

@jdc123

@jdc123 jdc123 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Problem

amika service list --sandbox-name <name> returned "No services found." for a running remote sandbox that had a frontend service provisioned (found during the 2026-07-11 release test against staging, dylan/release-test).

Root cause: service list read only the local sandbox state file and never queried the remote API. Remote sandbox creation never writes local state, so the local store is empty for remote sandboxes → the command always reported no services.

Secondary symptom: sandbox list -l showed - for the PORTS column of remote sandboxes, because the API client (apiclient.RemoteSandbox) never parsed the services field the server already returns.

Fix

  • apiclient: parse the sandbox services array (name, url, hostPort, containerPort, protocol) the API already returns — the client was silently dropping it.
  • service list: made remote-first (matching sandbox list). Resolves the run mode, gates on auth, and in remote mode fetches each sandbox's provisioned services (with URLs) from the API. Added --local / --remote / --remote-target flags; --local preserves the previous local-store behavior.
  • sandbox list -l: populates the remote PORTS column from the sandbox's services instead of -. Remote services have no host IP (they are reached via generated URLs), so port bindings omit the misleading 127.0.0.1: prefix.

Behavior change

service list now defaults to remote (consistent with sandbox list). Local listing is available via service list --local.

Testing

  • make fmtcheck, make vet, make lint clean; unit tests pass.
  • Added tests: API JSON-contract parse (ListSandboxes services), service-row grouping, port formatting, remote auth gate, and local service list behavior.
  • Smoke-tested the built binary: local list shows services + URLs, --sandbox-name filters, missing sandbox → "No services found.", and default (remote) without credentials fails with not logged in; run "amika auth login" or use --local.

Note: the live staging round-trip was not exercisable in the dev environment (no staging credentials), but the remote path is covered by the contract-parse and pure-function tests.

Jakub Cichon added 4 commits July 13, 2026 19:02
`service list` read only the local sandbox state file, so it always
printed "No services found." for remote sandboxes — remote sandbox
creation never writes local state. Make the command remote-first
(matching `sandbox list`): resolve the run mode, gate on auth, and in
remote mode fetch each sandbox's provisioned services (with URLs) from
the API. `--local` preserves the previous local-store behavior.

Parse the `services` field the API already returns on each sandbox
(previously dropped by the client) so the data is available to both
`service list` and `sandbox list`. Populate the remote `sandbox list -l`
PORTS column from it instead of showing "-". Remote services have no
host IP (they are reached via generated URLs), so port bindings omit
the host prefix rather than print a misleading localhost.
Address review feedback on the remote `service list` change:

- Validate `--remote-target` up front, unconditionally, matching the
  sandbox command. Previously it was only checked in remote mode after
  the auth gate, so `service list --local --remote-target x` silently
  ignored the flag instead of rejecting it.
- Render remote service ports as `hostPort->containerPort/protocol`,
  matching how `sandbox list -l` renders the same binding, instead of
  collapsing equal ports to a single number. Keeps the PORTS column
  format consistent across the two commands.
The remote API-client constructor and the credential checker were
duplicated across packages: `sandboxcmd.getRemoteClient` /
`sandboxcmd.defaultAuthChecker` and the `service` command's
`newRemoteClient` / `remoteAuthChecker` (plus `getSecretsClient`) were
all copies of the same two snippets.

Add `runmode.NewRemoteClient` and `runmode.DefaultAuthChecker` as the
single source of truth and route every caller through them. The env-var
branch stays in `DefaultAuthChecker` so it remains a complete standalone
credential check (it's covered by a dedicated test), even though
`RequireAuth` also short-circuits on `AMIKA_API_KEY`.

No behavior change: `getRemoteClient` never returned an error and
ignored its `target` (validated separately by `getRemoteTarget`), so
call sites drop the dead error handling. Moves the auth-checker tests to
the runmode package alongside the code.
The previous commit over-reached: consolidating the client constructor
also deleted the `getRemoteClient` seam and stopped threading `target`
from `getRemoteTarget`. That plumbing is deliberate scaffolding for the
not-yet-implemented named-remote feature and shouldn't have been removed
(functionally a no-op today, but a regression in intent).

Restore `getRemoteClient(target)` and the `target` threading at every
sandbox call site. `getRemoteClient` now delegates its body to the
shared `runmode.NewRemoteClient`, so there is still a single constructor
implementation and the seam/target are preserved. The only remaining
change to the sandbox commands is the auth-checker rename to
`runmode.DefaultAuthChecker`.
@jdc123

jdc123 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: f40b8a274c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jdc123
jdc123 merged commit 82e7ad0 into main Jul 14, 2026
1 check passed
@jdc123
jdc123 deleted the fix-service-list-remote branch July 14, 2026 21:32
jdc123 added a commit that referenced this pull request Jul 17, 2026
Release `amika@v0.12.0` by bumping `DEFAULT_VERSION` in `install.sh`
from `0.11.2` to `0.12.0`.

## Changes since amika@v0.11.2

**Sandbox & CLI:**
- Add top-level `amika scp` command for SSH file copy (#278)
- Add `amika snapshot create/list/delete` commands (#282)
- Add `--snapshot` flag to `amika sandbox create` (#285)
- Support remote mode in `service list` (#283)
- Add (then hide) the `--github-auth-mode` flag on `sandbox create`
(#270, #273)
- Show command aliases in `amika` CLI help output (#263)

**Sandbox images & VM snapshots:**
- Install amika and amikalog CLIs in sandbox images (#280)
- Auto-install amikalog hooks in sandbox images (#281)
- Bump L/XL sandbox disk to 24 GB / 32 GB (#279)
- Match VM snapshot sizes to container sizes; add XL (#272)
- Version linux-vm snapshots by git short hash (#276)
- Don't publish the xs VM snapshot for coder-dind (#275)
- Publish Daytona linux-vm snapshots and restore setuid on VM boot
(#271)
- Drop user@host line from sandbox shell prompt (#269)
- Clear stale dockerd pidfile before starting daemon (#268)

**TypeScript SDK:**
- Release TypeScript SDK v0.10.0 with sandbox snapshot support (#287,
#284)
- Add `*.functional.test.ts` convention and prod guard (#286)
- Document AgentCredentialRef resolution rules (#267)

**Docs & internal:**
- Keep README local-first and add Amika Cloud section (#260)
- Fix stale API route paths in CLI client comments (#264)
dbmikus pushed a commit that referenced this pull request Oct 23, 2026
Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 5.0.0 to 6.1.0.

## Release notes

Sourced from pnpm/action-setup's releases.

### v6.1.0

### What's Changed
- feat: support pnpm v12 by `@zkochan` in pnpm/action-setup#288

Full Changelog: pnpm/action-setup@v6.0.10...v6.1.0

### v6.0.10

### What's Changed
- docs(README): point users to the successor pnpm/setup action by `@BlackHole1` in pnpm/action-setup#282
- refactor: introduce restore keys for cache by `@SukkaW` in pnpm/action-setup#280
- ci: use pnpm 11 for `pr-check` by `@jamietanna` in pnpm/action-setup#284
- fix: update pnpm to v11.19.0 by `@jamietanna` in pnpm/action-setup#283
- docs: update README to include devEngines.packageManager by `@nemchik` in pnpm/action-setup#273

### New Contributors
- `@jamietanna` made their first contribution in pnpm/action-setup#284
- `@nemchik` made their first contribution in pnpm/action-setup#273

Full Changelog: pnpm/action-setup@v6...v6.0.10

### v6.0.9

### What's Changed
- fix: update pnpm to v11.7.0 by `@zkochan` in pnpm/action-setup#267

Full Changelog: pnpm/action-setup@v6...v6.0.9

### v6.0.8

### What's Changed
- docs(README): fix `cache_dependency_path` type by `@haines` in pnpm/action-setup#257
- fix: drop patchPnpmEnv so standalone+self-update works on Windows by `@zkochan` in pnpm/action-setup#258
- fix: update pnpm to 11.1.1 by `@mungodewar` in pnpm/action-setup#248

### New Contributors
- `@mungodewar` made their first contribution in pnpm/action-setup#248

Full Changelog: pnpm/action-setup@v6.0.7...v6.0.8

### v6.0.7

### What's Changed
- fix: honor devEngines.packageManager.onFail=error (#252) by `@zkochan` in pnpm/action-setup#254
- fix: restore inputs from state in post by `@haines` in pnpm/action-setup#255
- fix: self-update bootstrap to packageManager-pinned version (#233) by `@zkochan` in pnpm/action-setup#256

### New Contributors
- `@haines` made their first contribution in pnpm/action-setup#255

Full Changelog: pnpm/action-setup@v6.0.6...v6.0.7

... (truncated)

## Commits
- `ea17c68` feat: support pnpm v12 (#288)
- `0977fd9` docs: Update README to include devEngines.packageManager (#273)
- `48261ac` fix: update pnpm to v11.19.0 (#283)
- `75677f7` ci: use pnpm 11 for `pr-check` (#284)
- `769ae71` refactor: introduce restore keys for cache (#280)
- `6fed91f` docs(README): point users to the successor pnpm/setup action (#282)
- `0ebf471` fix: update pnpm to v11.7.0 (#267)
- `0e279bb` fix: update pnpm to 11.1.1 (#248)
- `3e83581` fix: drop patchPnpmEnv so standalone+self-update works on Windows (#258)
- `551b42e` docs(README): fix `cache_dependency_path` type (#257)
- Additional commits viewable in compare view
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