Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/architecture/orchestrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**
Expand Down