Files
plugins/packages/agy-cli/test
yetone 60acd62bee agy-cli: a tool loaded mid-turn starts a new prompt with the round replayed (#942)
agy checks each call against the tools it listed before the prompt began.
After ToolSearch loads a deferred tool, the client's next request declares
it, and the bridge sent tools/list_changed and then continued the same
session/prompt. agy's validator still answered `unknown tool: "<name>" —
check spelling` for the rest of that prompt.

When the tool-result request declares a tool the process has not listed
(Proc.toolsGrew), the bridge now takes the existing changed-context path:
it drops the process without resolving its calls and replays the history,
the ToolSearch tool_use and its tool_result included, in a new
session/prompt, where agy lists the full catalog first. The user's turn is
in the replayed history once. The new process starts with the grown
catalog, so the next result continues it live and nothing loops. A catalog
that only loses or changes tools still continues the live turn.

Tests (test/smoke.mjs, fake agy): TOOLSEARCHGROW checks calls against the
tools listed at prompt start, like agy 1.5.3. The new block checks that the
grown catalog starts a new session/prompt, that it replays the ToolSearch
round with the user's ask once, that the old prompt never reaches the
validator with the new tool, that the loaded tool's call reaches the client,
and that its result continues the new session with no second replay. The
"live tools change" case now removes a tool instead of adding one.

Run on mote (Bun 1.4.2), at this tree:
- packages/agy-cli `bun test`: 8 pass, 0 fail; smoke.mjs ALL OK (319 checks).
- `bun scripts/check.mjs agy-cli`: registry.json and agy-cli ok.
Broken by hand: sed removed `|| proc.toolsGrew(tools)` from the condition;
smoke.mjs went 5 FAILURES (319 checks), the five new checks; restored, ALL OK.

Not run: the root `bun test`. It waited behind about 20 queued suites on
mote's suite.lock for over an hour, and WSL answered E_UNEXPECTED.
Not tried: a real agy 1.5.3 run.

Version 0.1.4.

Reported-by: chrisjian <chrisjian@users.noreply.github.com>
2026-11-11 03:11:42 +08:00
..