diff --git a/docs/architecture/orchestrator.md b/docs/architecture/orchestrator.md index 0f4a863248..7c7dce344d 100644 --- a/docs/architecture/orchestrator.md +++ b/docs/architecture/orchestrator.md @@ -38,6 +38,31 @@ This differs from agent worktrees (managed by the gateway for agent isolation). See `orchestrator/state_store.py` for implementation details. +## Per-Pipeline Worktrees + +The orchestrator reads pipeline artifacts (verdict files, draft documents, check results) from per-pipeline worktrees created by the gateway. These worktrees isolate work for each pipeline and are separate from both the orchestrator's state worktree and the main repository working directory. + +**Architecture:** +- Gateway creates worktrees at `/home/egg/.egg-worktrees/{pipeline-id}/{repo-name}/` +- Agent containers mount these worktrees and write artifacts to them +- Orchestrator mounts `/home/egg/.egg-worktrees` and reads artifacts from pipeline-specific paths +- Worktree paths are resolved dynamically based on pipeline ID and repository + +**Key artifact files in worktrees:** +- `.egg-state/contracts/{issue}.json` — Contract state +- `.egg-state/drafts/{issue}-analysis.md` — Draft for `refine` phase (special-cased to `analysis`) +- `.egg-state/drafts/{issue}-{phase}.md` — Draft for other phases (e.g., `plan`). No draft for `implement` phase. +- `.egg-state/reviews/{issue}-{phase}-{reviewer_type}-review.json` — Review verdict files +- `.egg-state/checks/implement-results.json` — Check results from the `implement` phase + +**Volume mounts:** +- Orchestrator: Bind mount from `${HOST_HOME}/.egg-worktrees` to `/home/egg/.egg-worktrees` (read container-written artifacts) +- Integration tests: Named volume `worktrees` (no host filesystem in CI) + +This architecture ensures the orchestrator reads artifacts from the correct isolated workspace rather than the main repository, preventing cross-contamination between pipelines. + +See `orchestrator/routes/pipelines.py:WORKTREE_BASE_DIR` and `gateway/worktree_manager.py` for implementation details. + ## Deployment Modes egg supports three deployment modes, each suited to different use cases: diff --git a/docs/guides/deployment.md b/docs/guides/deployment.md index 8e61158e00..4eb84cdcc9 100644 --- a/docs/guides/deployment.md +++ b/docs/guides/deployment.md @@ -70,7 +70,7 @@ egg --public # Set your user identity and home directory HOST_UID=$(id -u) HOST_GID=$(id -g) - HOST_HOME=$HOME # REQUIRED for worktree bind mounts + HOST_HOME=$HOME # REQUIRED: orchestrator mounts $HOST_HOME/.egg-worktrees to read pipeline artifacts ``` 3. **Create repositories.yaml:**