Repository navigation
feat(ephemeral): nan run --ephemeral, nan ephemeral usage/settings - #58
Draft
sre-helmcode wants to merge 10 commits into
Draft
sre-helmcode wants to merge 10 commits into
sre-helmcode wants to merge 10 commits into
Conversation
Run carries executor, size and cost; CreateRunRequest can ask for an ephemeral run (no workspace); Automation carries executor, size and checkout; features.ephemeral; GET /api/ephemeral/usage and settings. Golden responses rendered by cloud-api's own handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… run goes Only ephemeral_cap_reached reads as the cap; payment_method_required and currency_migration_required say what to do; any other 402 keeps the usual mapping. nan automations run of an ephemeral automation names the container instead of an empty workspace. Free minutes come with a membership and a payment method is required (help, usage). Help within 80 columns, one Ctrl-C separator, settings range in euros, README note on --json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Add a payment method" and "Switch billing to EUR" live in Settings → Ephemeral runs (the EUR switch is also offered in the New run dialog). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…59) 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: barckcode <cristian@helmcode.com> Co-authored-by: Claude Opus 5.5 <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.
What
Ephemeral runs (E2, NaN community) in the CLI. An ephemeral run is an agent in a fresh, throwaway container with no workspace. The container clones the GitHub repo you name, streams like any run and is destroyed at the end. It is billed per started minute by size.
nan run --ephemeral --repo OWNER/NAME --model ID [--size s|m|l] [--agent ...] [--timeout ...] [--byok-secret ...]executor: "ephemeral",size(only when given; the platform defaults tos) andgithub_repo, with noworkspace. The workspace lookup is skipped.--repois missing.--repois a URL. The message suggests theOWNER/NAMEform.--modelis missing.--sizeis not s, m or l.--ws,--cwdor--worktree/--no-worktreeare given with--ephemeral.--repoor--sizeare given without--ephemeral.ephemeral_cap_reachedexits 69. The message says to raise the cap in the browser Settings or wait, and points tonan ephemeral usage. Only this code reads as the cap; any other 402 keeps the generic mapping.payment_method_requiredexits 69 and points to "Add a payment method" in Settings → Ephemeral runs (free minutes included). 402currency_migration_requiredexits 69: the subscription bills in USD and ephemeral runs bill in EUR, so use "Switch billing to EUR" in Settings → Ephemeral runs (also offered in the New run dialog). Both codes come with E3 (cloud-api-eph-e3).token_scope_deniedonexecutorexits 65. The message says to use the session or a token withruns:ephemeral, and that sk- keys can't start these runs.executor(flag off or unknown executor) exits 65 with "ephemeral runs are not available for your account".apiExitandwriteExit, sonan automations runand create/edit read the same.cost: €0.018 for 3 started minutes of size M, before your free minutes (nan ephemeral usage).nan runs lsshowsephemeral Min the WORKSPACE column. A COST column appears only when an ephemeral run is listed:€x,pending, or-for workspace runs.nan runs showshows these rows for an ephemeral run: executor with size and specs, cost, and repository. It hides the workspace, cwd and worktree rows./api/ephemeral/usage(best effort, 3 s bound) and adds "not charged yet: billing is not active"./api/ephemeralcall.executor: ephemeralandsize: s|m|lwork increate/editfiles.checkout: freshandgithub_reposet, no cwd, and a model (or the BYOK model).automations ls/showshow the executor and size.nan automations runon an ephemeral automation announcesqueued in an ephemeral container (size M) for acme/api. Before, it printedqueued onwith an empty workspace name., Ctrl-C to detacheverywhere (it used to be—innan runand;innan automations run). The detach and stream-lost messages say "goes on at nan.builders" instead of "goes on in the workspace", which is true for both executors.nan ephemeral usageshows this month's minutes, the cost after free minutes, and "not charged yet" whilebilling_enabledis false. It also shows the free S-minutes left (with the M and L equivalents), the cap, and the prices per size with how many S-minutes one minute uses.nan ephemeral settingsshows the cap, the concurrency limit and the billing state. It is read only and says writes happen in the browser Settings.payment_method_requiredorcurrency_migration_required(E3 fields; absent means false), usage lists what to do before the next run./api/ephemeral), have--json, and map 404 to "not available".nan ephemeral,nan ephemeral usage,nan run --help,nan automations create --helpand the usage output. The text is: "Free minutes are S-minutes: one M minute uses 2, one L minute 4 (100 free minutes = 100 minutes of S, 50 of M or 25 of L)", split over two lines so the help stays within 80 columns (a test enforces this). Nothing claims "EU only".runs.RunURLsends an ephemeral run to/runs/<id>, which matches the backend notification links incloud-api-eph-e2-links.nan runs ls --json. Also flags, an ephemeral section with the size/price table, and updated exit codes.Why
E1 is live in prod for the owner (flag
EPHEMERAL_ENABLED, billing off). E2 adds the member-facing surfaces. The API shapes were checked against cloud-apiorigin/main:internal/handlers/ephemeral.go,runs.go,automations.go,internal/runs/validate.goandinternal/automations/validate.go.Tests
Each new behavior has a test. The golden JSON in
internal/api/testdata/ephemeral/was rendered by cloud-api's own handlers (renderRun,renderAutomation,EphemeralHandler) through a throwaway test onorigin/main. The CLI decodes exactly what the platform sends.go test -race -shuffle=on -count=1 ./...(as CI runs it) passes: 416 top-level tests, 558 including subtests, 0 failures, 1 skip that was already there.cmd/ephemeral_test.go:apiExit/writeExitparityinternal/api/ephemeral_test.go, and 1 ininternal/runs.--jsoncontract test coversnan ephemeral usage/settingsandnan run --ephemeral --json.gofmt -l .is clean,go vet ./...is clean, and cross-builds for linux/windows/darwin succeed. The binary was smoke-tested for the usage errors,nan ephemeral --help, and usage without a session (exit 65).Release (Lead: what to do to publish)
This PR bumps
internal/tui.Version0.1.34 → 0.1.35 in its ownchore: 0.1.35commit. That is the release process from CONTRIBUTING.md "Releases". Nothing is tagged or published by this PR.main.mainmust go green. Then.github/workflows/tag.ymlcreates the tagv0.1.35and callsrelease.yml, which builds, signs and publishes the archives. There is no manual tag step.gh release view v0.1.35 -R helmcode/nan-cli, thencurl -fsSL https://nan.builders/install | bash && nan --version(expectnan 0.1.35).Versiononmainright before merging.Gaps / notes
nan ephemeral,nan ephemeral usage/settings, the "Ephemeral runs" part ofnan run --help) and the README's ephemeral section link to https://nan.builders/docs/ephemeral-runs, added by docs: ephemeral runs (EN/ES) nan#198. General run docs stay at /docs/runs. Merge #198 before this PR, or at about the same time, so the link resolves.POST /v1/runshas no secrets field, so a CLI ephemeral run can only clone a public repo. The help says so and points to ephemeral automations with an agentGITHUB_TOKEN.--sha,--prand--baseare not exposed. The server acceptscheckout{sha,pr_number,base_ref}, so this can be a follow-up.nan ephemeral usagealways shows the live prices./api/ephemeral/usage, which only answers sessions. A token sees the conditional wording instead.🤖 Generated with Claude Code