Repository navigation
fix(pty): do not create unused Pi/OMP home dirs on bare shells - #10198
Conversation
📝 WalkthroughWalkthroughAdds 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f0d06c97-2476-42ca-8925-a4f5b64dd82f
📥 Commits
Reviewing files that changed from the base of the PR and between 8f40ddf and 6fd3c630086ae518b98703fb3d506c4fbd6ac145.
📒 Files selected for processing (7)
src/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/pi/titlebar-extension-service.test.tssrc/main/pi/titlebar-extension-service.tssrc/relay/plugin-overlay.test.tssrc/relay/plugin-overlay.tssrc/relay/relay.ts
Bare terminals used to materialize ~/.pi/agent and ~/.omp/agent (and install managed extensions) for possible later shell-launched agents. Users who never use those agents still saw the directories recreated after deletion. Only create the default agent home when launching that agent explicitly, or when the home already exists. Bare-shell OMP status still uses the userData fallback so typed `omp` keeps the shell wrapper extension. Closes stablyai#10196
CodeRabbit: relay materializePi returned null on bare shells with a missing OMP home, so SSH PTYs never set ORCA_OMP_STATUS_EXTENSION. Local already wrote a userData-managed status extension in that case. Write the status file under ~/.orca-relay/omp-managed-status-extension and return MaterializePiResult so relay.ts can export ORCA_OMP_STATUS_EXTENSION without ORCA_OMP_SOURCE_AGENT_DIR or creating ~/.omp. Also fix the local withOrcaManagedExtensionMarker typo on the bare-shell path.
6fd3c63 to
4c8421a
Compare
Sync update (
|
Scope note (from #10196)Keeping this PR scoped to bare-shell Pi/OMP home materialization (and the SSH relay overlay parity). Amethyst also reported a related-but-broader repro: with agents disabled, Orca still creates other homes ( Issue thread: #10196 (comment) |
|
Implemented the follow-up fix in The fix keeps Pi/OMP home materialization scoped to explicit Pi/OMP launches:
Review and validation:
Live Docker SSH was attempted, but the pinned base image did not finish resolving after roughly four minutes, so no live SSH container result is claimed. Relay unit/integration coverage passed.
Electron evidence: Existing-home bare-shell preservation: Explicit Pi/OMP launches and subsequent existing-home preservation: |
Greptile SummaryThis PR fixes a UX regression where every bare terminal spawn would mkdir
Confidence Score: 5/5Safe to merge. The change only restricts when agent home dirs are created; all existing dirs and explicit launches are unaffected. Every changed code path has a matching test (unit and integration), the OMP userData fallback is covered by both the local and relay test suites, the return-type refactor on materializePi is fully propagated across all call sites, and the removed getRelayPiStatusExtensionPath export has no remaining consumers. No production logic is silently changed for users who already have ~/.pi or ~/.omp on disk. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/shared/pi-agent-kind.ts | Adds detectExplicitPiAgentKindFromCommand (returns null for bare/non-pi shells); simplifies OMP detection to first-binary comparison. detectPiAgentKindFromCommand now has no production callers — it delegates to the explicit variant and is kept only for tests. |
| src/main/pi/titlebar-extension-service.ts | Adds materializeDefaultHome option to buildPtyEnv; short-circuits before any mkdirSync when the dir is absent and the flag is false, writing only the OMP userData fallback status extension for bare-shell OMP prep. |
| src/relay/plugin-overlay.ts | Changes materializePi return from string |
| src/main/ipc/pty.ts | Switches to detectExplicitPiAgentKindFromCommand + isPiCompatibleAgentType for explicit kind resolution; passes materializeDefaultHome: explicitPiAgentKind === 'pi'/'omp' so bare shells never create missing homes. |
| src/relay/relay.ts | Mirrors the pty.ts logic for the SSH relay env-augmenter path; reads MaterializePiResult fields individually so the OMP bare-shell status-only case (statusExtensionPath set, sourceAgentDir absent) is handled correctly. |
| src/relay/pty-handler.ts | Threads launchAgent through buildSpawnEnv context and PtyEnvAugmenter callback; simplifies isUnattended to launchAgent !== undefined after isTuiAgent validation is hoisted to the spawn handler. |
Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
SSH Docker validation — LANDTested exact PR head 6e9df25 in an isolated Electron user-data directory against a disposable Docker SSH host. Target: Debian GNU/Linux 12 Bookworm, arm64, Node 22.23.1, Git 2.39.5. Remote agent hooks were enabled. No emulator or simulator was started. Real SSH behavior
Landing-state regression gateThe PR head is 392 commits behind current main and its old baseline alone carries seven stale PowerShell cwd expectation failures. Current main already has that test-helper correction. A conflict-free synthetic merge with current main passed the complete targeted set:
Relay log had zero plugin-overlay or PTY failures; daemon log had no relevant failures. The app did emit existing SSH filesystem notification warnings while browsing files, outside this PRs touched paths and without affecting PTY or Git transport. ScreenshotsBare shell plus real transport: Explicit Pi: Explicit OMP: CleanupKilled all three test PTYs, removed the remote test worktree/branch/file and test-created agent homes, verified the remote main repo clean, removed the Orca repo/SSH target, stopped the isolated Electron instance, removed the Docker container, removed the synthetic-merge worktree, and moved local test artifacts to Trash. No task-prefixed container, temp directory, or worktree remains. Verdict: land. |
…-pi-omp-home-dirs
…yai#10198) * fix(pty): do not create unused Pi/OMP home dirs on bare shells Bare terminals used to materialize ~/.pi/agent and ~/.omp/agent (and install managed extensions) for possible later shell-launched agents. Users who never use those agents still saw the directories recreated after deletion. Only create the default agent home when launching that agent explicitly, or when the home already exists. Bare-shell OMP status still uses the userData fallback so typed `omp` keeps the shell wrapper extension. Closes stablyai#10196 * fix(relay): OMP bare-shell status fallback without ~/.omp CodeRabbit: relay materializePi returned null on bare shells with a missing OMP home, so SSH PTYs never set ORCA_OMP_STATUS_EXTENSION. Local already wrote a userData-managed status extension in that case. Write the status file under ~/.orca-relay/omp-managed-status-extension and return MaterializePiResult so relay.ts can export ORCA_OMP_STATUS_EXTENSION without ORCA_OMP_SOURCE_AGENT_DIR or creating ~/.omp. Also fix the local withOrcaManagedExtensionMarker typo on the bare-shell path. * fix(pty): only materialize Pi home for Pi launches --------- Co-authored-by: Brennan Benson <[email protected]>





Summary
~/.pi/~/.ompjust so a later typed agent might get hooks.omp-managed-status-extension) so shell-launchedompkeeps the wrapper extension without polluting$HOME.Fixes #10196.
Why
After install, Orca detects/prepares many agents. For Pi/OMP, every plain terminal ran managed-extension install into the default
~/.<agent>/agenttree. Users who never use Pi or OMP still saw those folders reappear after deletion (Windows report, but the path is host-local for all platforms).Test plan
titlebar-extension-serviceregression: bare-shell prep does not create missing homes; OMP status lands in userDataplugin-overlayregression: bare-shellmaterializeDefaultHome: falseleaves remote homes untouchedpty.testspawn env / WSLENV assertions updated for no-default-home bare shellspnpm exec vitest run --config config/vitest.config.tsfocused suites (389 tests)Screenshots
No visual change.
ELI5
Every bare shell used to create ~/.pi and ~/.omp just in case, cluttering HOME. Those dirs are only created when you actually launch Pi/OMP or they already exist.