Skip to content

feat(remote): add --no-workspace session creation to remote CLI (D3) - #675

Merged
delete-cloud merged 2 commits into
mainfrom
feat/remote-cli-no-workspace
Jul 7, 2026
Merged

delete-cloud merged 2 commits into
mainfrom
feat/remote-cli-no-workspace

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Jul 7, 2026 •

Copy link
Copy Markdown
Owner

Problem (defect D3 from o6n live dogfood)

remote repl/remote run require --repo or --empty-workspace, and both need server-side cloud_workspace.enabled=true. On servers with cloud workspace disabled (o6n production), the CLI cannot create sessions at all — the only path was raw POST /sessions (the webui request shape).

Change (additive)

  • New --no-workspace flag on remote repl and remote run: sends POST /sessions without a workspace_source field, matching the webui path; never probes cloud-workspace config
  • Mutually exclusive with --repo/--empty-workspace (all 8 flag combinations validated); --runtime/--download combinations rejected before any network call
  • When session creation fails with the server's real cloud-workspace-disabled error, the CLI error suggests --no-workspace (matcher verified against the actual http_server.py error strings; phantom branch removed)
  • create_remote_session payload building reviewed path-by-path: byte-equivalent for every pre-existing path, incl. snapshot + runtime_profile (now pinned by a dedicated regression test)

Verification

  • Full suite: 4063 passed / 8 skipped / 20 xfailed (baseline 4059 + 4 new tests)
  • 2-round code-review-expert loop → 0 P1 / 0 P2 at round 1; all 4 P3 polish items applied and re-verified in round 2
  • Red-first: --no-workspace tests failed with "No such option" before implementation
  • Reviewer independently confirmed the server contract: POST /sessions with only approval_policy short-circuits before the cloud-workspace check (http_server.py:1916-1922)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a --no-workspace option for remote run and REPL commands to start sessions without workspace provisioning.
  • Bug Fixes
    • Improved validation so only one of --repo, --empty-workspace, or --no-workspace can be used at a time.
    • Prevented runtime settings from being used when creating sessions without a workspace.
    • Remote session errors now include clearer guidance when workspace provisioning isn’t supported.
  • Documentation
    • Added usage guidance for when to use --no-workspace.

The remote CLI required --repo or --empty-workspace, both of which need
server-side cloud_workspace.enabled=true. Servers with cloud workspace
disabled (the o6n production config) could only get workspace-less
sessions via raw POST /sessions — the webui path — never via the CLI.

Add --no-workspace to remote repl/run: mutually exclusive with
--repo/--empty-workspace, rejects --runtime/--download combinations
before any network call, and sends POST /sessions without a
workspace_source field, exactly matching the webui request shape without
probing cloud_workspace config. When session creation fails with the
server's cloud-workspace-disabled error, the CLI error now suggests
--no-workspace.

create_remote_session payload building verified path-by-path equivalent
for all pre-existing paths (incl. snapshot + runtime_profile, now pinned
by a dedicated regression test). Error-hint tests parametrized with the
real server error strings.

2-round subagent review to 0 P1/P2; full suite 4063 passed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a --no-workspace option to the remote repl and remote run CLI commands, plumbing it through _remote_run_once and create_remote_session. Adds validation rules, error-message guidance when cloud workspace provisioning is disabled, documentation, and corresponding tests.

Changes

No-workspace remote session support

Layer / File(s) Summary
create_remote_session no_workspace support
coding-agent/src/coding_agent/remote/client.py
Adds no_workspace kw-only parameter, validates it against conflicting workspace options, omits workspace_source and sets workspace_ref_kind to "none" when enabled, and adds _looks_like_cloud_workspace_disabled to append --no-workspace guidance in error messages.
CLI flag wiring and validation
coding-agent/src/coding_agent/cli/remote_commands.py
Adds --no-workspace option to remote repl and remote run, threads the flag through _remote_run_once, replaces two-way --repo/--empty-workspace exclusivity with a three-way exactly-one-of rule, and forbids --runtime with --no-workspace.
Docs and test coverage
coding-agent/docs/remote-sandbox-production.md, coding-agent/tests/cli/test_remote_client.py
Documents when to use --no-workspace and adds/updates tests for payload omission, mutual exclusivity errors, parametrized error-detail assertions, and runtime forwarding with snapshot fallback.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI as remote_commands.py
  participant Client as create_remote_session
  participant Server as Remote Server

  User->>CLI: remote run --no-workspace
  CLI->>CLI: validate exactly one of repo/empty-workspace/no-workspace
  CLI->>Client: create_remote_session(no_workspace=True)
  Client->>Client: validate no conflicting workspace options
  Client->>Server: POST session (workspace_ref_kind="none")
  alt provisioning disabled on server
    Server-->>Client: error detail indicating disabled
    Client-->>CLI: ClickException with --no-workspace guidance
  else success
    Server-->>Client: session created
    Client-->>CLI: session id
  end
  CLI-->>User: result or error message
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding --no-workspace support to remote CLI session creation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remote-cli-no-workspace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
coding-agent/src/coding_agent/remote/client.py (1)

