Skip to content

fix(chat): clear errors for a deleted project folder and Chat only's extension models (#1061, #804) - #1119

Open
agegr wants to merge 2 commits into
mainfrom
fix/clear-start-errors
Open

agegr wants to merge 2 commits into
mainfrom
fix/clear-start-errors

Conversation

@agegr

@agegr agegr commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Two cases where a send failed with a misleading error. Both share one client change: ensureNewSession() threw a bare HTTP 4xx/500; it now shows the server's error text.

#1061: prompt in a project folder deleted outside pi-web
Selecting such a session still starts its wrapper (the event stream does), and a prompt then went on to the model, whose tools all fail there (pi's write would even recreate the folder). The pi CLI refuses to resume such a session. The wrapper now refuses a prompt with "Directory does not exist: " (the text /api/agent/new already answers for a fresh composer); the composer shows it as a notice and keeps the draft. Viewing the session and its event stream still work; no access check changed.
Still as reported: the composer's "Model error: Directory does not exist…" (from /api/models), and New/Send stay enabled for the missing folder (Send now gets the clear refusal). A real "folder missing" state that disables them needs a missing-vs-denied probe with its own authorization tests.

#804: Chat only and models registered by extensions
Chat only loads no extensions (ADR 0002), so a provider an extension registers is missing from the session while the selector's listing still offers it. Picking one failed with a bare "Model not found", a model chosen in the composer was silently replaced at start, and a session left with no model failed with pi's "No API key found". All three now say <provider>/<model> is provided by an extension, and Chat only loads no extensions. Choose another model or tool preset. Chat only still loads no extensions. The selector still lists extension models under Chat only (a per-preset model list would be a bigger change).

Files: lib/rpc-manager.ts, hooks/useAgentSession.ts, docs/agents/sessions.md, docs/agents/tools.md.
Tests: lib/rpc-manager-lifecycle.test.mjs (real wrapper, folder deleted, prompt refused, wrapper alive, file unchanged), lib/rpc-manager-chat-only.integration.test.mjs (fails without the fix), hooks/useAgentSession.test.mjs. tsc, eslint, full npm test (2680 pass).

Closes #804
Refs #1061

🤖 Generated with Claude Code

agegr and others added 2 commits October 9, 2026 02:10
…ssage (#1061)

A session whose cwd was deleted outside pi-web still starts its wrapper
(selecting it opens the event stream), and a prompt then went on to the
model, whose tools all fail there; pi's write tool would even recreate
the folder. The pi CLI does not resume such a session. The wrapper now
refuses the prompt with "Directory does not exist: <cwd>", the text
/api/agent/new already answers for a fresh composer, and the composer
keeps the draft.

That answer never reached the user either: ensureNewSession() threw a
bare "HTTP 400". It now passes the server's error on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chat only loads no extensions, so providers they register are missing from
the session while the model selector's listing still offers them. Picking
one failed with a bare "Model not found", a chosen model was silently
replaced at start, and a session left with no model at all failed with
pi's "No API key found".

The session now names the model as an extension's that Chat only cannot
load: set_model and a start with the chosen model refuse it, and a prompt
in a session that could start on no model names the one it wanted. The
composer shows the server's reason when creating the session fails. Chat
only still loads no extensions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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: "Chat only" tool preset drops extension-registered model providers, so sending fails with "Model not found"

1 participant