Repository navigation
fix(agent): show knowledge search from the first deferred step - #5681
Conversation
In deferred tool loading, an agent with a knowledge scope saw only the skill loader and tool search on its first step, so every answer started with a search for veryfront__search_knowledge. Add the knowledge search tool to the optional startup schemas when the knowledge source lists it. The name still passes the allow and deny selectors and the authorized catalog check, and the live steering refresh keeps it in the tool inventory while the refreshed catalog lists it. Drop toolLoading: "deferred" from the knowledge guide example.
A direct agent run (agent.generate or agent.stream) with a knowledge scope and deferred tool loading supplies no host bootstrap names, so the runtime bootstrapped only the trusted skill loader and kept veryfront__search_knowledge behind tool search. When the host supplies no names, add the agent's own knowledge search to the optional startup names. It is chosen by provenance: the framework knowledge tool in a tool record, or the framework knowledge source behind tools: true. A project tool or source with the same name never qualifies. The optional startup path still requires the step to authorize the tool and the provider schema limit to leave room for it.
The live steering refresh kept a startup tool in the deferred inventory only if the provider-capped catalog still held it. Deferred mode authorizes the whole catalog, so a large catalog could drop a late-sorting startup tool such as knowledge search from the refreshed inventory while its schema stayed loaded. Check membership against the uncapped catalog.
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
Deferred tools-true agents now show their scoped knowledge search up front, so the factory tests assert one schema at step 0 and a completed scoped call. Type the refresh test's tool parameters so the schema type stays literal.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9255afa73
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…ools The steering refresh decided whether tool search was needed from the capped catalog while retaining startup schemas from the uncapped one. With one provider slot, knowledge search could take it and drop tool search, leaving other authorized deferred tools unreachable. Deferred availability now uses the uncapped refreshed catalog, and retained startup schemas are best effort: like the startup assembly, they leave room for tool search and one discovered schema, so tool search wins the slot.
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|



Problem
With
toolLoading: "deferred", an agent that has aknowledgescope saw only the skill loader andveryfront__tool_searchon its first step.veryfront__search_knowledgewas authorized but deferred, so the agent started almost every answer with a tool search for its own knowledge tool.Cause
src/agent/hosted/chat-runtime-tool-assembly.tsbuilds the startup tool set (modelVisibleToolNames) from the skill loader, configuredbootstrapTools, the optional startup tools andveryfront__tool_search. The knowledge search tool was never added to that set. An existing test asserted that step one showed only["veryfront__tool_search"], which was the bug itself.agent.generate/agent.stream): no host supplies startup names, sosrc/agent/runtime/agent-runtime-step.tsused only the trusted skill loader. Knowledge search stayed behind tool search there too.default-project-steering-refresh.ts): when it rebuilt the tool inventory, it kept only skill-loader names. After a refresh, the prompt could say knowledge search was unavailable even though its schema was loaded.Change
veryfront__search_knowledge, the name is added to the optional startup names. That listing has already applied the allow and deny selectors. The existing optional-startup path still requires the name to be in the authorized catalog and respects provider slot reservation. Nothing changes when knowledge is off, the tool is denied, it is outside the allowed tools, or loading is eager.resolveTrustedKnowledgeToolNameinknowledge-tools.ts, picks it by provenance only: the framework knowledge tool in a tool record, or the framework knowledge source behindtools: true. A project tool or source with the same name never qualifies. The step must still authorize the tool, and the provider schema limit must leave room for it. Host-supplied startup names are not changed.veryfront__tool_search, stay in the refreshed inventory while the refreshed catalog lists them. This covers configuredbootstrapToolsas well as knowledge search. Membership is checked against the catalog before the provider schema cap, because deferred mode authorizes the whole catalog. When the assembly supplied no visible-tool list, behaviour is unchanged.docs/guides/project-knowledge.md):toolLoading: "deferred"is removed from the knowledge example, and one sentence now says knowledge search is visible from the first step under deferred loading.Tests
All runs used
deno task test:fileon a single file.src/agent/hosted/chat-runtime-tool-assembly.test.tsveryfront__create_filestays behind tool search.["veryfront__tool_search"]alone.src/agent/runtime/agent-runtime-step.test.tstools: true(visible);src/agent/hosted/default-project-steering-refresh.test.tsveryfront__search_knowledgewas missing. With the change: 1 passed (18 steps), 0 failed.deno fmtanddeno linton the changed files: clean.Review round
Not verified
--no-check, so types were not checked locally.default-chat-runtime.test.ts,chat-preparation.test.ts,factory.test.tsand the rest ofruntime/*.test.ts.