Skip to content

Use managed Pi and OMP extensions - #5681

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/pi-omp-managed-extensions
Jun 18, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/pi-omp-managed-extensions

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Stop redirecting Pi/OMP launches through Orca PI_CODING_AGENT_DIR overlays.
  • Install Orca-managed Pi/OMP extension files into the selected real agent dir instead, guarded by ORCA_PANE_KEY and an @orca-managed-pi-extension ownership marker.
  • Keep OMP typed-command integration by wrapping interactive omp launches with --extension, while config/help/subcommands keep their normal home and argv.
  • Preserve OpenCode overlays; update SSH relay behavior so Pi/OMP install guarded extensions on the remote real agent dirs.

Migration / Upgrade Safety

  • No destructive migration: old Orca Pi/OMP overlay dirs are not copied back or deleted wholesale.
  • Stale PTY-scoped overlay cleanup remains best-effort, but source-scoped legacy overlay state is left in place.
  • Existing real configs under ~/.pi/agent and ~/.omp/agent are used directly after upgrade.
  • If a user only created config/auth inside an old Orca overlay, Orca still will not guess/copy it automatically because multiple old terminal overlays can disagree. That case remains manual, but the PR prevents new config/auth/session/db writes from continuing to land in Orca overlays.
  • Same-named user extension files are not overwritten unless they already contain the Orca-managed marker.
  • The titlebar/prefill/status extensions no-op outside Orca via ORCA_PANE_KEY/hook env guards, so standalone Pi/OMP are not affected by Orca behavior.

Validation

  • Pre-commit hook: oxlint, React doctor lint, oxfmt.
  • pnpm exec tsgo --noEmit -p config/tsconfig.node.json
  • pnpm exec vitest run --config config/vitest.config.ts src/main/pi/titlebar-extension-service.test.ts src/main/pi/titlebar-extension-overlay-path.test.ts src/main/pty/omp-shell-wrapper.node-pty.test.ts src/main/providers/local-pty-shell-ready.test.ts src/main/providers/windows-shell-args.test.ts src/main/daemon/shell-ready.test.ts src/main/daemon/pty-subprocess.test.ts src/main/powershell-osc133-bootstrap.test.ts src/main/ipc/pty.test.ts src/relay/plugin-overlay.test.ts src/relay/plugin-overlay-env.test.ts src/relay/pty-shell-launch.test.ts src/relay/pty-handler.test.ts src/shared/tui-agent-startup.test.ts src/main/text-generation/commit-message-agent-environment.test.ts src/main/pty/omp-sqlite-overlay.test.ts
    • 16 files passed, 444 tests passed.
  • Real pi --version on this machine: 0.72.1.
  • Real OMP caveat: omp is not installed on PATH; temporary pnpm dlx @oh-my-pi/[email protected] --version and @15.11.2 --version both fail before Orca code with an upstream/local Bun parse error in dist/cli.js. The PR validation therefore uses the node-pty OMP reproduction harness with a fake omp binary to verify argv/home behavior.
  • SSH: relay unit coverage passes for remote extension install/env behavior. The localhost SSH Playwright E2E is gated by ORCA_E2E_SSH_LOCALHOST=1 and was not run locally.

Made with Orca 🐋


Open in Stage

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change replaces the per-PTY hash-named overlay-directory mirroring strategy for Pi/OMP agent extensions with a direct managed-extension installation approach. PiTitlebarExtensionService.buildPtyEnv now installs the titlebar, prefill, and status extension files directly into the real source agent's extensions/ directory, guarded by an @orca-managed-pi-extension marker that prevents overwriting user-owned files. It returns ORCA_PI_SOURCE_AGENT_DIR / ORCA_OMP_SOURCE_AGENT_DIR / ORCA_OMP_STATUS_EXTENSION instead of PI_CODING_AGENT_DIR. The relay's PluginOverlayManager applies the same direct-install pattern for SSH targets. All shell startup wrappers (bash/zsh across daemon, local providers, and relay) remove the PI_CODING_AGENT_DIR fallback export blocks and add OPENCODE_CONFIG_DIR restoration. The OMP shell wrapper is narrowed to activate only when ORCA_OMP_STATUS_EXTENSION is set. Extension source scripts gain an ORCA_PANE_KEY early-return guard.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is comprehensive and mostly complete, covering summary, migration safety, and validation. However, it lacks the Screenshots, Testing checklist sections, AI Review Report, and Security Audit sections specified in the template. Add the Screenshots, Testing checklist (with boxes), AI Review Report (including cross-platform compatibility confirmation), and Security Audit sections from the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 26.67% 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 pull request title 'Use managed Pi and OMP extensions' accurately and concisely describes the main change—shifting from overlays to managed extension installation.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (2)
src/main/ipc/pty.ts (1)

