Skip to content

fix(pi): do not install extensions for disabled agents - #21711

Merged
nwparker merged 2 commits into
mainfrom
fix/pi-disabled-extensions-7814
Sep 19, 2026
Merged

nwparker merged 2 commits into
mainfrom
fix/pi-disabled-extensions-7814

Conversation

@nwparker

@nwparker nwparker commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7814 (the original Pi/OMP disabled-extension startup path).

ELI5

Orca was still preparing Pi's managed extension files for a plain terminal even after Pi was disabled in Settings. PTY setup now carries the per-agent disabled list through every local and daemon spawn path and only installs managed extensions for enabled agents. Disabling OMP's status integration still leaves its guarded fresh-launch config available, so the setting does not prevent an explicit OMP launch.

What changed

  • Gate Pi, OMP, and Prime managed-extension installation on disabledTuiAgents.
  • Thread the setting through local PTYs, daemon PTYs, and runtime preflight.
  • Keep ORCA_OMP_FRESH_CONFIG independent from OMP status-extension installation.
  • Add regression coverage for direct environment assembly and a real bare-PTY spawn.

Proof

  • ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/pty-spawn-env-terminal-basics.test.ts — 32 passed.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm tc:node — passed.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm run check:code-quality:changed — passed with 0 findings.
  • git diff --check — passed.
  • The regression exercises the same spawnAndGetEnv path used by a bare terminal, verifies disabled Pi/OMP installers are not called, and verifies guarded OMP launch config remains populated.

No visual proof applies: this is filesystem/process-environment setup with no rendered UI change.

Readiness checklist

  • Functional correctness: disabled Pi/OMP/Prime agents receive no managed extensions; guarded OMP launches retain fresh config.
  • Scope: only PTY extension selection, fresh-config preservation, and their tests changed.
  • Compatibility: absent disabledTuiAgents preserves the existing enabled behavior.
  • Cross-platform: local, daemon, and runtime spawn paths share the same gate.
  • User-facing trade-offs: disabling an agent no longer writes its Orca-managed files; enabled agents are unchanged.
  • Merge risk: low.

This addresses the original Pi/OMP report in #7814. Later comments about every other agent integration materializing roots are broader follow-up work and are not claimed as fixed here.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 68481125-4b09-4fd9-b70b-0aa64a9ff4b8

📥 Commits

Reviewing files that changed from the base of the PR and between 01f2415 and 52be58b.

📒 Files selected for processing (2)
  • src/main/ipc/pty-spawn-env-terminal-basics.test.ts
  • src/main/ipc/pty/host-env/assembly.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The change adds optional disabledTuiAgents support to PTY host environment construction. buildPtyHostEnv now checks TUI agent enablement before installing Pi, OMP, and prime-agent extensions. PTY settings forward the disabled-agent configuration through daemon, local-provider, and preflight paths. Tests cover disabled Pi and OMP behavior and bare PTY spawn propagation.

Priority: ➖ Normal

Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR satisfies the coding requirement in #7814. buildPtyHostEnv gates Pi extension installation on isTuiAgentEnabled('pi', opts.disabledTuiAgents). Local PTYs, daemon PTYs, and runtime preflight…
Out of Scope Changes check ✅ Passed The changes remain within the issue scope. The OMP and prime-agent gates apply the same disabled-agent rule to the shared managed-extension setup. The OMP fresh-configuration handling prevents guard…
Title check ✅ Passed The title clearly identifies the main change: preventing extension installation for disabled agents.
Description check ✅ Passed The description explains the problem, user-facing behavior, implementation scope, linked issue, testing, compatibility, and the absence of visual changes. It is mostly complete, although it does not u…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@pullfrog pullfrog 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.

ℹ️ No critical issues — one cross-host gap and one type sharp edge.

Reviewed changes

  • Local/daemon extension gating — buildPtyHostEnv now skips Pi/OMP/prime-agent managed-extension installs when the agent is in disabledTuiAgents (assembly.ts:66-71, gated at :160, :168, :182); clearPiAgentShadowEnv still runs for all three kinds so no stale shadow env leaks.
  • Setting threading — disabledTuiAgents flows from ptySettings into all three spawn-env call sites (local-configure.ts:83, spawn-env-codex.ts:154, spawn-preflight.ts:280) and is added to BuildPtyHostEnvOptions.
  • Regression tests — direct buildPtyHostEnv cases for disabled Pi and disabled OMP, plus a real bare-PTY spawn asserting Pi's installer is not called. The 32-test suite passes.

ℹ️ Disabled agents still receive managed extensions over SSH

The new gate sits in buildPtyHostEnv, so local and daemon-host spawns honor disabledTuiAgents. The SSH relay is a parallel installer that this PR does not touch: the host ships every Pi-family extension source to the remote relay, and the relay writes it based on the launched agent kind with no disabled-agent check. A disabled Pi/OMP/Prime therefore still gets orca-agent-status.ts under ~/.pi|.omp|.prime on an SSH target.

Technical details
# SSH relay installs are not gated by `disabledTuiAgents`

## Affected sites
- `src/main/ssh/ssh-relay-session.ts:1531` — `installPluginsOnRelay` ships `piExtensionSource` / `ompExtensionSource` / `primeAgentExtensionSource` unconditionally whenever `areAgentStatusHooksEnabled()` is true.
- `src/relay/relay-agent-hook-runtime.ts:81` — `buildPluginEnvironment` materializes by launched `kind` (default `pi`); the `PtyEnvAugmenter` context carries no disabled list.
- `src/relay/plugin-overlay.ts:293` — `materializePi` writes `<agentDir>/extensions/orca-agent-status.ts`.

## Required outcome
- Decide whether #7814 is local-only. If disabled agents should stay extension-free on every execution host, omit the disabled kinds' sources in `installPluginsOnRelay` (the host has `store.getSettings()`); if local-only, record SSH as a tracked follow-up so the behavior difference is intentional.

## Open questions for the human
- Is SSH deliberately out of scope for this fix, or should the source-shipping gate land here?

ℹ️ Nitpicks

  • The daemon call sites (spawn-env-codex.ts, spawn-preflight.ts) add threading but no daemon-path regression test; a single assertion mirroring the local case would lock it in.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

wslDistro?: string | null
agentStatusHooksEnabled: boolean
/** Per-agent opt-out; disabled agents must not receive managed extensions. */
disabledTuiAgents?: Iterable<unknown> | null

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.

Iterable<unknown> is wider than what the gate can actually read: isTuiAgentEnabled delegates to normalizeDisabledTuiAgents, which returns [] for anything that is not an array. A future caller passing a Set would silently be treated as "nothing disabled" and reinstall extensions for disabled agents — the exact bug this PR fixes. GlobalSettings.disabledTuiAgents is already TuiAgent[], so narrowing this option keeps the contract honest.

Suggested change
disabledTuiAgents?: Iterable<unknown> | null
disabledTuiAgents?: readonly TuiAgent[] | null

@nwparker

Copy link
Copy Markdown
Contributor Author

Verification update: addressed the independent review finding in 52be58bf416.

  • Disabled OMP no longer installs the managed status extension.
  • Guarded OMP launches still receive ORCA_OMP_FRESH_CONFIG, so disabling status integration does not make an explicit OMP launch fail.
  • The regression test now asserts both invariants: installer is not called and fresh config remains available.
  • Focused suite: 32 tests passed; node typecheck, changed-code quality, and diff check passed.

Scope clarification: this PR fixes the original Pi/OMP disabled-extension startup path reported by #7814. It does not claim to suppress every possible root created by every other agent integration; those need separate launch-kind fixes.

@pullfrog pullfrog 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.

ℹ️ No new issues in this delta — the fresh OMP config preservation is correct and covered.

Reviewed changes

This run covers the incremental delta 01f2415..52be58bf (two commits since the prior review).

  • Preserve fresh OMP config when OMP is disabled — when the managed OMP status extension is skipped because OMP is in disabledTuiAgents, buildPtyHostEnv now falls through to piTitlebarExtensionService.buildFreshOmpEnv() on the shouldPrepareOmpShadow path (assembly.ts:180-184), so a guarded fresh OMP launch still receives ORCA_OMP_FRESH_CONFIG. This mirrors the existing hooks-disabled branch at :208-210.
  • Regression coverage — the disabled-OMP direct-assembly test now captures the returned env and asserts ORCA_OMP_FRESH_CONFIG is populated (pty-spawn-env-terminal-basics.test.ts:98).

The materialized fresh config lives under Orca's own userData (omp-managed-status-extension/fresh-session.yml), not ~/.omp, so it does not reintroduce the orca-*.ts extension files that #7814 targets. 72 focused PTY-spawn tests pass locally.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit c4c9486 into main Sep 19, 2026
2 checks passed
@nwparker
nwparker deleted the fix/pi-disabled-extensions-7814 branch September 19, 2026 18:22
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.

[Bug]: Pi extensions are installed even when Pi agent is disabled

1 participant