Skip to content

fix(pi): respect per-agent disabled state when installing status hook extensions - #7817

Closed
bbingz wants to merge 4 commits into
stablyai:mainfrom
bbingz:fix/pi-disabled-extensions
Closed

bbingz wants to merge 4 commits into
stablyai:mainfrom
bbingz:fix/pi-disabled-extensions

Conversation

@bbingz

@bbingz bbingz commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When agentStatusHooksEnabled is true globally, Orca was still installing managed status hook extensions (orca-*.ts) into ~/.pi/agent/extensions (and the OMP equivalent) even if the user disabled Pi/OMP under Settings → Agents.

buildPtyHostEnv now gates Pi and OMP extension install with isTuiAgentEnabled(...), and all spawn call sites forward disabledTuiAgents from settings.

Fixes #7814

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed
    • vitest run src/main/ipc/pty.test.ts -t "skips Pi managed extensions|skips OMP managed extensions|installs Pi managed extensions" (4 passed)

AI Review Report

Scoped change in buildPtyHostEnv + settings plumbing. Checked:

  • macOS / Linux / Windows: same Settings → Agents disabledTuiAgents list; no platform-specific branching.
  • SSH / remote / local: uses existing buildPtyHostEnv on local, daemon, and related spawn paths that already pass settings.
  • Agents: only Pi and OMP managed titlebar/status extension install is gated; other agents unchanged.
  • Performance: one isTuiAgentEnabled check per spawn when hooks are enabled.

Security Audit

  • No new IPC surface; only forwards existing disabledTuiAgents settings into host env construction.
  • Reduces unexpected filesystem writes into ~/.pi / ~/.omp when the user disabled those agents.
  • No secrets, auth, or path traversal changes.

Notes

  • Current merge base: origin/main@0b65d725c98d.
  • Platform-agnostic; follows per-agent disable list already used elsewhere in the app.

ELI5

Even if you disabled Pi/OMP under Agents, Orca still installed status hook files for them. Hooks now respect the per-agent disabled setting when the global toggle is on.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds a disabledTuiAgents option to PTY host environment construction in src/main/ipc/pty.ts. The buildPtyHostEnv function now imports and uses isTuiAgentEnabled to conditionally gate injection of Pi and OMP managed extension environments, replacing previously unconditional injection logic. The new option is wired into three buildPtyHostEnv call sites: the LocalPtyProvider spawn path and two locations in the daemon-host spawn path, each passing the user's disabled agents setting from getSettings.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change satisfies #7814 by skipping Pi extension installation when Pi is disabled via Settings > Agents.
Out of Scope Changes check ✅ Passed The OMP gating and tests are a reasonable generalization of the same fix, not unrelated scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly describes the main change: honoring per-agent disabled state when installing status hook extensions.
Description check ✅ Passed The description includes all required sections and adequately covers summary, testing, AI review, security, and notes.

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.

@bbingz

bbingz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest origin/main (clean). Added regression tests for Pi/OMP extension skip when disabledTuiAgents includes that agent. Focused vitest green. Heads: e1bb6be47 + test commit.

@bbingz

bbingz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Correction: rebased tip is b28539e91 (fix + regression tests). ahead=2 behind=0 vs main.

bbingz added a commit to bbingz/orca that referenced this pull request Jul 10, 2026
Regression tests for stablyai#7814 / stablyai#7817: with global agent status hooks on,
disabledTuiAgents must prevent managed orca-*.ts extension install into
~/.pi and ~/.omp.
@bbingz
bbingz force-pushed the fix/pi-disabled-extensions branch from b28539e to 096790a Compare July 10, 2026 10:08
@bbingz

bbingz commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bbingz
bbingz force-pushed the fix/pi-disabled-extensions branch from 85b1762 to 7637a4e Compare July 14, 2026 00:20
bbingz added a commit to bbingz/orca that referenced this pull request Jul 14, 2026
Regression tests for stablyai#7814 / stablyai#7817: with global agent status hooks on,
disabledTuiAgents must prevent managed orca-*.ts extension install into
~/.pi and ~/.omp.
@bbingz
bbingz force-pushed the fix/pi-disabled-extensions branch from 7637a4e to 8037d92 Compare July 14, 2026 00:37
@brennanb2025

