[Bug]: RepositoriesResource uses RepoManager with inconsistent base path (ignores RuntimeConfig.repos_base_path)
#640 创建于 2026年2月24日
仓库指标
- 星标
- (5,521 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Component/Module
Intelligence (Resources / Repo Management)
Feature Type
Bug Fix
Problem Statement
RepositoriesResource (used for codegen worktrees) constructs its own RepoManager instance without wiring in the runtime's configured repos_base_path. Other parts of the runtime (like RepositoryResource and parsing flows) construct RepoManager with repos_base_path=self._config.repos_base_path.
This mismatch means parsing may store and structure repositories under one .repos root folder, while codegen worktree creation looks under another, causing “repo not found” errors or duplicate local clones depending on configuration.
Proposed Solution
All runtime components that use RepoManager (parsing, repository info, volume metrics, codegen worktrees) must:
- Use the exact same base directory for repos and worktrees, derived from
RuntimeConfig.repos_base_path(or its environment/CLI equivalent). - Wire this configured path into
RepositoriesResource._get_repo_manager, rather than callingRepoManager()completely empty.
Current Implementation:
RepositoriesResource._get_repo_managerconstructsRepoManager()without passingrepos_base_path.- Consequently, its base path relies entirely on the
REPOS_BASE_PATHenvironment variable being set, or defaults to<project_root>/.repos. - Meanwhile, parsing/runtime operations use
RepoManager(repos_base_path=self._config.repos_base_path). - When
self._config.repos_base_pathdiffers from the env/default value, parsed repos land in one directory (e.g./mnt/potpie-repos/...), butRepositoriesResource.create_worktreelooks in another (e.g.<project_root>/.repos/...), causing “Repository X@ref not found” errors.
After this change:
RepositoriesResourceshould accept, resolve, and wire the unified configuration forrepos_base_pathuniformly.- When
RepositoriesResource.create_worktreeruns, it finds the base repo viaRepoManager.get_repo_path(...)correctly and isolates a worktree from the existing checkout without re-cloning or failing.
Use Case
Potpie deployments should predictably persist clones into their explicitly configured volumes (repos_base_path). Keeping paths uniform across the runtime is required to support correct codegen execution and worktree branching.
Additional Context
Where to look:
app/resources/repository.py(or similar file definingRepositoriesResource)- Find
RepositoriesResource._get_repo_managerand observe how it is constructed.
Skill level needed: Basic Python. No complex architectural knowledge is required, just pass the proper configuration around.
Feel free to comment if you have any questions before you start!