713-725: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don’t restore PI_CODING_AGENT_DIR from managed-source metadata.

ORCA_PI_SOURCE_AGENT_DIR / ORCA_OMP_SOURCE_AGENT_DIR are now metadata for direct installs, but this disabled-hooks path still treats them like legacy overlay restore values and can set PI_CODING_AGENT_DIR from an inherited OMP source dir. Only restore PI_CODING_AGENT_DIR when the current value is the legacy ORCA_*_CODING_AGENT_DIR overlay; otherwise strip the ORCA metadata.

Proposed split between legacy overlay restore and managed metadata strip
+function restoreOrStripLegacyPiOverlayEnv(
+  baseEnv: Record<string, string>,
+  keys: {
+    primary: string
+    overlay: string
+    source: string
+  }
+): void {
+  const sourceValue = baseEnv[keys.source] ?? process.env[keys.source]
+  const overlayValue = baseEnv[keys.overlay] ?? process.env[keys.overlay]
+  const primaryValue = baseEnv[keys.primary] ?? process.env[keys.primary]
+
+  if (overlayValue && primaryValue === overlayValue) {
+    if (sourceValue) {
+      baseEnv[keys.primary] = sourceValue
+    } else {
+      delete baseEnv[keys.primary]
+    }
+  }
+  delete baseEnv[keys.overlay]
+  delete baseEnv[keys.source]
+}
+
   } else {
     // Why: when agent status is disabled we must strip BOTH kinds' shadow vars
     // so a nested PTY does not inherit a stale overlay from either agent.
-    restoreOrStripOverlayEnv(baseEnv, {
+    restoreOrStripLegacyPiOverlayEnv(baseEnv, {
       primary: 'PI_CODING_AGENT_DIR',
       overlay: 'ORCA_PI_CODING_AGENT_DIR',
       source: 'ORCA_PI_SOURCE_AGENT_DIR'
     })
-    restoreOrStripOverlayEnv(baseEnv, {
+    restoreOrStripLegacyPiOverlayEnv(baseEnv, {
       primary: 'PI_CODING_AGENT_DIR',
       overlay: 'ORCA_OMP_CODING_AGENT_DIR',
       source: 'ORCA_OMP_SOURCE_AGENT_DIR'
     })
src/main/pty/omp-shell-wrapper.ts (1)

40-55: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Skip the extension for launch --help and version help paths.

The skip check only inspects the first arg, so omp launch --help becomes omp launch --extension ... --help. That changes help argv shape even though help/config/subcommands are supposed to stay unwrapped.

Proposed argv skip handling
+__orca_omp_has_help_flag() {
+  local __orca_arg
+  for __orca_arg in "$@"; do
+    case "$__orca_arg" in
+      help|--help|-h|--version|-v) return 0 ;;
+    esac
+  done
+  return 1
+}
 __orca_omp_should_skip_extension() {
-  case "${1:-}" in
-    help|--help|-h|--version|-v) return 0 ;;
-  esac
+  __orca_omp_has_help_flag "$@" && return 0
   __orca_omp_is_subcommand "${1:-}"
 }
 __orca_omp() {
   local __orca_use_extension=1
-  __orca_omp_should_skip_extension "${1:-}" && __orca_use_extension=0
+  __orca_omp_should_skip_extension "$@" && __orca_use_extension=0
+function Global:__OrcaOmpHasHelpFlag {
+    param([object[]]$Values)
+    foreach ($Value in $Values) {
+        if (@("help", "--help", "-h", "--version", "-v") -contains ([string]$Value)) {
+            return $true
+        }
+    }
+    return $false
+}
 function Global:__OrcaOmpShouldSkipExtension {
-    param([string]$Name)
-    if (@("help", "--help", "-h", "--version", "-v") -contains $Name) { return $true }
+    param([string]$Name, [object[]]$Values)
+    if (__OrcaOmpHasHelpFlag -Values $Values) { return $true }
     return __OrcaOmpIsSubcommand -Name $Name
 }
 if ($env:ORCA_OMP_STATUS_EXTENSION) {
     function Global:omp {
-        $orcaUseExtension = -not (__OrcaOmpShouldSkipExtension -Name ([string]($args[0])))
+        $orcaUseExtension = -not (__OrcaOmpShouldSkipExtension -Name ([string]($args[0])) -Values $args)

Also applies to: 76-96

🧹 Nitpick comments (1)
src/main/pi/titlebar-extension-service.test.ts (1)

48-51: 💤 Low value

Consider extracting the shared legacyOverlayPath helper.

The same helper is defined in both titlebar-extension-service.test.ts (lines 48-51) and titlebar-extension-overlay-path.test.ts (lines 31-34). Extract it to a shared test utility module to eliminate duplication.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 21a50620-5cfd-4309-af10-9a32ca209255

📥 Commits

Reviewing files that changed from the base of the PR and between c9bd613 and cfdd0e0.

📒 Files selected for processing (31)
  • src/main/daemon/pty-session-id.ts
  • src/main/daemon/pty-subprocess.test.ts
  • src/main/daemon/pty-subprocess.ts
  • src/main/daemon/shell-ready.test.ts
  • src/main/daemon/shell-ready.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/pi/agent-status-extension-source.ts
  • src/main/pi/prefill-extension-source.ts
  • src/main/pi/titlebar-extension-overlay-path.test.ts
  • src/main/pi/titlebar-extension-service.test.ts
  • src/main/pi/titlebar-extension-service.ts
  • src/main/pi/titlebar-extension-source.ts
  • src/main/powershell-osc133-bootstrap.test.ts
  • src/main/powershell-osc133-bootstrap.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/local-pty-shell-ready.test.ts
  • src/main/providers/local-pty-shell-ready.ts
  • src/main/providers/windows-shell-args.test.ts
  • src/main/pty/omp-shell-wrapper.node-pty.test.ts
  • src/main/pty/omp-shell-wrapper.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/relay/plugin-overlay.test.ts
  • src/relay/plugin-overlay.ts
  • src/relay/pty-handler.test.ts
  • src/relay/pty-handler.ts
  • src/relay/pty-shell-launch.ts
  • src/relay/relay.ts
  • src/shared/pi-agent-kind.ts
  • src/shared/tui-agent-startup.test.ts
  • tests/e2e/ssh-localhost.spec.ts
💤 Files with no reviewable changes (3)
  • src/main/powershell-osc133-bootstrap.ts
  • src/main/daemon/shell-ready.ts
  • src/main/providers/local-pty-shell-ready.ts

Comment on lines +225 to 230
private canOverwritePiExtension(path: string): boolean {
try {
return JSON.parse(readFileSync(settingsPath, 'utf8'))
return readFileSync(path, 'utf8').includes(ORCA_MANAGED_EXTENSION_MARKER)
} catch {
return {}
return true
}

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve the marker guard on unreadable files.

canOverwritePiExtension returns true for every read failure, so an existing user-owned orca-agent-status.ts that is unreadable but writable can still be truncated. Also, includes treats any incidental marker text as ownership. Only allow missing files, and require the marker on the expected first line.

Proposed guard tightening
 const ORCA_MANAGED_EXTENSION_MARKER = '`@orca-managed-pi-extension`'
+const ORCA_MANAGED_EXTENSION_MARKER_LINE = `// ${ORCA_MANAGED_EXTENSION_MARKER}`
 
 function withOrcaManagedPiExtensionMarker(source: string): string {
-  return source.includes(ORCA_MANAGED_EXTENSION_MARKER)
+  return source.startsWith(`${ORCA_MANAGED_EXTENSION_MARKER_LINE}\n`)
     ? source
-    : `// ${ORCA_MANAGED_EXTENSION_MARKER}\n${source}`
+    : `${ORCA_MANAGED_EXTENSION_MARKER_LINE}\n${source}`
 }
 
   private canOverwritePiExtension(path: string): boolean {
     try {
-      return readFileSync(path, 'utf8').includes(ORCA_MANAGED_EXTENSION_MARKER)
-    } catch {
-      return true
+      const [firstLine] = readFileSync(path, 'utf8').split(/\r?\n/, 1)
+      return firstLine === ORCA_MANAGED_EXTENSION_MARKER_LINE
+    } catch (err) {
+      return (err as NodeJS.ErrnoException).code === 'ENOENT'
     }
   }

@Jinwoo-H
Jinwoo-H merged commit 84a5def into main Jun 18, 2026
2 checks passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/pi-omp-managed-extensions branch June 18, 2026 06:28
@igasmi igasmi mentioned this pull request Jun 18, 2026
1 of 5 tasks
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-text-zoom.test.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (78 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/app/h/[hostId]/session/[worktreeId].tsx
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-html.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/zh.json
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (341 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/main/text-generation/commit-message-text-generation.test.ts
#	src/main/text-generation/commit-message-text-generation.ts
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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