fix/exa: avoid duplicate adapter tool registration #11

Merged
BlackHatMagic merged 1 commit from fix/exa-duplicate into master 2026-11-03 10:45:28 +00:00

Summary

  • Fix the Pi Chat 0.4.3 startup crash when pi-exa is already installed/configured in Pi.
  • Start with normal extensions and query get_commands for exa-status. Reuse the loaded adapter; only restart the same session with the pinned fallback if absent.
  • Avoid parsing or modifying user/project settings, disabling unrelated extensions, or relying on installation paths.
  • Preserve tree navigation, adapter preferences, and session IDs.
  • Add child-process regressions for fresh and existing adapters across startup, restart, and new chat; the fixture exits on duplicate adapter loading.

Closes #10

Verification

  • bun run check: TypeScript checks and all 43 tests pass.
  • bun run build and git diff --check pass.
  • Real PiSession/CLI integration checks with separate temporary agent directories: existing npm:pi-exa and fresh fallback both reached Ready, preserved tree navigation, and passed /exa-status live MCP checks with no stored/environment Exa API key.

Trade-off

Fresh configurations start Pi once to inspect loaded extensions, then restart the same session with the fallback. Existing installations need only one startup. This uses Pi’s actual resource resolution rather than trying to replicate npm/git/local/project settings semantics.

A follow-up 0.4.4 patch release will ship this fix.

## Summary - Fix the Pi Chat 0.4.3 startup crash when pi-exa is already installed/configured in Pi. - Start with normal extensions and query get_commands for exa-status. Reuse the loaded adapter; only restart the same session with the pinned fallback if absent. - Avoid parsing or modifying user/project settings, disabling unrelated extensions, or relying on installation paths. - Preserve tree navigation, adapter preferences, and session IDs. - Add child-process regressions for fresh and existing adapters across startup, restart, and new chat; the fixture exits on duplicate adapter loading. Closes #10 ## Verification - bun run check: TypeScript checks and all 43 tests pass. - bun run build and git diff --check pass. - Real PiSession/CLI integration checks with separate temporary agent directories: existing npm:pi-exa and fresh fallback both reached Ready, preserved tree navigation, and passed /exa-status live MCP checks with no stored/environment Exa API key. ## Trade-off Fresh configurations start Pi once to inspect loaded extensions, then restart the same session with the fallback. Existing installations need only one startup. This uses Pi’s actual resource resolution rather than trying to replicate npm/git/local/project settings semantics. A follow-up 0.4.4 patch release will ship this fix.
Check the running Pi command catalog instead of unconditionally loading a second copy of pi-exa. Preserve package sources, filters, project trust, and user preferences without interpreting or changing settings.

Closes #10
Code-Reviewer left a comment

Pi code review

0 new actionable findings

No new actionable findings. Previously reported issues, if any, are tracked below.

Reviewed the probe-and-fallback startup change and its lifecycle coverage against the supplied base. Verification was limited to repository inspection; tests and live Pi integration checks were not run.

Change walkthrough
Area Files Changes
Other code (1) src/session.ts Probe loaded commands before restarting with the pinned Exa fallback when needed.
Tests (2) tests/fixtures/pi-rpc.cjs, tests/session.test.ts Record launches and simulate existing and fallback adapters, including duplicate-loading failure. Cover adapter loading across startup, restart, and new chat.
Documentation (1) README.md Document reuse of an existing adapter and invocation-scoped fallback loading.

Review effort: 3/5.

Static observations (not validation results)
Observation Detail
Diff size 4 files, +54/-22.
Binary changes No binary changes reported by this diff.
Credential patterns No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit.

Reviewed 1ff4c2f84477a10afec0be77b4f64870eed4b3b8 with proxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra. Automated advisory review; no project commands or tests were executed.

<!-- forgejo-pi-review:bb9287459ab679e1b71b0839ddabf53213ca8c92b2a74018e7d5a683314ae738 --> ## Pi code review **0 new actionable findings** No new actionable findings. Previously reported issues, if any, are tracked below. Reviewed the probe-and-fallback startup change and its lifecycle coverage against the supplied base. Verification was limited to repository inspection; tests and live Pi integration checks were not run. <details> <summary>Change walkthrough</summary> | Area | Files | Changes | | --- | --- | --- | | Other code (1) | `src/session.ts` | Probe loaded commands before restarting with the pinned Exa fallback when needed. | | Tests (2) | `tests/fixtures/pi-rpc.cjs`, `tests/session.test.ts` | Record launches and simulate existing and fallback adapters, including duplicate-loading failure. Cover adapter loading across startup, restart, and new chat. | | Documentation (1) | `README.md` | Document reuse of an existing adapter and invocation-scoped fallback loading. | Review effort: **3/5**. </details> <details> <summary>Static observations (not validation results)</summary> | Observation | Detail | | --- | --- | | Diff size | 4 files, +54/-22. | | Binary changes | No binary changes reported by this diff. | | Credential patterns | No matches after excluding known examples/placeholders. Added-line heuristics only; not a security audit. | </details> --- Reviewed `1ff4c2f84477a10afec0be77b4f64870eed4b3b8` with `proxy/glm-5.3-flash + proxy/deepseek-v4.1-flash + proxy/gpt-6.1-sol → proxy/gpt-6.1-terra`. Automated advisory review; no project commands or tests were executed.
Author
Owner

Current head 1ff4c2f844 reviewed with 0 actionable findings. All 43 tests, typecheck, production build, and diff checks pass. Real PiSession/CLI checks passed for both existing npm:pi-exa and fresh fallback configurations with keyless MCP access. No remote CI statuses reported. Squash-merging for the 0.4.4 patch release.

Current head 1ff4c2f84477a10afec0be77b4f64870eed4b3b8 reviewed with 0 actionable findings. All 43 tests, typecheck, production build, and diff checks pass. Real PiSession/CLI checks passed for both existing npm:pi-exa and fresh fallback configurations with keyless MCP access. No remote CI statuses reported. Squash-merging for the 0.4.4 patch release.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
BlackHatMagic/Pi-Obsidian!11
No description provided.