PR #9638 review: cloud --effort and --tag

PR #9638 · Review workspace · author Andrew Bastin · reviewed at 768d0a65

Summary

For cloud workspaces, --tag was refused by the CLI and cloudWorkspace.create had no tags input, and --effort was dropped when the first agent opens as an ACP chat. The PR adds an optional tags input to cloudWorkspace.create (passed to startCloudWorkspace, which already stores them), lets the CLI send --tag for cloud, and threads effort through host-service's chat launch (createChatSessionSchema → effortId), removing the old "effort ⇒ no chat" refusal in chatLaunchTarget.

Verdict

Minor issues. The approach is correct and small, each new test fails on the base and passes on the head; the only real gap is the CLI reference still saying --tag is rejected for cloud.

Findings

  1. Stale docs: apps/docs/content/docs/cli/cli-reference.mdx:835 still lists --tag among the flags "rejected for a cloud workspace". After this PR that is false. Fix: drop --tag from that list (and optionally say tags file the cloud workspace into a sidebar folder).
  2. Effort is not validated on the chat path (low, design note): packages/host-service/src/trpc/router/agents/agents.ts:665 validates model and mode but not effort, so sessions.create / a cloud first boot with --effort bogus silently runs at the agent default, while the terminal path (validateAgentEffortSelection, agents.ts:206) throws. The PR calls this out as intentional for the cloud first boot. Fix (optional): validate in sessions.create only when the caller is interactive, or at least log the skipped effort so a user can find out why it did not apply.
  3. Test couples to startCloudWorkspace internals (nit): packages/trpc/src/router/cloud-workspace/cloud-workspace.test.ts:93-98 stubs environmentRepositoryRows, primaryRepository, recordWorkspaceRepositories, workspaceBranchName and a generic db.insert. Any refactor of start.ts will break these tests without a behaviour change. Acceptable for now; consider a test that calls startCloudWorkspace's tag step directly if this grows.

Checked and fine: the returned tags: input.tags ?? [] (cloud-workspace.ts:525) is already normalized because workspaceTagsInputSchema transforms (trim, lowercase, dedupe, sort). The claim "no released client sends chat + effort to a local host" holds: desktop strips it (useSubmitWorkspace.ts:294), mobile sends effort only on the terminal branch (useCreateTerminalWorkspace.ts:152), automations send no effort (automation/hostSession.ts:82). tRPC compat: cloudWorkspace.create gains an optional input (safe); host-service sessions.create is .strict(), so a future client sending effort must gate on host version.

Evidence

Surfaces: CLI (ws create for cloud), API (cloudWorkspace.create), host-service (sessions/agents chat launch). There is no UI change. Evidence is the PR's own tests run at base and head source, plus typecheck/lint.

New tests against base source (a82221c5), with the PR's test files: each targeted test fails as expected.

# PR tests run against BASE source (a82221c5011d5f04d77504d21b067c6d165cc662)
bunfig.toml
drizzle.config.ts
tsconfig.types.json
(fail) continuationTarget > launches a chat only when asked for one with an ACP harness [27.86ms]
ZodError: [
(fail) sessions router > starts the agent at the reasoning effort the caller asked for [24.46ms]
 81 pass
 2 fail
bunfig.toml
(fail) cloudWorkspace.create > files the new workspace under the caller's tags [13.40ms]
 5 pass
 1 fail
bunfig.toml
cli.config.ts
CLIError: --tag does not apply to a cloud workspace
(fail) sends --tag to the cloud [0.48ms]
 8 pass
 1 fail

Same tests at head 768d0a65: all pass.

# PR tests at HEAD 768d0a65
 83 pass
 0 fail
Ran 83 tests across 2 files. [3.56s]
 6 pass
 0 fail
Ran 6 tests across 1 file. [3.15s]
 9 pass
 0 fail
Ran 9 tests across 1 file. [114.00ms]

Not run: an end-to-end superset ws create --agent claude --effort high --tag test against a real cloud workspace. This review run may not create workspaces, and the effort part needs the next sandbox production-release anyway. The sandbox-self-seed.ts one-line change has no direct test (as the PR states).

Questions for the author

Test / CI notes