Skip to content

doc: add cross-workspace targeting note for send/send-key/read-screen#5004

Open
v2nic wants to merge 1 commit into
manaflow-ai:mainfrom
v2nic:doc/cross-workspace-input-commands
Open

doc: add cross-workspace targeting note for send/send-key/read-screen#5004
v2nic wants to merge 1 commit into
manaflow-ai:mainfrom
v2nic:doc/cross-workspace-input-commands

Conversation

@v2nic
Copy link
Copy Markdown

@v2nic v2nic commented May 29, 2026

Problem

cmux send, send-key, and read-screen default --workspace to $CMUX_WORKSPACE_ID. When targeting a surface outside the caller's workspace, omitting --workspace produces a misleading error:

Error: invalid_params: Surface is not a terminal

The surface is a terminal — cmux just resolved it in the wrong workspace context. This caused an agent script to classify ~40 live, interactive surfaces as "zombie/orphaned terminals" and skip them entirely.

Changes

skills/cmux/references/panes-surfaces.md — Add "Input and Screen Reading" section with examples showing --workspace and a bold note about the cross-workspace requirement and the misleading error message.

skills/cmux-workspace/references/commands.md — Update the "Input" section examples to always include --workspace, matching the pattern used for pane/surface commands throughout the doc. Add the same cross-workspace targeting note.

Test plan

  • Verified that cmux read-screen --surface surface:266 fails with "Surface is not a terminal" when the surface is in a different workspace
  • Verified that cmux read-screen --workspace workspace:46 --surface surface:266 succeeds and returns the terminal contents
  • Confirmed send and send-key behave the same way
  • Skill docs reviewed for consistency with existing --workspace patterns

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


Summary by cubic

Clarified cross-workspace behavior for send, send-key, and read-screen: these commands default --workspace to $CMUX_WORKSPACE_ID, so you must pass --workspace when targeting surfaces in other workspaces to avoid the misleading Error: invalid_params: Surface is not a terminal.

Added a bold cross-workspace note to skills/cmux/references/panes-surfaces.md and skills/cmux-workspace/references/commands.md.

Written for commit 2b98135. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Documentation
    • Clarified cross-workspace targeting behavior for send, send-key, and read-screen commands. The workspace parameter is automatically inferred from the environment for same-workspace operations but must be explicitly provided when targeting surfaces in different workspaces.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@v2nic is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

Documentation updates across two reference files clarify how send, send-key, and read-screen commands resolve the --workspace parameter and when explicit --workspace passing is required for cross-workspace operations.

Changes

Cross-workspace targeting clarification

Layer / File(s) Summary
Cross-workspace parameter documentation
skills/cmux-workspace/references/commands.md, skills/cmux/references/panes-surfaces.md
Notes added explaining that send, send-key, and read-screen infer --workspace from $CMUX_WORKSPACE_ID for same-workspace usage, but require explicit --workspace when targeting surfaces in different workspaces to avoid "invalid_params: Surface is not a terminal" errors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Two docs align in harmony,
Cross-workspace targeting, clear for all to see—
When surfaces drift to distant lands,
--workspace must be in your hands!
A little note prevents the pain,
Where confusing errors once would reign. 🌟

🚥 Pre-merge checks | ✅ 18
✅ Passed checks (18 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding documentation about cross-workspace behavior for three specific commands.
Description check ✅ Passed The description covers problem statement, changes, and test plan. However, it lacks the Testing section format and omits the Review Trigger and Checklist sections from the template.
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.
Cmux Swift Actor Isolation ✅ Passed PR is documentation-only (2 markdown files) with no Swift code changes. Custom check applies only to production Swift changes per the instructions.
Cmux Swift Blocking Runtime ✅ Passed Initial repository import of 750 Swift files; all marked as new additions, not development changes. Blocking patterns are pre-existing infrastructure, not introduced by this PR.
Cmux No Hacky Sleeps ✅ Passed PR contains only documentation updates to two markdown files with no changes to TypeScript, JavaScript, shell, or runtime scripts in scope.
Cmux Algorithmic Complexity ✅ Passed PR contains only documentation changes in two markdown files; no production code modified. Algorithmic complexity rules apply only to production code.
Cmux Swift Concurrency ✅ Passed PR contains only documentation changes to markdown files (.md); no Swift code is modified, so Swift concurrency modernization check does not apply.
Cmux Swift @Concurrent ✅ Passed This PR contains only documentation changes (Markdown files). The custom check for Swift @concurrent annotations is not applicable to documentation-only changes.
Cmux Swift File And Package Boundaries ✅ Passed PR is documentation-only (markdown files); check applies only to production Swift changes. No Swift code changes violate package boundaries.
Cmux Swift Logging ✅ Passed PR contains only documentation changes (markdown files); no Swift code modifications present, so logging check does not apply.
Cmux User-Facing Error Privacy ✅ Passed Changes document error messages in reference documentation files, which are explicitly exempted as "docs" under the user-facing-errors rule's allowed cases.
Cmux Full Internationalization ✅ Passed Documentation-only changes to operational reference files not served via web UI; no code, Swift, string catalog, or web message changes.
Cmux Swiftui State Layout ✅ Passed PR contains only documentation changes (.md files) with no SwiftUI code modifications; check is not applicable to documentation-only changes.
Cmux Architecture Rethink ✅ Passed PR is documentation-only (markdown updates), not a Swift code change. The custom check for Swift architectural issues does not apply to documentation files with no code modifications.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR contains only documentation changes (markdown files) with no Swift code modifications. The check applies only to Swift window/panel code changes, making it inapplicable here.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

These commands default --workspace to $CMUX_WORKSPACE_ID. When targeting
a surface outside the caller's workspace, omitting --workspace produces
the misleading error 'Surface is not a terminal' — the surface exists
and is a terminal, but cmux resolves it in the wrong workspace context.
@v2nic v2nic force-pushed the doc/cross-workspace-input-commands branch from ba5f2c3 to 2b98135 Compare May 30, 2026 00:15
@v2nic v2nic marked this pull request as ready for review May 30, 2026 00:39
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
skills/cmux-workspace/references/commands.md (1)

62-70: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Inconsistency between PR description and implementation.

The PR description states that the "Input" section examples were updated to "always include --workspace," but the examples at lines 62-67 do not include --workspace and show no changes (~ markers). The note at lines 69-70 correctly explains when --workspace is required, but if the intention was to update all examples to demonstrate explicit --workspace usage, that change is missing.

📝 If examples should always include --workspace, apply this change
 ```bash
-cmux send "echo hello\n"
-cmux send-key enter
-cmux send --surface "$CMUX_SURFACE_ID" "git status\n"
-cmux send-key --surface "$CMUX_SURFACE_ID" enter
-cmux read-screen --surface "$CMUX_SURFACE_ID"
+cmux send --workspace "$CMUX_WORKSPACE_ID" "echo hello\n"
+cmux send-key --workspace "$CMUX_WORKSPACE_ID" enter
+cmux send --workspace "$CMUX_WORKSPACE_ID" --surface "$CMUX_SURFACE_ID" "git status\n"
+cmux send-key --workspace "$CMUX_WORKSPACE_ID" --surface "$CMUX_SURFACE_ID" enter
+cmux read-screen --workspace "$CMUX_WORKSPACE_ID" --surface "$CMUX_SURFACE_ID"

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

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

In @skills/cmux-workspace/references/commands.md around lines 62 - 70, Update
the example invocations so they consistently pass an explicit workspace flag:
replace the local examples of cmux send, cmux send-key and cmux read-screen with
versions that include --workspace "$CMUX_WORKSPACE_ID" (and also include
--surface "$CMUX_SURFACE_ID" where applicable) so the examples match the PR
description; edit the examples for the commands send, send-key and read-screen
to always include --workspace and ensure the third/fourth examples also include
--surface to mirror the note about cross-workspace targeting.


</details>

</blockquote></details>
<details>
<summary>skills/cmux/references/panes-surfaces.md (1)</summary><blockquote>

`39-40`: _🧹 Nitpick_ | _🔵 Trivial_ | _💤 Low value_

**Minor wording inconsistency between files.**

This note uses "Cross-workspace input" while `skills/cmux-workspace/references/commands.md` line 69 uses "Cross-workspace targeting." Both are reasonable, but consistent terminology across documentation would be clearer.




<details>
<summary>♻️ Align terminology with commands.md</summary>

```diff
-**Cross-workspace input:** `send`, `send-key`, and `read-screen` resolve `--workspace` from `$CMUX_WORKSPACE_ID`. When targeting a surface outside the caller's workspace, you must pass `--workspace` explicitly. Omitting it produces the misleading `Error: invalid_params: Surface is not a terminal`.
+**Cross-workspace targeting:** `send`, `send-key`, and `read-screen` resolve `--workspace` from `$CMUX_WORKSPACE_ID`. When targeting a surface outside the caller's workspace, you must pass `--workspace` explicitly. Omitting it produces the misleading `Error: invalid_params: Surface is not a terminal`.
🤖 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 `@skills/cmux/references/panes-surfaces.md` around lines 39 - 40, Change the
phrasing in panes-surfaces.md to match the terminology used in commands.md:
replace "Cross-workspace input" with "Cross-workspace targeting" (or vice versa
if you prefer the other term) so both docs use the exact same phrase; update the
note that mentions `send`, `send-key`, `read-screen` and the
`$CMUX_WORKSPACE_ID` behavior to use "Cross-workspace targeting" to mirror the
wording in commands.md.
🤖 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.

Outside diff comments:
In `@skills/cmux-workspace/references/commands.md`:
- Around line 62-70: Update the example invocations so they consistently pass an
explicit workspace flag: replace the local examples of cmux send, cmux send-key
and cmux read-screen with versions that include --workspace "$CMUX_WORKSPACE_ID"
(and also include --surface "$CMUX_SURFACE_ID" where applicable) so the examples
match the PR description; edit the examples for the commands send, send-key and
read-screen to always include --workspace and ensure the third/fourth examples
also include --surface to mirror the note about cross-workspace targeting.

In `@skills/cmux/references/panes-surfaces.md`:
- Around line 39-40: Change the phrasing in panes-surfaces.md to match the
terminology used in commands.md: replace "Cross-workspace input" with
"Cross-workspace targeting" (or vice versa if you prefer the other term) so both
docs use the exact same phrase; update the note that mentions `send`,
`send-key`, `read-screen` and the `$CMUX_WORKSPACE_ID` behavior to use
"Cross-workspace targeting" to mirror the wording in commands.md.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3481a008-9de9-4e99-b375-68ab6c34071c

📥 Commits

Reviewing files that changed from the base of the PR and between 7264d29 and 2b98135.

📒 Files selected for processing (2)
  • skills/cmux-workspace/references/commands.md
  • skills/cmux/references/panes-surfaces.md

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR documents the cross-workspace targeting requirement for send, send-key, and read-screen, fixing a real agent regression where surfaces in other workspaces were misclassified as zombies due to the misleading Surface is not a terminal error.

  • skills/cmux-workspace/references/commands.md: Adds a bold cross-workspace note after the Input section code block; however, the examples themselves were not updated to include --workspace, contrary to what the PR description states.
  • skills/cmux/references/panes-surfaces.md: Appends the same note at the end of the layout-focused doc without an "Input and Screen Reading" section header or any input examples, reducing discoverability.

Confidence Score: 4/5

Documentation-only change; no production code is modified and the added guidance is factually correct.

The note content is accurate and directly addresses the agent regression. The two gaps — missing --workspace in the code examples and missing section header/examples in panes-surfaces.md — are polish issues that leave the docs slightly inconsistent with the stated intent but don't introduce any incorrect information.

Both changed files would benefit from the small follow-up fixes noted in comments, but neither has correctness problems that would block merging.

Important Files Changed

Filename Overview
skills/cmux-workspace/references/commands.md Adds cross-workspace targeting note after Input section; code examples still omit --workspace, inconsistent with the PR description's stated intent and the --workspace pattern used in the Panes section above.
skills/cmux/references/panes-surfaces.md Appends cross-workspace input note at end of a layout-focused doc without a section heading or any input examples; note is functionally correct but may be hard to discover.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Agent calls send/send-key/read-screen] --> B{--workspace provided?}
    B -- No --> C[Resolves workspace from $CMUX_WORKSPACE_ID]
    B -- Yes --> D[Uses provided workspace]
    C --> E{Surface in same workspace?}
    E -- Yes --> F[✅ Command succeeds]
    E -- No --> G[❌ Error: invalid_params: Surface is not a terminal]
    D --> F
