fix: filter unregistered profile tools from active set and improve missing tool error#228
fix: filter unregistered profile tools from active set and improve missing tool error#228LifeJiggy wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 144340f The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53daca0daf
ℹ️ 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".
When setActiveTools() is called before initializeBuiltinTools() (e.g. profile applied before model config lands), every builtin name was silently dropped because �uiltinTools was empty. - Save pending builtin names in pendingBuiltinToolNames instead of warning immediately when �uiltinTools.size === 0 - Reapply pending names inside initializeBuiltinTools() after the builtins map is populated; warn only for tools still genuinely missing - Reset pendingBuiltinToolNames when a subsequent setActiveTools call resolves all names
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 144340ff1f
ℹ️ 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".
| if (this.pendingBuiltinToolNames.length > 0) { | ||
| const nowAvailable = this.pendingBuiltinToolNames.filter( | ||
| (name) => this.builtinTools.has(name) || this.userTools.has(name), | ||
| ); | ||
| if (nowAvailable.length > 0) { | ||
| for (const name of nowAvailable) { | ||
| this.enabledTools.add(name); |
There was a problem hiding this comment.
Replay pending tools before constructing background-capable tools
When a profile is applied before builtins are initialized, setActiveTools now leaves enabledTools empty and stores TaskList/TaskOutput/TaskStop in pendingBuiltinToolNames. This replay happens only here, after initializeBuiltinTools() has already computed allowBackground and constructed BashTool/AgentTool, so fresh sessions that configure the model after applying the default profile still expose the task tools but permanently reject run_in_background=true as unavailable. Move the replay (or compute allowBackground from pending names too) before constructing those tools.
Useful? React with 👍 / 👎.
Related Issue
Resolve #127
Problem
When a profile includes tools that require service configuration (e.g.
WebSearchrequiresmoonshotSearch), self-hosted users without that service see confusing "Tool not found" errors at runtime. The unavailable tools also appear in the LLM's tool list, wasting context and causing failed calls.What changed
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.