Repository navigation
Add the built-in Lambda provider (experimental) - #26
Conversation
A cloud peer is an errand daemon with machine offers. When no runner you own matches --where (new terms: gpu, gpus>=N, gpu=MODEL, vram>=N), it leases a machine, the machine joins as a runner, and the job runs there. Leases end on idle, at a max lifetime, or with `errand leases rm`, and survive restarts. Providers are two commands (acquire, release) or the built-in Lambda Cloud provider, which installs errand over SSH and never leaves an instance billing after a crash. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (3)
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98f644ddfc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Ctrl-C during the lease request no longer drops the lease: the request finishes, and the launching lease it names is released. - A launch is canceled at the offer's max_lifetime, not only at acquire_timeout. - A lease is ready only once that is recorded; a failed write releases it instead of leaving a record a restart would release under a job. - The running broker forgets leases that ended over a week ago, as startup already did. - Offers are shown only to callers that may see their lease IDs, so a caller without the lease action never forgets live lease peers. - doctor still runs its automatic-apply checks when a run would lease. - GPU facts refresh in the background, so a hung nvidia-smi cannot push /v0/info past the client's placement deadline. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
@codex review All seven findings are fixed in d4ef04a, each with a test that fails without its fix. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4ef04a8d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: d4ef04a8d9
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Without tailscale_auth_key_file, a leased Lambda machine runs its runner with transport = "ssh": no network port, and jobs reach it over SSH on port 22 like any SSH peer. Clients' public keys come from the offer's authorized_keys. The lease carries the host key the machine booted with, and errand pins it for that target, so no known_hosts entry or prompt is needed and a reused IP cannot impersonate the machine. The cloud peer watches the runner with the key it installed it with. Command providers can return the same host_key with an ssh target. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
@codex review d1cdc9b makes Tailscale optional for Lambda: without an auth key, the runner listens only for SSH, and the host key from launch is pinned on the client. Generated by Claude Code |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1cdc9b768
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- A workspace's own run.where never rents a machine; personal defaults, profiles and --where can. - Lease requests must be application/json without an Origin header, so a web page cannot start a billable machine. - A run rents a machine only after its local preparation (forwards, snapshot) succeeds. - Placement drops ended lease peers and runs again, even when the machine still answers. - Releases are acknowledged only once recorded. - The reaper checks max lifetime before probing and probes ready leases concurrently. - static-pool.sh claims a slot and records its lease in one atomic step. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2054264850
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The cloud peer makes its own SSH key on first use, adds it to the Lambda account, and installs and watches machines with it, so ssh_key_name and ssh_private_key_file are gone. Each client makes an errand SSH key of its own and sends the public half with the lease request; the machine admits only that key, so authorized_keys is gone too. A lease is reused only for the same client key. Command providers get the key as ERRAND_LEASE_SSH_KEY. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
@codex review Since your last review: 2054264 fixes round 2. d9629e0 makes the Lambda SSH path need only the API key: the cloud peer makes and registers its own SSH key, and each client sends its own key with the lease request. Generated by Claude Code |
- Tailnet leases run Tailscale-only, so no SSH key reaches their runner. - A runner with active leases refuses to start without its [cloud] section, and a command offer's leases are bound to its exact commands. - Host key pins live in the state directory and are written before the lease is recorded; pinned connections get their own control path. - The idle check records a release before destroying the machine. - Lease records keep their cloud peer's entry, so release works after the name changes. - workspaces create rents only after its snapshot is prepared. - Provider stderr is drained past an over-long line. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9629e0df2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The failing Next on this PR: the cloud lease code is being restructured so that recurring review findings are fixed at their cause. One persisted state machine in the broker, and no lease state kept on the client. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ef4e6c5ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The cloud peer now drives each lease with one worker goroutine that makes every provider call. Every change goes through one update that writes the whole record before readers see it, and only moves leases forward. A lease records how to release itself (release command or Lambda API key file), its idle timeout and the key the cloud peer probes it with, so changing or removing offers or the whole [cloud] section only stops new leases. Every runner now has a broker; the refuse-to-start checks are gone. A restart still releases interrupted launches. Clients keep no lease records, pin files or peer aliases. /v0/info lists the caller's active leases with their targets, host keys and admitted SSH key; placement, ps, peers and lease peer names (cloud-7f3a, any unambiguous ending of the lease ID) all come from that list, and host keys are trusted in memory for the process. Lease requests carry a request ID, so a client that lost the answer gets the same lease again. Release cancels a running acquire or probe. Leases reached over the tailnet are reused across a user's machines; SSH ones only by the machine whose key they admit. Offer gpus is capped at 64 and acquire stdout at 16 KiB, which keeps release's state within Windows' environment limit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
@codex review The lease code was rebuilt in adf4d3a: the cloud peer is now the only lease record (one worker per lease, every change validated and persisted before it is visible), and the client keeps no lease state. Earlier threads are answered and resolved. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adf4d3a809
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: adf4d3a809
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
…lease Ctrl-C before the job starts now withdraws the run's lease request. The cloud peer ends the lease only if that request made it and no other request was handed it; a ready lease is released at its next check unless a job is running on it. This replaces the client deciding from the lease state. Also: a cloud peer without offers keeps leftover [cloud] settings and stays listed by errand leases while it holds leases, and the client SSH key is placed private half first, with a missing public half derived again. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
@codex review 1c81364 answers the five findings on adf4d3a. On Ctrl-C the run now withdraws its request, and the cloud peer decides whether the lease ends (not if another request shares it, or a job is running on it). Cloud peers whose offers were removed stay listed and keep their settings, and the client SSH key creation recovers from a missing public half. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c813641f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… terminated A leased machine admits its owner for every action, so holding a lease needs submit on the cloud peer. A caller without it is no longer shown lease targets, and its leases end when it next asks about them. Lambda release now counts only once Lambda's instance list shows every instance of the lease terminated (or gone). Release returns ReleasePending while termination is under way, and the broker asks again shortly. Docs say the idle and lifetime limits hold only while the cloud peer runs and are not a spending cap. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
…s leases A lease now records each request it was handed. An interrupted run withdraws its own request, and the lease ends only once no request still holds it; a job seen running, or more than 32 requests, leaves it to the idle rule. A withdrawal the cloud peer no longer ties to a lease is reported as kept rather than as a failure. errand leases also asks the implicit local peer, which placement can rent from. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
…eases # Conflicts: # cmd/errand/peers_render.go # docs/CONFIGURATION.md # internal/daemon/server.go # internal/placement/requirements.go # internal/placement/requirements_test.go
|
@codex review Generated by Claude Code |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
A buffer that limits what it keeps by overriding Write while embedding bytes.Buffer also exposes Buffer.ReadFrom. exec.Cmd copies a child's output with io.Copy, which prefers ReadFrom, so the limit never applied: git merge-file's stderr was kept in full. internal/limitbuf wraps the buffer instead, and merge uses it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
limitedBuffer embedded bytes.Buffer, so exec copied acquire's stdout and release's output through Buffer.ReadFrom and never hit the limit: an acquire that printed more than 16 KiB was accepted and kept in memory in full. The provider now uses limitbuf.Buffer, which is also on its way to main for the same bug in merge. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
…mg5f The leases branch replaced limitedBuffer with limitbuf.Buffer, whose limit holds when exec copies a child's output; the Lambda installer's ssh output now uses it too. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c56fac0b88
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A caller that keeps the lease action but loses submit has its leases ended, and list and get already hid their targets from it. Release returned the raw lease, so its target leaked. Every response that carries one lease now goes through leaseView. Also covers a child of the acquire command that keeps stderr open: a release still goes ahead once the command is stopped. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
… claude/errand-cloud-30mg5f
--where turned a ready lease the cloud peer listed into an ordinary candidate and ran on it directly. Nothing then held the lease for the run, so it could go idle and be released while the run was still preparing (lease guarantee 5). A ready lease is no longer a placement candidate: the run asks the cloud peer, whose Acquire already hands a matching ready lease to the request as a holder and starts a full idle window. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
… claude/errand-cloud-30mg5f
A caller with lease but not submit was shown its leases without their targets, but the progress and error lines still carried the provider's output, and a pool provider prints the URL it claimed. Those callers now see neither. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
… claude/errand-cloud-30mg5f
Since 307e8df every --where run that reuses a ready lease is handed it by the cloud peer, and each hand-out added a holder. A run whose job started and ended between two idle checks never withdraws, so holders piled up until the 32-holder bound turned later runs away. Handing out a ready lease now counts as use, as a job seen on the machine does: holders stop mattering and only the idle and lifetime rules end it. The latest run is kept as the one holder, so its retry and withdrawal still find the lease. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
… claude/errand-cloud-30mg5f
The release script returns at once, so by the time info answers the lease can already be released and is no longer listed. What the test checks is that no listed lease shows its target. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
… claude/errand-cloud-30mg5f
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a565c4275
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
* Give the Lambda broker test a way to admit SSH keys #35 made the broker require one, and #26's test was written before it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6 * Wait for the broker instead of sleeping in two lease tests TestFailedLaunchesAreReleased gave the acquire command 200ms, which a loaded machine can exceed before readiness is ever checked, and TestReleaseRetriesUntilItSucceeds assumed the first release attempt had failed after a fixed 100ms. Both failed under a full -race run on a Mac. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6 --------- Co-authored-by: Claude <[email protected]>
* Give the Lambda broker test a way to admit SSH keys #35 made the broker require one, and #26's test was written before it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6 * Give the Lambda broker test a way to admit SSH keys #35 made the broker require one, and #26's test was written before it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6 * End ready leases only by the idle and lifetime rules A run no longer holds its lease once the machine is ready. Withdrawing now only cancels a launch that no other run is waiting for; a ready lease ends when it is idle, at its lifetime, or when released. This drops the Used bit, the client's claim and settle step, and the Shared field, at the cost of up to one idle window after a run that stops once its machine is ready. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6 * Wait for the broker instead of sleeping in two lease tests TestFailedLaunchesAreReleased gave the acquire command 200ms, which a loaded machine can exceed before readiness is ever checked, and TestReleaseRetriesUntilItSucceeds assumed the first release attempt had failed after a fixed 100ms. Both failed under a full -race run on a Mac. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6 --------- Co-authored-by: Claude <[email protected]>
Before: a cloud peer (from #32) can lease machines only through provider commands you write yourself.
After: a cloud peer can lease Lambda GPU instances directly. You put a Lambda API key in a file, list the instance types you want in the cloud peer's config, and
errand run --where gpu=h100 ...launches one, runs the job on it, and terminates it once it has been idle. The provider is marked experimental.This is the last of three stacked PRs split out of the original cloud change: #31 adds GPU
--whereterms, #32 adds the lease broker, command provider, CLI and daemon endpoints, and this one adds Lambda on top. Review and merge them in that order.How:
internal/cloud/lambda.goimplements the provider against Lambda's public API: launch with a per-lease SSH key, wait for an IP, install and start errand over SSH, and terminate, then wait until Lambda lists the instance as terminated before the lease is recorded as released. The API key is read from a file and never logged; errors about it name the file by what it holds, not its path. Config gains alambdaprovider with offers by instance type and region.Tested for real on 2026-10-05: an A10 in us-east-1 was ready in 5m27s (mostly Lambda boot),
nvidia-smiran, a second job reused the same lease, anderrand leases rmwaited for Lambda to report the instance terminated. No instances were left behind.Deferred findings from review are tracked in #33.
🤖 Generated with Claude Code
https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6