potpie-ai/potpie

[Bug]: RepositoriesResource uses RepoManager with inconsistent base path (ignores RuntimeConfig.repos_base_path)

Open

#640 opened on Feb 24, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Python (642 forks)auto 404
good first issue

Repository metrics

Stars
 (5,521 stars)
PR merge metrics
 (PR metrics pending)

Description

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:

  1. Use the exact same base directory for repos and worktrees, derived from RuntimeConfig.repos_base_path (or its environment/CLI equivalent).
  2. Wire this configured path into RepositoriesResource._get_repo_manager, rather than calling RepoManager() completely empty.

Current Implementation:

  • RepositoriesResource._get_repo_manager constructs RepoManager() without passing repos_base_path.
  • Consequently, its base path relies entirely on the REPOS_BASE_PATH environment 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_path differs from the env/default value, parsed repos land in one directory (e.g. /mnt/potpie-repos/...), but RepositoriesResource.create_worktree looks in another (e.g. <project_root>/.repos/...), causing “Repository X@ref not found” errors.

After this change:

  • RepositoriesResource should accept, resolve, and wire the unified configuration for repos_base_path uniformly.
  • When RepositoriesResource.create_worktree runs, it finds the base repo via RepoManager.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 defining RepositoriesResource)
  • Find RepositoriesResource._get_repo_manager and 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!

Contributor guide