Skip to content

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

Closed

Description

@pravusid

Operating system

macOS

Orca version

v1.4.128

Details

Pi extensions are installed even when Pi agent is disabled

When Agent Status Hooks is enabled, Orca installs Pi extension files even if the Pi agent is disabled in Settings > Agents.

Current behavior

My settings:

  • Agent Status Hooks: enabled
  • Pi agent: disabled

After starting Orca / opening a new session, the following files are created under ~/.pi/agent/extensions:

orca-agent-status.ts
orca-prefill.ts
orca-titlebar-spinner.ts

Steps to reproduce

  1. Enable Agent Status Hooks
  2. Disable Pi agent
  3. Remove existing Orca Pi extension files:
rm -f ~/.pi/agent/extensions/orca-*.ts
  1. Restart Orca or open a new Orca session
  2. Check ~/.pi/agent/extensions

The orca-*.ts files are created again.

Relates

Activity

  1. added
    bug
    on Jul 8, 2026
  2. added
    os:macos
    on Jul 8, 2026
  3. added theissue type on Jul 12, 2026
  4. nwparker commented on Jul 21, 2026

    @nwparker
    Contributor

    Reproduced on current tree (main-based).

    The Pi managed extensions are installed for every bare-shell PTY whenever Agent Status Hooks is enabled, regardless of the Pi agent being disabled in Settings > Agents.

    Root cause — src/main/ipc/pty.ts buildPtyHostEnv (~L964-971) gates the Pi extension install ONLY on opts.agentStatusHooksEnabled + piAgentKind === 'pi'. piAgentKind (src/shared/pi-agent-kind.ts detectPiAgentKindFromCommand) defaults to 'pi' for any non-OMP / bare-shell command. Neither the pty:spawn handler nor buildPtyHostEnv ever reads the per-agent disabledTuiAgents / isTuiAgentEnabled setting — a grep shows those symbols exist only in src/renderer. So piTitlebarExtensionService.buildPtyEnv(id, …, 'pi') still runs and unconditionally writes orca-agent-status.ts, orca-prefill.ts, orca-titlebar-spinner.ts (src/main/pi/titlebar-extension-service.ts installManagedExtensions).

    Re-run:

    pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/repro-7814-pi-extensions-installed-when-disabled.test.ts
    

    The test drives a real bare-shell pty:spawn with getSettings()->{ agentStatusHooksEnabled: true, disabledTuiAgents: ['pi'] }. Key assertion (passes, encoding the bug):

    expect(piBuildPtyEnvMock).toHaveBeenCalledWith(expect.any(String), undefined, 'pi')
    expect(env.ORCA_PI_SOURCE_AGENT_DIR).toBe('/tmp/default-pi-agent') // Pi env injected into the PTY

    Contrast case confirms the ONLY working gate is the global agentStatusHooksEnabled toggle (with it off, piBuildPtyEnvMock is not called). 2/2 tests pass.

    A fix would gate the piAgentKind === 'pi' (and OMP) install branch on isTuiAgentEnabled(settings, kind) — threading the per-agent disable flag into BuildPtyHostEnvOptions the same way agentStatusHooksEnabled already is — after which piBuildPtyEnvMock would not be called with 'pi' in this scenario.

  5. added
    has_repro
    on Jul 21, 2026
  6. arch3rPro commented on Jul 30, 2026

    @arch3rPro

    Reproduced on macOS (Darwin 24.6) with Orca 1.4.159.

    I disabled these unused Agent integrations in Orca, fully exited Orca, removed their configuration roots, and relaunched Orca. The relaunch used a new PID and runtime ID. Orca recreated every root below:

    • ~/.commandcode
    • ~/.config/amp
    • ~/.config/devin
    • ~/.factory
    • ~/.gemini
    • ~/.copilot
    • ~/.grok
    • ~/.hermes
    • ~/.kimi-code

    The regenerated contents are Orca-managed Hook registrations, plugins, or extensions; for example they reference ~/.orca/agent-hooks/..., and the Kimi block explicitly says managed by Orca; do not edit.

    This reproduces after an Agent is disabled, so it is broader than the Pi-specific behavior described here. It also relates to #10196.

    Expected behavior: a disabled Agent must not materialize its configuration root or install/write Orca-managed Hooks, plugins, or extensions during startup.

  7. nwparker commented on Sep 19, 2026

    @nwparker
    Contributor

    Fixes #7814.

    ELI5

    Orca was still preparing Pi's managed extension files for a plain terminal even after Pi was disabled in Settings. The PTY setup now carries the per-agent disabled list through every local and daemon spawn path and only installs managed extensions for enabled agents.

    What changed

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

    Proof

    • pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/pty-spawn-env-terminal-basics.test.ts — 32 passed.
    • pnpm tc:node — passed.
    • 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 and verifies Pi's extension installer is not called when Pi is disabled.

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

    Readiness checklist

    • Functional correctness: disabled agents receive no managed extensions.
    • Scope: only PTY extension selection and its 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughas_reproos:macos

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions