Skip to content

feat(run): --github-token-secret for ephemeral runs on private repos - #59

Merged
sre-helmcode merged 1 commit into
feat/ephemeral-e2-clifrom
feat/adhoc-ephemeral-github-token
Oct 20, 2026
Merged

sre-helmcode merged 1 commit into
feat/ephemeral-e2-clifrom
feat/adhoc-ephemeral-github-token

Conversation

@sre-helmcode

Copy link
Copy Markdown
Contributor

What

Adds --github-token-secret NAME to nan run, for ad-hoc ephemeral runs on a private repository:

nan run --ephemeral --repo acme/private --github-token-secret GITHUB_TOKEN --model glm5.3 "review it"

NAME is one of the member's own secrets holding a GitHub token. The platform uses it only to clone the repository and never gives it to the agent.

  • Sent as github_token_secret in POST /v1/runs only when given (omitempty).
  • Usage error (exit 64), before any request: without --ephemeral, without --repo, with an empty value, or a value that is not a secret name (^[A-Z][A-Z0-9_]{0,63}$). A value that looks like a GitHub token (ghp_, github_pat_, ...) is never echoed back; the message says it is now in shell history and to revoke it. A lowercase name gets a "Did you mean" hint.
  • The platform's refusals with param: "github_token_secret" map to usage errors: 404 not_found -> "you have no secret named X" (+ where to save it, nan secrets ls); 400 (a provider key) -> the server's reason, sanitized. Previously an ephemeral 404 would read as "runs are not enabled".
  • nan run --help and README: dropped "a run started here gets no secrets, so the repository has to be public"; documented the flag and added an example.

Base / dependencies

  • Targets feat/ephemeral-e2-cli (the open ephemeral E2 CLI PR), not main.
  • Needs helmcode/nan-cloud-api#382 deployed before release; older platforms reject the unknown field.
  • No release, no VERSION bump.

Tests (spec-driven, written first)

  • cmd/ephemeral_ghtoken_test.go: body includes/omits github_token_secret; usage errors (no --ephemeral, no --repo, empty, bad name, lowercase suggestion, pasted classic and fine-grained tokens never echoed); 404/400 refusal mapping with control chars stripped; help and flag text.
  • internal/api/ephemeral_test.go: JSON body omits/includes the field.
  • cmd/ephemeral_test.go: help assertion updated from "public"/"GITHUB_TOKEN" to the new wording.

go build ./... && go vet ./... && go test ./...: all packages pass.

🤖 Generated with Claude Code

nan run --ephemeral --repo OWNER/NAME --github-token-secret NAME names one
of the member's secrets holding a GitHub token. The platform uses it only
to clone the private repository and never gives it to the agent
(helmcode/nan-cloud-api#382).

- Usage error (64) without --ephemeral, without --repo, for an empty value
  or a value that is not a secret name; a pasted GitHub token is never
  echoed and the member is told to revoke it.
- The platform's 404 not_found and 400 on github_token_secret map to clear
  usage errors instead of "runs are not enabled".
- nan run --help and README no longer say an ephemeral run started from the
  CLI has to use a public repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sre-helmcode
sre-helmcode merged commit 3303259 into feat/ephemeral-e2-cli Oct 20, 2026
1 check passed
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.

2 participants