Loading

Comments Outside Diff (1)

  1. skills/cmux-workspace/references/commands.md, line 62-66 (link)

    P2 The Input section examples show send and send-key without --workspace, but the cross-workspace note directly below advises always passing it for out-of-workspace surfaces. The PR description states examples were updated to always include --workspace matching the pane/surface pattern above — but that change isn't in the diff. Adding --workspace "$CMUX_WORKSPACE_ID" to the per-surface examples makes same-workspace usage explicit and brings this section in line with the Panes and Surfaces block above it.

Reviews (1): Last reviewed commit: "doc: add cross-workspace targeting note ..." | Re-trigger Greptile


Surface identity is stable across move/reorder/split-off operations. Layout commands are focus-neutral by default; pass `--focus true` only when you want the moved or created surface selected.

**Cross-workspace input:** `send`, `send-key`, and `read-screen` resolve `--workspace` from `$CMUX_WORKSPACE_ID`. When targeting a surface outside the caller's workspace, you must pass `--workspace` explicitly. Omitting it produces the misleading `Error: invalid_params: Surface is not a terminal`.
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.

P2 Note orphaned without section header or examples

The cross-workspace note is appended to a file that covers only layout operations (split, move, focus, reorder) and contains no send/send-key/read-screen examples. Without a section heading anchoring it, an agent or developer reading panes-surfaces.md for surface layout guidance won't naturally encounter the input section, and anyone specifically seeking input usage has no example to copy. The PR description mentioned adding an "Input and Screen Reading" section with examples — that section header and at least one --workspace example were not included in the diff. Adding a heading like ## Input and Screen Reading with a representative example (e.g. cmux read-screen --workspace workspace:46 --surface surface:266) above the bold note would make the guidance more discoverable and actionable.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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