Files
lorenzozane 0e37a385e6 fix(pi-local): avoid embedding model catalogue in errors (#13628)
<!-- Write all pull request text in Simplified Technical English
(ASD-STE100): short sentences, one instruction per sentence, simple
approved vocabulary, and the active voice. -->

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The pi-local adapter discovers and validates models before it starts
a local Pi process
> - An unavailable-model error included model IDs from the discovered
catalogue
> - Repeating those IDs made persisted and rendered failures noisy and
exposed substitute choices
> - This pull request keeps the requested model, reports the available
count, and points to the existing lookup command
> - The benefit is a concise error without changing model discovery or
matching

## Linked Issues or Issue Description

Fixes #13612

## What Changed

- Replace model catalogue interpolation in unavailable-model errors with
the requested model, normalized model count, and `pi --list-models`.
- Add a regression test with 13 discovered models and exact
error-message matching.

## Verification

- `pnpm exec vitest run
packages/adapters/pi-local/src/server/models.test.ts`
- `pnpm exec vitest run packages/adapters/pi-local/src/server/*.test.ts`
- `pnpm --filter @paperclipai/adapter-pi-local typecheck`
- `git diff --check`

All listed checks pass locally. The test suite uses a temporary Pi
executable and verifies that model IDs are not appended to the error.

## Risks

Low risk. Only unavailable-model error wording changes. Model discovery,
matching, valid model execution, and failure handling remain unchanged.
Full repository CI was not run locally because the host uses Node
22.22.1 and the repository declares Node >=24.11.0.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

OpenAI GPT-5.6 Luna (`gpt-5.6-luna`); tool-assisted code execution. The
context window size is not exposed in this session.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [ ] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub #13612)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-10-10 10:48:00 -05:00
..