1719-1736: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Fragile coupling: hint gated on exact action string.

action == "create remote session" ties the hint to freeform display text also passed at the sole call site (line 302). Renaming that string later silently drops the --no-workspace guidance with no signal beyond a test failure.

Consider a dedicated flag instead of string matching:

♻️ Suggested refactor
-def _raise_remote_http_error(response: httpx.Response, action: str) -> None:
+def _raise_remote_http_error(
+    response: httpx.Response, action: str, *, suggest_no_workspace: bool = False
+) -> None:
     try:
         _ = response.raise_for_status()
     except httpx.HTTPStatusError as exc:
         detail = _response_error_detail(response)
-        if action == "create remote session" and _looks_like_cloud_workspace_disabled(
-            detail
-        ):
+        if suggest_no_workspace and _looks_like_cloud_workspace_disabled(detail):
             detail = (
                 f"{detail}. Use --no-workspace to create a session without "
                 "server-side workspace provisioning."
             )
         raise click.ClickException(f"Failed to {action}: {detail}") from exc

Separately, _looks_like_cloud_workspace_disabled depends on matching the server's exact error wording, which isn't defined in this file. Worth confirming this matches the actual production error string, not just the test fixtures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/src/coding_agent/remote/client.py` around lines 1719 - 1736, The
`action == "create remote session"` check in the `ClickException` path is
fragile because the `--no-workspace` hint depends on freeform display text;
replace it with an explicit indicator passed through the remote session
error-handling flow from the `create remote session` call site into the
exception formatter. Keep `_looks_like_cloud_workspace_disabled` as the trigger
for the hint, but confirm the matching strings reflect the real server error
wording rather than only fixture text.
coding-agent/src/coding_agent/cli/remote_commands.py (1)

253-290: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing test coverage for new validation branches.

The workspace_mode_count exactly-one-of check and the new --repo/--no-workspace combo are tested, but two new validation branches introduced here aren't covered by any test in the provided diff:

  • no_workspace and runtime_profile is not None (Lines 287-290, "Pass --runtime only when creating a remote workspace.")
  • --empty-workspace + --no-workspace combo hitting workspace_mode_count > 1

Since these are new business rules enforced before any network call, a couple of small parametrized tests would lock in the behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/src/coding_agent/cli/remote_commands.py` around lines 253 - 290,
Add test coverage for the new validation branches in the remote command flow:
the `workspace_mode_count` guard in the CLI entrypoint and the
`no_workspace`/`runtime_profile` check. Update the existing tests around
`remote_commands` (the command that performs the exactly-one-of validation
before network calls) to include parametrized cases for `--empty-workspace` plus
`--no-workspace` raising the exact-one-of `ClickException`, and for
`no_workspace=True` with a non-None `runtime_profile` raising the
runtime-only-with-workspace error. Keep the assertions focused on the command’s
validation behavior and error messages so these rules stay locked in.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@coding-agent/src/coding_agent/cli/remote_commands.py`:
- Around line 253-290: Add test coverage for the new validation branches in the
remote command flow: the `workspace_mode_count` guard in the CLI entrypoint and
the `no_workspace`/`runtime_profile` check. Update the existing tests around
`remote_commands` (the command that performs the exactly-one-of validation
before network calls) to include parametrized cases for `--empty-workspace` plus
`--no-workspace` raising the exact-one-of `ClickException`, and for
`no_workspace=True` with a non-None `runtime_profile` raising the
runtime-only-with-workspace error. Keep the assertions focused on the command’s
validation behavior and error messages so these rules stay locked in.

In `@coding-agent/src/coding_agent/remote/client.py`:
- Around line 1719-1736: The `action == "create remote session"` check in the
`ClickException` path is fragile because the `--no-workspace` hint depends on
freeform display text; replace it with an explicit indicator passed through the
remote session error-handling flow from the `create remote session` call site
into the exception formatter. Keep `_looks_like_cloud_workspace_disabled` as the
trigger for the hint, but confirm the matching strings reflect the real server
error wording rather than only fixture text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e03217aa-9ce3-4622-aac8-8b4ee85a34b0

📥 Commits

Reviewing files that changed from the base of the PR and between 0037e4c and e0366f9.

📒 Files selected for processing (4)
  • coding-agent/docs/remote-sandbox-production.md
  • coding-agent/src/coding_agent/cli/remote_commands.py
  • coding-agent/src/coding_agent/remote/client.py
  • coding-agent/tests/cli/test_remote_client.py

@delete-cloud
delete-cloud merged commit 752793f into main Jul 7, 2026
2 checks passed
@delete-cloud
delete-cloud deleted the feat/remote-cli-no-workspace branch July 7, 2026 03:02
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