Fix triage agent cloning to wrong path - #670
Conversation
Reject clone_path values outside the shared GIT_REPO_BASEPATH volume (/git-repos) with a clear ToolError, preventing agents from cloning into container-local paths like /tmp that are invisible to other containers. The guard resolves both sides (Path.resolve) to block ".." traversal attacks, and runs before clean_stale_repositories to skip unnecessary I/O on invalid paths. Also updates the clone_path field description to mention the /git-repos constraint. Assisted-by: Claude (Cursor)
Instruct the LLM to pass clone_path=/git-repos/<issue>/<package> when calling clone_repository, so cloned repos land on the shared volume visible to both the agent and MCP gateway containers. Previously the prompt omitted clone_path, letting the model pick arbitrary locations like /tmp that only exist inside the gateway. Assisted-by: Claude (Cursor)
PR Summary by QodoGuard triage clone_repository to always use shared /git-repos path
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
There was a problem hiding this comment.
Code Review
This pull request updates the triage prompt to specify a clone path under the shared volume and implements path validation in the CloneRepositoryTool to prevent path traversal. Unit tests are also added to verify this validation. The feedback recommends strengthening the path validation to reject cases where the target path is exactly equal to the base path, preventing cloning directly into the root of the shared volume, and adding a corresponding test case.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Disallow clone_path == GIT_REPO_BASEPATH itself (e.g. /git-repos) to prevent creating .git in the shared volume root. Assisted-by: Claude (Cursor)
Code Review by Qodo
Context used✅ Compliance rules (platform):
7 rules 1.
|
The triage agent's
clone_repositorycalls occasionally clone repos into/tmpinside the MCP gateway container. Since/tmpis not shared between the gateway and agent containers (only/git-reposis a shared PVC), the agent can't see the cloned repo and fails with "file not found" errors, wasting LLM tokens on recovery attempts.Two-layer fix — prompt guidance (soft) + runtime guard (hard):
triage/prompt.j2to explicitly instruct the LLM to passclone_path=/git-repos/<issue>/<package>when callingclone_repository, matching the convention already used by the backport agent.CloneRepositoryTool._run()that rejects anyclone_pathoutsideGIT_REPO_BASEPATHwith a clearToolError. UsesPath.resolve()on both sides to block..traversal. Runs beforeclean_stale_repositories()to skip unnecessary I/O on invalid requests.clone_pathschema description to mention the/git-reposconstraint, giving the LLM an additional signal via the tool schema.