fix(agent): always fetch latest custom tool from DB when customToolId is present#3208
Merged
waleedlatif1 merged 4 commits intostagingfrom Feb 12, 2026
Merged
fix(agent): always fetch latest custom tool from DB when customToolId is present#3208waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryThis PR fixes a critical version mismatch issue where the LLM received stale inline tool schemas while execution validated against the latest database schema. The fix ensures the database is always the single source of truth when Key changes:
Testing:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Agent as AgentBlockHandler
participant CT as createCustomTool
participant DB as fetchCustomToolById
participant LLM as LLM Provider
Agent->>CT: createCustomTool(tool)
alt customToolId present
CT->>DB: fetchCustomToolById(customToolId)
alt DB fetch succeeds
DB-->>CT: {schema, code, title}
Note over CT: Use DB schema & code<br/>(always latest)
else DB fetch fails
DB-->>CT: null
alt inline schema exists
Note over CT: Fallback to inline schema
else no inline schema
CT-->>Agent: return null
end
end
else no customToolId
Note over CT: Use inline schema & code
end
CT->>CT: filterSchemaForLLM(schema)
CT-->>Agent: tool definition
Agent->>LLM: executeProviderRequest(tools)
alt LLM calls tool
LLM-->>Agent: tool call
Agent->>CT: executeFunction(params)
Note over CT: Execute with DB code<br/>(same source as schema)
end
|
17cc5f7 to
273a0be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
customToolIdis present, even if inline schema existsType of Change
Testing
Checklist