feat(setup-repo): run claude in a container when the host has no CLI#312
Draft
tildesrc wants to merge 3 commits into
Draft
feat(setup-repo): run claude in a container when the host has no CLI#312tildesrc wants to merge 3 commits into
tildesrc wants to merge 3 commits into
Conversation
The setup-repo workflow mints a Claude token by running `claude setup-token` on the host, assuming the CLI is on `$PATH`. On a host without it, the command failed with a vague "failed or was cancelled". Fall back to running `claude setup-token` in the base task-container image (which ships the CLI) via Docker, announced explicitly. If the base image isn't built, `make build` it first (best-effort — needs Docker + a source checkout; on a wheel-only host it says it can't and points at the manual path). If neither a host `claude` nor Docker is available, fail with a clear, actionable message. - setup_repo_lib.sh: pure `setup_token_command` (host claude vs docker fallback) + `base_image_present` helpers. - setup_repo.sh: collect_token resolves the command, announces the fallback, auto-builds, then runs the resolved command. - shell_runner.py: export PANOPTICON_BASE_IMAGE + (when a source checkout is present) PANOPTICON_REPO_ROOT via a new panopticon_repo_root() helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The container fallback built a missing base image with `make build` from the repo, gated on PANOPTICON_REPO_ROOT — which only exists for a source checkout, not a pip/wheel install. Build it from the package's bundled Dockerfile instead (the same checkout-free path the spawner uses via ImageBuilder.build_base_if_missing), so it works for pip users. - images.py: `python -m panopticon.sessionservice.images [IMAGE]` builds the base image if missing. - shell_runner.py: drop panopticon_repo_root/PANOPTICON_REPO_ROOT; export PANOPTICON_BUILD_BASE_CMD built from sys.executable (the interpreter that has panopticon + its bundled Dockerfile importable). - setup_repo.sh: run the injected build command instead of `make build`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… CLI Reuse the existing `build` subcommand instead of a separate images module entry point. The injected build command is `<sys.executable> -m panopticon.terminal build` — the existing `panopticon build`, run with this process's interpreter so it doesn't depend on a venv's bin/ being on the tmux pane's PATH. Drops the images.py __main__ added earlier. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
setup-repoworkflow (runner_type = "shell") mints a Claude auth token by runningclaude setup-tokenon the host, assuming the CLI is on$PATH. On a host without it, the command failed with a vague "'claude setup-token' failed or was cancelled" — no hint that the CLI was missing or that there was an alternative.Now, when
claudeisn't installed on the host, the workflow falls back to runningclaude setup-tokenin the base task-container image (panopticon-base, which ships the CLI) via Docker, and is explicit to the operator that it's doing so. If the base image isn't built yet, itmake builds it first (best-effort — needs Docker + a source checkout on the host; on a wheel-only host it explains it can't auto-build and points at the manual path). If neither a hostclaudenor Docker is available, it fails with a clear, actionable message instead of the old opaque one.Changes
setup_repo_lib.sh— new pure, unit-tested helpers:setup_token_command(resolves hostclaudevs the docker fallback, echoing the command) andbase_image_present(adocker image inspectwrapper).setup_repo.sh—collect_tokenresolves the run command, announces the container fallback, auto-builds the base image if missing, then runs the resolved command (hostclaudeor the container).shell_runner.py— exportsPANOPTICON_BASE_IMAGE(fromDEFAULT_IMAGE) and, when a source checkout is present,PANOPTICON_REPO_ROOT(via a newpanopticon_repo_root()helper) so the script canmake build.docs/container-auth.md— documents the fallback + auto-build.Full plan: the task's
plan.mdartifact.