Skip to content

Honor agent settings for bare CLI terminal launches - #6750

Merged
Jinwoo-H merged 4 commits into
stablyai:mainfrom
RubinCarter:RubinCarter/analyze-yolo-orchestration-permissions
Jul 4, 2026
Merged

Jinwoo-H merged 4 commits into
stablyai:mainfrom
RubinCarter:RubinCarter/analyze-yolo-orchestration-permissions

Conversation

@RubinCarter

Copy link
Copy Markdown
Contributor

Summary

  • Apply configured TUI agent defaults when the runtime creates a repo-backed terminal from an exact bare agent launch command such as codex.
  • Reuse the existing buildAgentStartupPlan path so CLI and orchestration worker terminals inherit Agent Permissions, including Codex YOLO mode, and configured agent env values.
  • Cover both background and renderer-backed terminal creation paths with regression tests.

Why

The app quick-launch menu already reads Settings before launching agents, but $orca-cli / orchestration workers can create terminals through orca terminal create --command codex. That path previously passed a raw shell command into the runtime, so Settings > Agent Permissions were silently ignored for worker terminals. The same visible agent launch could therefore run with different permissions depending on whether it came from the UI or from CLI/orchestration, which is especially important for unattended worker flows.

Compatibility

The runtime only upgrades unmanaged, repo-backed, enabled, exact bare agent launch commands with no existing launch metadata. Raw user-authored commands such as codex exec ..., codex review, claude -p ..., disabled agents, folder or floating terminals, and requests that already provide env/launchConfig/launchAgent/startupCommandDelivery remain unchanged. This keeps command execution semantics intact while fixing the missing Settings defaults for the orchestration worker case.

Verification

  • pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts
  • pnpm run typecheck:node
  • pnpm run build:cli
  • pnpm run build:electron-vite
  • Verified with node config/scripts/orca-dev.mjs terminal create --command codex against a repo-backed worktree; the launched Codex terminal reported YOLO permissions.

WHAT: Apply configured TUI agent defaults when the runtime creates a repo-backed terminal from a bare agent command such as codex, so orchestration workers and orca terminal create --command codex inherit Agent Permissions and agent env settings.

WHY: The quick-launch UI already builds agent startup plans from Settings, but the CLI and orchestration path sent a raw shell command. That meant Settings > Agent Permissions, including Codex YOLO mode, were silently ignored for worker terminals, making equivalent agent launches behave differently and weakening unattended orchestration flows.

HOW: Resolve Settings in the runtime after the worktree, repo, platform, and remote context are known. Only exact, enabled bare agent launch commands with no existing launch metadata are upgraded through buildAgentStartupPlan; raw commands such as codex exec, codex review, claude -p, disabled agents, folder or floating terminals, and pre-planned launches stay unchanged. Cover both background and renderer-backed terminal creation paths with regression tests.
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 54ba37aa-a46d-46ba-86c1-43f7bca2db80

📥 Commits

Reviewing files that changed from the base of the PR and between d877d94 and 08b91c7.

📒 Files selected for processing (2)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts

📝 Walkthrough

Walkthrough

orca-runtime.ts introduces a named TerminalCreateOptions type, two command-matching helpers (normalizeCommand, resolveBareAgentFromCommand), and a new resolveAgentTerminalCreateOptions method. When createTerminal receives a bare agent launch command with available workspace Settings, the resolver rewrites it with agentDefaultArgs (including bypass-approvals-and-sandbox quoting) and agentDefaultEnv. The resolved launchOpts object is then used throughout createTerminal for tabId/leafId, launchToken, PTY/session creation, mobile-session publish, revealTerminalSession, and renderer terminal:requestTabCreate IPC. Tests are added and updated to cover bare, non-bare, disabled-bare, and renderer-backed paths.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description omits required template sections like Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing sections and include the required testing, cross-platform review, security audit, screenshots/no-visual-change note, and follow-up notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: honoring agent settings for bare CLI terminal launches.
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.

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.

@Jinwoo-H Jinwoo-H 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.

Thanks! I pushed a merge update and a couple of maintainer fixes.

  • Bare repo-backed terminal creates now reuse Settings agent defaults for exact agent commands like codex.
  • Raw commands, disabled agents, and already-managed launches remain unchanged.
  • Added coverage for command overrides, renderer-backed creates, and trust preflight ordering.

Validation: runtime tests, typecheck, lint, CLI build, and Electron CLI/runtime smoke all passed.

@Jinwoo-H
Jinwoo-H merged commit dc1c1e9 into stablyai:main Jul 4, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Bare repo-backed terminal creates now reuse Settings agent defaults for exact agent commands while preserving raw commands, disabled agents, and already-managed launches.

Validation:
- PR Checks / verify passed
- Local runtime tests, typecheck, lint, CLI build, and Electron CLI/runtime smoke passed
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.

2 participants