fix: remove explicit repo mount from pi-agent manifest and derive workspace name from remote URL

The pi-agent manifest still declared an explicit repo mount with
{{WORKSPACE_NAME}}, making the mount target dependent on tool config. The
instance service now synthesizes the repo mount, so the manifest no longer
needs the explicit mount.

- Add Alembic migration 2026_06_15_090500 to remove the source_type: repo
  mount from the built-in pi-agent manifest
- Add _get_repository_mount_name() helper to derive the workspace directory
  name from the repository remote URL (matching git clone behavior) and
  fall back to the user-provided repository name
- Use the helper for WORKSPACE_NAME/REPO_NAME in manifest, legacy dockerfile,
  and legacy compose template paths
- Update unit tests for the new migration and helper

Quality gates:
- pytest tests/unit: 218 passed
- ruff: clean on changed files
- mypy: clean on changed files
- alembic heads: single head
This commit is contained in:
Developer
2026-06-15 09:10:05 +00:00
parent f0ae9483f3
commit 6e33e8e4e9
29 changed files with 245 additions and 62 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
dir: openspec
## role
Defines the OpenSpec methodology and configuration for managing software requirements, specifications, and task tracking as living documentation within a project repository.
Defines a living documentation methodology and configuration framework for managing software requirements, specifications, and task tracking within a Docker-based coding agent platform.
## parent
index: ./.pi-map.index.md
map: ./.pi-map.md
+1 -1
View File
@@ -2,7 +2,7 @@
dir: openspec/changes
## role
Manages change tracking and history for OpenAPI specification modifications
Manages change tracking and versioning for OpenAPI specification modifications
## parent
index: openspec/.pi-map.index.md
map: openspec/.pi-map.md
@@ -2,7 +2,7 @@
dir: openspec/changes/fix-pi-container-mount-permissions
## role
Documents a bug fix for container mount path permissions in a Raspberry Pi agent development environment.
This is a change request/bug fix package for resolving filesystem permission issues with pi-agent container repository mounts and npm updates.
## parent
index: openspec/changes/.pi-map.index.md
map: openspec/changes/.pi-map.md
@@ -4,14 +4,14 @@ dir: openspec/changes/fix-pi-container-mount-permissions
index: openspec/changes/fix-pi-container-mount-permissions/.pi-map.index.md
## role
Documents a bug fix for container mount path permissions in a Raspberry Pi agent development environment.
This is a change request/bug fix package for resolving filesystem permission issues with pi-agent container repository mounts and npm updates.
## files
- change.md | Documents a bug fix for pi-agent container repository mount paths and npm update permissions in a containerized development environment. | dep: Alembic, Docker/container tooling, npm, Python (manifest_compiler.py, instance_service.py), pytest
- tasks.md | Tracks completion status of tasks for fixing a Pi container repository mount and npm update permissions issue
- change.md | Documents a bug fix for pi-agent container repository mount paths and npm update permissions involving multiple code changes across manifest compilation, instance service, and database migrations. | dep: Alembic, manifest_compiler.py, instance_service.py, pytest, ruff, mypy, npm
- tasks.md | Tracks completion status of tasks for fixing a pi container's repository mount and npm update permissions in a software project
## arch
Simple documentation-based change tracking using markdown files (change.md for specifications, tasks.md for progress tracking) without code implementation.
Issue-tracking documentation structure using lightweight markdown-based change management with separate change specification and task tracking files.
## tags
npm, tasks, container, repository, mount, update, permissions, change
npm, tasks, container, repository, mount, update, permissions, py
## symbols
-
## workflows
@@ -29,14 +29,19 @@ After implementing configurable tool container home directories, new `pi-agent`
- Do not create mount target directories or the `/workspace` symlink in the image when they depend on the runtime `{{WORKSPACE_NAME}}` placeholder.
- Remove any stale literal `{{WORKSPACE_NAME}}` directory left over from older images at container startup.
3. Update `instance_service.py` to pass `REPO_NAME` and `WORKSPACE_NAME` into manifest compilation.
4. Update unit tests for the new behavior.
4. Remove the explicit repo mount from the built-in `pi-agent` manifest so the repo mount is synthesized by `compile_compose` rather than depending on tool config. Add a follow-up Alembic data migration that strips the `source_type: repo` mount from the manifest.
5. Add `_get_repository_mount_name()` helper to derive the workspace directory name from the repository's remote URL (matching standard `git clone` behavior) and fall back to the user-provided repository name.
6. Update unit tests for the new behavior.
## Affected files
- `apps/api/alembic/versions/<new>_fix_pi_agent_home_directory_mount.py`
- `apps/api/alembic/versions/2026_06_14_182955_fix_pi_agent_home_directory_mount.py`
- `apps/api/alembic/versions/2026_06_15_090500_remove_pi_agent_explicit_repo_mount.py`
- `apps/api/src/services/build/manifest_compiler.py`
- `apps/api/src/services/tool/instance_service.py`
- `apps/api/tests/unit/test_manifest_compiler.py`
- `apps/api/tests/unit/test_instance_service.py`
- `apps/api/tests/unit/test_alembic_migrations.py`
## Verification
@@ -4,6 +4,8 @@
- [x] Create Alembic data migration to update pi-agent manifest
- [x] Update manifest_compiler.py: {{WORKSPACE_NAME}} substitution, env var, entrypoint runtime var, npm prefix
- [x] Update instance_service.py to pass REPO_NAME/WORKSPACE_NAME
- [x] Remove explicit repo mount from pi-agent manifest; synthesize mount in compile_compose
- [x] Add _get_repository_mount_name() helper to derive workspace name from remote URL
- [x] Update unit tests
- [x] Run quality gates (pytest unit, ruff, mypy)
- [ ] Commit and push