fix: improve agent prompts, extract path autofix, and Gemini v3 upgrade#492
Merged
fix: improve agent prompts, extract path autofix, and Gemini v3 upgrade#492
Conversation
…pe+customPrompt together - Update bash tool description to explicitly forbid code exploration (grep, cat, find, etc.) - Add anti-bash instruction #7 to commonInstructions in getSystemMessage() - Add anti-bash guidance to Claude and Codex native system prompts - Support both promptType and customPrompt simultaneously: predefined prompt as base + custom wrapped in <custom-instructions> tag - When only customPrompt is set (no promptType), don't append commonInstructions since custom prompts are self-contained Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gemini 3.x models require thought_signature to be round-tripped in function call conversation history. @ai-sdk/google v2 stripped these out, causing 400 errors. v3.0.0+ preserves them correctly. Fixes: "Function call is missing a thought_signature in functionCall parts" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When search returns relative paths (e.g., "gateway/file.go") and the model constructs wrong absolute paths by prepending the workspace root instead of the project subdirectory (e.g., /workspace/gateway/file.go instead of /workspace/tyk/gateway/file.go), the extract tool now auto-corrects by trying each allowedFolder as an alternative base path. This was causing extract to fail 3x in a row, making models fall back to bash cat for file reading. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8 tests covering the workspace subdirectory path correction: - Missing project subdirectory fix - Line number and symbol suffix preservation - Nested paths, multiple targets, multiple allowedFolders - No-op for correct paths and unfixable paths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Based on real trace analysis showing delegates making 29 searches for one term with case/path variations. Key additions: - "When to use exact=true" section for known symbol lookups - BAD examples from real traces: case variations (limitDRL/LimitDRL), snake_case variations, same query on different paths, full function signature searches - GOOD examples: exact=true for symbol names like ForwardMessage - Clarify that changing path does NOT bypass dedup - "Do NOT search full signatures, just use exact=true with method name" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
SummaryThis PR addresses multiple issues discovered through Jaeger trace analysis of agent behavior, focusing on four main areas: 1. Anti-Bash Guidance for Code Exploration
2. Extract Path Auto-Fix
3. Search Delegate Prompt Improvements
4. @ai-sdk/google v3 Upgrade
5. promptType + customPrompt Combination
Files Changed Analysis
Total: +262 additions, -19 deletions across 5 files Architecture & Impact Assessmentflowchart TD
subgraph "Agent System"
PA[ProbeAgent.js]
PA --> SP[System Prompts]
PA --> DP[Delegate Prompts]
end
subgraph "Tools Layer"
CJ[common.js]
VJ[vercel.js]
VJ --> ET[extractTool]
VJ --> SD[Search Delegate]
end
subgraph "External"
GEM[Gemini API]
PKG[package.json]
end
SP --> |Anti-bash guidance| CJ
DP --> |exact=true + BAD examples| SD
ET --> |Path autofix| AF[allowedFolders check]
PKG --> |v3 upgrade| GEM
Key Technical Changes
Affected Components
Scope Discovery & Context ExpansionRelated Files to Consider
Testing Coverage
Labels
Metadata
Powered by Visor from Probelabs Last updated: 2026-03-06T19:18:47.683Z | Triggered by: pr_opened | Commit: c6c08bb 💡 TIP: You can chat with Visor using |
Contributor
Security Issues (1)
Architecture Issues (1)
Performance Issues (1)
Powered by Visor from Probelabs Last updated: 2026-03-06T18:54:14.104Z | Triggered by: pr_opened | Commit: c6c08bb 💡 TIP: You can chat with Visor using |
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
gateway/file.go) and model constructs wrong absolute paths by prepending workspace root instead of project subdirectory, extract now auto-corrects by checkingallowedFoldersexact=trueguidance for symbol lookups, BAD examples from real traces (case variations, path hopping, full signature searches)thought_signatureround-tripping error (Function call is missing a thought_signature in functionCall parts)Evidence from trace analysis
Before fixes, explore-code session #2 had 9 bash
catcalls because extract failed with wrong paths. Delegate #8 made 29 redundant searches for "ThrottleRetryLimit" with case/path variations./workspace/gateway/file.goinstead of/workspace/tyk/gateway/file.goallowedFolderbash catafter extract failsexact=trueguidancelimitDRL→LimitDRLcase variations"func (k *Type) Method()"exact=true "Method"insteadTest plan
🤖 Generated with Claude Code