Copy link
Copy Markdown
Contributor

Taking a look!

@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
@bbingz
bbingz force-pushed the fix/pi-disabled-extensions branch from 823be4d to ba94c0f Compare July 31, 2026 01:27
@greptile-apps

greptile-apps Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR fixes a bug where Pi and OMP status hook extensions (orca-*.ts) were written into ~/.pi and ~/.omp even when the user had disabled those agents under Settings → Agents, because buildPtyHostEnv only checked the global agentStatusHooksEnabled flag and not the per-agent disabled list.

  • Core fix: Two if guards in buildPtyHostEnv now gate Pi and OMP extension installation on isTuiAgentEnabled(agent, opts.disabledTuiAgents) in addition to the existing agentStatusHooksEnabled outer check.
  • Call sites: All three buildPtyHostEnv invocations in registerPtyHandlers (local spawn, daemon, and hosted spawn paths) are updated to forward getSettings?.()?.disabledTuiAgents.
  • Tests: Two new focused test cases verify that piBuildPtyEnvMock is not called for a disabled agent while the other agent's shadow prep still runs correctly.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to gating filesystem writes for Pi/OMP extensions when those agents are disabled, with no risk to unrelated agents or hook infrastructure.

The fix is minimal: two boolean guards added inside an already-guarded block, forwarding an existing settings field through three call sites. isTuiAgentEnabled correctly handles null/undefined as nothing disabled, preserving default behavior. All three buildPtyHostEnv call sites are updated with no others missed.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
src/main/ipc/pty.ts Adds disabledTuiAgents to BuildPtyHostEnvOptions and gates Pi/OMP extension installation with isTuiAgentEnabled checks; all three buildPtyHostEnv call sites updated consistently.
src/main/ipc/pty.test.ts Adds disabledTuiAgents to the getSettings mock type and two new test cases covering Pi-disabled and OMP-disabled scenarios; correctly relies on isAgentStatusHooksEnabled defaulting to true when the field is absent.

Reviews (2): Last reviewed commit: "fix(pty): type disabledTuiAgents as TuiA..." | Re-trigger Greptile

Comment thread src/main/ipc/pty.ts Resolved
@bbingz
bbingz force-pushed the fix/pi-disabled-extensions branch from 858eab7 to 07e6711 Compare July 31, 2026 02:36
bbingz and others added 4 commits August 4, 2026 08:47
… extensions

When `agentStatusHooksEnabled` was true, Orca would still install the
managed `orca-*.ts` extension files into `~/.pi/agent/extensions` (and the
OMP equivalent) even if the user had explicitly disabled the Pi agent in
Settings > Agents.

This happened because `buildPtyHostEnv` defaulted `piAgentKind` to "pi"
for nearly all local PTY spawns (everything that was not OMP) and would
unconditionally call `piTitlebarExtensionService.buildPtyEnv` as long as
the global hooks flag was set. There was no check against the per-agent
`disabledTuiAgents` list from user settings.

We now guard both the Pi and OMP extension installation paths with
`isTuiAgentEnabled(...)`, and forward `disabledTuiAgents` from settings in
all three call sites of `buildPtyHostEnv`.

Fixes stablyai#7814
Regression tests for stablyai#7814 / stablyai#7817: with global agent status hooks on,
disabledTuiAgents must prevent managed orca-*.ts extension install into
~/.pi and ~/.omp.
Main's bare-shell shadow prep now passes materializeDefaultHome; keep
the stablyai#7814 disabled-Pi assertion on that contract.
BuildPtyHostEnvOptions already imports TuiAgent; use it so callers get a
compile-time check instead of silently dropping unknown values.
@bbingz
bbingz force-pushed the fix/pi-disabled-extensions branch from fdb1a86 to 5f67233 Compare August 4, 2026 00:48
@bbingz

bbingz commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Closing as part of fork PR backlog cleanup. Long-conflicted against current main; reopen if still needed.

@bbingz bbingz closed this Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants