skills: prefer agent-first worktree launch; avoid empty shell tabs#7957
Conversation
Document Orca's first-terminal behavior so agents do not leave dead shell tabs: --agent runs in the first terminal (one tab), bare worktree create + terminal create leaves shell + agent (two tabs). Also: re-resolve live handles via terminal list after create, message one handle only, and prefer orchestration check --inject over terminal send for pure orchestration pings. Aligns with CLI docs (--agent launches the selected agent in the first terminal).
Smoke results (local Orca runtime)Agent-first create (
Anti-pattern control (bare create +
Matches the skill guidance: |
📝 WalkthroughWalkthroughThis pull request updates Orca CLI and orchestration skill documentation with agent-first worktree creation guidance, startup terminal handle acquisition and recovery rules, bare-create behavior, Codex handoff constraints, and compatibility fallbacks. Terminal messaging guidance now specifies single live agent handles and clarifies that unread-mail injection renders in the executing terminal without remotely waking another terminal. New tests validate the documented agent-first, handle, and injection guidance. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
AmethystLiang
left a comment
There was a problem hiding this comment.
Thanks for documenting the agent-first workflow. I verified the underlying terminal and orchestration behavior and tightened the guidance:
- preserves configured setup/default-terminal surfaces
- uses the returned startup handle, with missing/stale recovery only
- distinguishes caller-local inbox checks from remote task/prompt delivery
- adds focused regression coverage
Typecheck and the affected guidance, runtime, and orchestration tests pass.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f0a54744-c429-4bc5-9be5-e606cd1d48aa
📒 Files selected for processing (4)
config/scripts/orca-cli-skill-guidance.test.mjsconfig/scripts/orchestration-skill-guidance.test.mjsskills/orca-cli/SKILL.mdskills/orchestration/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (1)
- skills/orchestration/SKILL.md
| - If an older installed CLI rejects `--agent`, `--prompt`, or `--setup`, create the worktree normally, then run `orca terminal create --worktree <selector> --command "codex"` and `orca terminal send` if a prompt is needed. | ||
| - `worktree create` creates a new checkout. For a fresh agent in the current checkout, use `orca terminal create --worktree active --command "codex" --json`. | ||
| - Let Orca choose setup terminal placement from repo settings, including tab vs split behavior. Do not manually create extra setup terminals when `--agent` already owns the first tab. | ||
| - If an older installed CLI rejects `--agent`, `--prompt`, or `--setup`, create the worktree normally, then run `orca terminal create --worktree <selector> --command "codex"` and `orca terminal send` if a prompt is needed. This can leave a fallback shell when no default tabs are configured; close it only after confirming it is unused. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve the requested agent in the compatibility fallback.
This fallback always launches codex, so requests for claude, omp, pi, grok, or another agent silently start the wrong worker. Use the originally requested agent ID/command instead.
Proposed fix
- If an older installed CLI rejects `--agent`, `--prompt`, or `--setup`, create the worktree normally, then run `orca terminal create --worktree <selector> --command "codex"` and `orca terminal send` if a prompt is needed.
+ If an older installed CLI rejects `--agent`, `--prompt`, or `--setup`, create the worktree normally, then run `orca terminal create --worktree <selector> --command "<requested-agent>"` and `orca terminal send` if a prompt is needed.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - If an older installed CLI rejects `--agent`, `--prompt`, or `--setup`, create the worktree normally, then run `orca terminal create --worktree <selector> --command "codex"` and `orca terminal send` if a prompt is needed. This can leave a fallback shell when no default tabs are configured; close it only after confirming it is unused. | |
| - If an older installed CLI rejects `--agent`, `--prompt`, or `--setup`, create the worktree normally, then run `orca terminal create --worktree <selector> --command "<requested-agent>"` and `orca terminal send` if a prompt is needed. This can leave a fallback shell when no default tabs are configured; close it only after confirming it is unused. |
🧰 Tools
🪛 SkillSpector (2.3.7)
[warning] 282: [RP1] null: npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
Remediation: Pin the version: npx @scope/server@1.2.3
(MCP Rug Pull (RP1))
Summary
skills/orca-cliandskills/orchestrationso ordinary agent workers do not gain a separate fallback shell.worktree create --agent <id>for known TUI agents; repo-configured setup/default-terminal tabs remain intentional and may still add tabs or splits.startupTerminal.handleas the sole destination when returned; re-list only when the handle is missing or stale, and never dual-send.orchestration check --unread --injectrenders the inbox for the agent that runs it; usedispatch --injectorterminal sendfor remote delivery.This is skill guidance and static tests only; no product runtime code changes. It aligns with the CLI contract that
--agentlaunches the selected agent in the first terminal.Why
The two-step create-then-launch path can leave a fallback shell when no configured default terminal supplies the primary surface. Agent-first creation avoids that extra worker shell while preserving setup/default terminals that may run real commands. Custom argv, such as Codex model or effort flags, still requires the two-step fallback.
Test plan
pnpm vitest run config/scripts/orca-cli-skill-guidance.test.mjs config/scripts/orchestration-skill-guidance.test.mjs— 13 tests passedpnpm typecheck