Skip to content

feat(api-rs): set CENTAUR_OVERLAY_DIR for repo-cache overlay delivery - #10

Open
tarrencev wants to merge 1 commit into
mainfrom
feat/overlay-dir-repo-cache
Open

tarrencev wants to merge 1 commit into
mainfrom
feat/overlay-dir-repo-cache

Conversation

@tarrencev

Copy link
Copy Markdown
Collaborator

Problem

Centaur has two overlay-delivery modes:

  • overlay image — the chart sets CENTAUR_OVERLAY_DIR on the api-rs container.
  • repo-cache — the repoCache DaemonSet clones repos that api-rs mounts into sandboxes at /home/agent/github/<owner>/<repo>.

Under repo-cache mode, CENTAUR_OVERLAY_DIR is never set in the sandbox. The sandbox entrypoint already consumes $CENTAUR_OVERLAY_DIR (services/sandbox/entrypoint.sh: .agents/skills copy + services/sandbox/SYSTEM_PROMPT.md append, with comments describing exactly this case), so those branches silently no-op and any $CENTAUR_OVERLAY_DIR/... reference resolves to the wrong path. (This bit a downstream overlay that shipped sandbox-side files referenced via $CENTAUR_OVERLAY_DIR.)

Fix

Add an explicit overlay-repo slug and have api-rs inject CENTAUR_OVERLAY_DIR = /home/agent/github/<slug> into the codex sandbox env when set — giving overlay files one stable base path in both delivery modes.

  • args.rs: --overlay-repo / CENTAUR_OVERLAY_REPO on SandboxArgs; overlay_dir_in_repo_cache() (reuses SANDBOX_REPOS_MOUNT_PATH + clean_optional_value); inject CENTAUR_OVERLAY_DIR before the operator extra-env merge, guarded by a not-already-present check so SESSION_SANDBOX_EXTRA_ENV still wins.
  • chart: overlay.repo value + a guarded CENTAUR_OVERLAY_REPO env block on api-rs (the existing image-mode CENTAUR_OVERLAY_DIR block is untouched).

Backward compatibility

overlay.repo empty ⇒ no env emitted ⇒ identical behavior to today. Image-mode and the unset case are unchanged; the entrypoint is unchanged. Operators must also add the overlay repo to repoCache.repositories (api-rs only points at the path).

Tests

New args.rs unit tests (via a clap Parser wrapper): slug→clone-path mapping incl. unset/empty/slashes-only; codex env template includes/omits CENTAUR_OVERLAY_DIR. cargo fmt --all --check, clippy --workspace --all-targets -- -D warnings, and cargo test -p centaur-api-server all pass.

🤖 Generated with Claude Code

Centaur supports two overlay-delivery modes: an overlay image (the chart
sets CENTAUR_OVERLAY_DIR on the api-rs container) and the repo-cache
route (the repoCache DaemonSet clones repos that api-rs mounts into
sandboxes at /home/agent/github/<owner>/<repo>). Under repo-cache mode
CENTAUR_OVERLAY_DIR was never set in the sandbox, so the entrypoint's
overlay branches (.agents/skills copy, services/sandbox/SYSTEM_PROMPT.md
append) were silently skipped and any $CENTAUR_OVERLAY_DIR-relative
reference resolved to the wrong path.

Add an explicit overlay-repo slug and have api-rs inject
CENTAUR_OVERLAY_DIR = /home/agent/github/<slug> into the codex sandbox
env when set, so overlay files have one stable base path in both modes.

- args.rs: --overlay-repo / CENTAUR_OVERLAY_REPO on SandboxArgs;
  overlay_dir_in_repo_cache(); inject CENTAUR_OVERLAY_DIR before the
  operator extra-env merge, guarded so SESSION_SANDBOX_EXTRA_ENV still
  wins; unit tests via a clap Parser wrapper.
- chart: overlay.repo value + guarded CENTAUR_OVERLAY_REPO env on api-rs.

Backward compatible: overlay.repo empty => no env emitted => unchanged.
The sandbox entrypoint already consumes $CENTAUR_OVERLAY_DIR and is
unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant