Repository navigation
Use managed Pi and OMP extensions - #5681
Conversation
Co-authored-by: Orca <[email protected]>
|
Ready to review this PR? Stage has broken it down into 13 individual chapters for you: Chapters generated by Stage for commit cfdd0e0 on Jun 18, 2026 6:12am UTC. |
📝 WalkthroughWalkthroughThis change replaces the per-PTY hash-named overlay-directory mirroring strategy for Pi/OMP agent extensions with a direct managed-extension installation approach. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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 |
There was a problem hiding this comment.
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 winDon’t restore
PI_CODING_AGENT_DIRfrom managed-source metadata.
ORCA_PI_SOURCE_AGENT_DIR/ORCA_OMP_SOURCE_AGENT_DIRare now metadata for direct installs, but this disabled-hooks path still treats them like legacy overlay restore values and can setPI_CODING_AGENT_DIRfrom an inherited OMP source dir. Only restorePI_CODING_AGENT_DIRwhen the current value is the legacyORCA_*_CODING_AGENT_DIRoverlay; 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 winSkip the extension for
launch --helpand version help paths.The skip check only inspects the first arg, so
omp launch --helpbecomesomp 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 valueConsider extracting the shared
legacyOverlayPathhelper.The same helper is defined in both
titlebar-extension-service.test.ts(lines 48-51) andtitlebar-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
📒 Files selected for processing (31)
src/main/daemon/pty-session-id.tssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/daemon/shell-ready.test.tssrc/main/daemon/shell-ready.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/pi/agent-status-extension-source.tssrc/main/pi/prefill-extension-source.tssrc/main/pi/titlebar-extension-overlay-path.test.tssrc/main/pi/titlebar-extension-service.test.tssrc/main/pi/titlebar-extension-service.tssrc/main/pi/titlebar-extension-source.tssrc/main/powershell-osc133-bootstrap.test.tssrc/main/powershell-osc133-bootstrap.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-shell-ready.test.tssrc/main/providers/local-pty-shell-ready.tssrc/main/providers/windows-shell-args.test.tssrc/main/pty/omp-shell-wrapper.node-pty.test.tssrc/main/pty/omp-shell-wrapper.tssrc/main/text-generation/commit-message-agent-environment.tssrc/relay/plugin-overlay.test.tssrc/relay/plugin-overlay.tssrc/relay/pty-handler.test.tssrc/relay/pty-handler.tssrc/relay/pty-shell-launch.tssrc/relay/relay.tssrc/shared/pi-agent-kind.tssrc/shared/tui-agent-startup.test.tstests/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
| 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 | ||
| } |
There was a problem hiding this comment.
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'
}
}* 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
* 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
* 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
* 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
Co-authored-by: Orca <[email protected]>
Summary
PI_CODING_AGENT_DIRoverlays.ORCA_PANE_KEYand an@orca-managed-pi-extensionownership marker.omplaunches with--extension, while config/help/subcommands keep their normal home and argv.Migration / Upgrade Safety
~/.pi/agentand~/.omp/agentare used directly after upgrade.ORCA_PANE_KEY/hook env guards, so standalone Pi/OMP are not affected by Orca behavior.Validation
oxlint, React doctor lint,oxfmt.pnpm exec tsgo --noEmit -p config/tsconfig.node.jsonpnpm 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.tspi --versionon this machine:0.72.1.ompis not installed on PATH; temporarypnpm dlx @oh-my-pi/[email protected] --versionand@15.11.2 --versionboth fail before Orca code with an upstream/local Bun parse error indist/cli.js. The PR validation therefore uses the node-pty OMP reproduction harness with a fakeompbinary to verify argv/home behavior.ORCA_E2E_SSH_LOCALHOST=1and was not run locally.Made with Orca 🐋