Skip to content

fix: close-workspace error names accepted formats; verify #133 env routing - #147

Merged
arzafran merged 1 commit into
mainfrom
fix/134-close-workspace-error-format
Jul 20, 2026
Merged

fix: close-workspace error names accepted formats; verify #133 env routing#147
arzafran merged 1 commit into
mainfrom
fix/134-close-workspace-error-format

Conversation

@arzafran

Copy link
Copy Markdown
Member

What this does

Closes out the last two Phase 1 CLI P0s. An agent (or a fat-fingered script) running programa close-workspace with no target now gets a clear error telling it exactly what to pass, instead of a terse one-liner. And #133 turned out to be already shipped: every affected command already resolves against PROGRAMA_WORKSPACE_ID, so background agents don't touch the workspace you're looking at — this PR adds the missing verification and closes the paperwork.

Closes #133. Closes #134.

Summary

  • close-workspace / select-workspace without --workspace now fail (still non-zero, still before the socket opens) with: --workspace <id|ref> is required (UUID or short ref like workspace:2). Refusing to target the current workspace implicitly. The require-explicit-target behavior already existed at both the CLI pre-flight and server layers; only the message was generic.
  • P0: CLI commands resolve via PROGRAMA_WORKSPACE_ID, not focused workspace #133 verified already implemented on main, both by code inspection (all 13 commands read PROGRAMA_WORKSPACE_ID CLI-side and pass explicit workspace_id; the server only falls back to the focused workspace when no id is supplied) and live against a tagged build (new-split with the env var set targeted a background workspace while selection stayed put). Existing coverage: tests_v2/test_workspace_relative.py.
  • New regression test: bare close-workspace exits non-zero, names the accepted formats, closes nothing.
  • Test-harness hardening: test_workspace_relative.py's CLI runner now strips the instance-scoped PROGRAMA_*_ID env vars that shell integration exports inside a Programa terminal. Inherited PROGRAMA_SURFACE_ID from the outer instance was overriding the workspace target and breaking the send test when the suite ran from inside Programa.
  • TODO.md P0 lines for P0: CLI commands resolve via PROGRAMA_WORKSPACE_ID, not focused workspace #133/P0: close-workspace requires an explicit workspace ID #134 ticked.

Out of scope, noted for the record: the Go remote CLI (programad-remote) does not read PROGRAMA_WORKSPACE_ID; and a foreign surface UUID in PROGRAMA_SURFACE_ID resolves to "Surface is not a terminal" rather than not_found (filed separately).

Test Plan

  • tests_v2/test_workspace_relative.py fully green (8/8, including the new test) against a tagged debug build
  • Live CLI verification of env-var routing and the no-arg rejection against a tagged build
  • CI green

close-workspace and select-workspace with no --workspace now fail with an
error that names the expected formats (UUID or short ref like workspace:2)
and states that implicit current-workspace targeting is refused. The
require-an-explicit-target behavior itself already existed at both the CLI
pre-flight and server layers; only the message was generic.

Also:
- regression test: bare close-workspace exits non-zero, names the formats,
  and closes nothing (tests_v2/test_workspace_relative.py)
- the same test file's CLI runner is now hermetic: it strips the
  instance-scoped PROGRAMA_*_ID vars inherited when running inside a
  Programa terminal, which otherwise point commands at the wrong app
  instance (PROGRAMA_SURFACE_ID broke the send test)
- TODO.md: tick #133 and #134. #133 was verified already implemented on
  main (all 13 commands read PROGRAMA_WORKSPACE_ID CLI-side and pass an
  explicit workspace_id; covered by this same test file)
@arzafran
arzafran merged commit 98b08b2 into main Jul 20, 2026
9 of 13 checks passed
@arzafran
arzafran deleted the fix/134-close-workspace-error-format branch July 20, 2026 17:43
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.

P0: close-workspace requires an explicit workspace ID P0: CLI commands resolve via PROGRAMA_WORKSPACE_ID, not focused workspace

1 participant