Skip to content

Rent from a Lambda account with one setting - #47

Merged
lydakis merged 5 commits into
mainfrom
claude/lambda-catalog
Oct 6, 2026
Merged

lydakis merged 5 commits into
mainfrom
claude/lambda-catalog

Conversation

@lydakis

@lydakis lydakis commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Before: renting from Lambda meant an offer per instance type, each repeating what Lambda already knows (GPU model, VRAM, CPUs, price) plus the API key file, and a cloud peer had to be a Linux build of the machine's architecture or name one with errand_binary.

After: a cloud peer is three steps. Save the API key in a file, add two lines to errandd.toml, restart:

[cloud.lambda]
api_key_file = "/home/you/.config/errand/lambda-api-key"

Every instance type the account can launch right now is an offer, shaped and priced from Lambda's listing, and --where rents the cheapest match. Machines above max_price_per_hour are never rented; it defaults to $10/h, which covers every single-GPU type Lambda lists today (the dearest is the 1x B200 at $6.99) and stops a sold-out $3/h type from quietly becoming a $16 to $54/h box. A request only a dearer type could serve is refused with the price and the setting to raise; 0 lifts the cap. instance_types and regions narrow further. The cloud peer can run anywhere: without errand_binary it installs itself when it is a Linux build for the machine, and otherwise downloads its version's release for that architecture from GitHub once, checked against the release's checksums.txt. Development builds still need errand_binary.

How:

  • cloud.Config takes a Catalog besides configured offers. The broker lists it every two minutes and again before any lease from a listing older than that, one listing at a time; a failed listing keeps the last one. Configured offers hide listed ones of the same name. Each lease keeps the provider of the offer it was made from, so a lease launches and is released as it was made when the catalog no longer lists its offer.
  • LambdaCatalog turns GET /instance-types into offers: name from the type (gpu-1x-h100-sxm5), GPU model and memory parsed from gpu_description ("H100 (80 GB SXM5)" becomes H100, 80 GiB; the variant is left out because the driver's name the leased machine is checked against may not carry it), count and CPUs from specs, arch from architecture. Types with no capacity in a wanted region, or an architecture errand has no build for, are left out. Types above the cap are advertised but refused, so a request only they would match gets the price and the setting from the cloud peer. The cap is checked again against the price Lambda lists right before the launch. With file_systems, only types with capacity in their region are offered, and with errand_binary, only types of its architecture. The region-picking code shares the same listing.
  • Right after the cloud peer starts, offers wait for the catalog's first listing instead of reporting none. Requests that wait on a listing in progress take its outcome, failed or not, instead of each listing again.
  • [cloud.lambda] is LambdaAccount in config; [cloud.offers.lambda] still works for one instance type with a shape and timeouts of your own, and both share LambdaSettings.
  • The daemon passes its version to the broker, which hands it and the state directory to providers and catalogs.
  • docs/CLOUD.md now leads with the quick start; the lease model and provider commands follow.

Validation: gofmt, go vet for darwin, linux and windows, and go test -race ./... pass locally. New tests cover catalog listing, filtering and ordering, the capped refusal, GPU description parsing, leasing from a catalog offer that then disappears, failed and stale listings, the account table's validation and default cap, and the release download with its checksum check, caching, tampered archive, development build and wrong build cases. An opt-in test (ERRAND_LAMBDA_API_KEY_FILE) listed a real account: all 24 types Lambda lists today parse into a model and memory, and the 7 with capacity at that moment became offers. Nothing was rented. TestLeasesEndWithoutSubmit now waits for the previous lease to finish releasing before acquiring the next, since a releasing lease counts toward max_leases; it was racy before and this change widened the window.

🤖 Generated with Claude Code


Generated by Claude Code

A [cloud.lambda] table with an API key file is now a complete cloud peer.
The broker takes a catalog besides configured offers: the Lambda catalog
lists the account's instance types with capacity every two minutes and
before each lease, and turns each into an offer whose GPUs, CPUs,
architecture and price come from Lambda. max_price_per_hour and
instance_types narrow it. Each lease keeps the provider of the offer it was
made from, so a lease outlives its offer leaving the catalog.

A cloud peer no longer has to be a Linux build of the machine's
architecture: without errand_binary it installs itself when it is, and
otherwise downloads its version's release for the machine once, checked
against the release's checksums. Development builds still need
errand_binary.

docs/CLOUD.md leads with the three-step Lambda setup.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T06:00:03.288008Z cd5b00a Manual request
🔒 Security Review ✅ Completed 2026-10-06T02:30:39.429751Z 8c526c3 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60f9589bfb

ℹ️ 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".

Comment thread internal/cloud/broker.go Resolved
Comment thread internal/cloud/lambda_catalog.go Resolved
Comment thread internal/cloud/lambda_catalog.go Resolved
Comment thread internal/cloud/lambda_catalog.go Resolved
… request

max_price_per_hour in [cloud.lambda] now defaults to 10, enough for every
single-GPU type Lambda lists and not for a sold-out type to become an
eight-GPU box; 0 lifts the cap. Dearer types stay in the catalog as
unavailable: they are not advertised or rented, and a request only one of
them would serve is refused with its price and the setting to raise.

One catalog listing runs at a time, so a listing that started earlier can
no longer land after a newer one. TestLeasesEndWithoutSubmit waits for the
lease before each one to finish releasing, since a releasing lease still
counts toward max_leases. An opt-in test lists a real account when
ERRAND_LAMBDA_API_KEY_FILE is set, and checked every type Lambda lists today.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd53aa08ec

ℹ️ 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".

Comment thread internal/cloud/broker.go Resolved
Comment thread internal/cloud/lambda_catalog.go Resolved
Comment thread internal/cloud/catalog.go Resolved
…an match

- The cap on a Lambda machine's price is checked again against the price
  Lambda lists right before launching, so a price rise or a stale listing
  cannot launch above max_price_per_hour.
- With file systems, a type is offered only with capacity in their region,
  the only one a launch may use. pickRegion and the catalog share
  launchRegions.
- With errand_binary set, only types of its architecture are offered.
- A GPU's variant (SXM5, PCIe) is left out of its name: the driver's name
  the leased machine is checked against may not carry it, so gpu=sxm5
  could rent a machine that never matches.
- Offers above the cap are advertised, so a request only they would match
  reaches the cloud peer and is refused with the price and the setting.
- Offers wait for the catalog's first listing right after the cloud peer
  starts, instead of reporting none.
- Requests waiting on a listing in progress take its outcome, even a
  failure, instead of each listing again.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01QRtura6rhpHQz6RRGcL3uk

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

github-advanced-security is red on 4a3c7aa, but the failure isn't this PR's. That check is GitHub's Copilot code-scanning agent ("Code scanning AI findings", a dynamic workflow, not one in this repo), and it failed in its own "Processing Request" step before reviewing anything. It fails the same way on every PR in this repo, on GitHub's side. There's no fix to port. I tried one re-run, but GitHub refused it for this integration (403). The checks this repo runs itself (tests on Linux, macOS and Windows, CodeQL, GitGuardian) are what gate this PR.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a3c7aa547

ℹ️ 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".

Comment thread internal/cloud/catalog.go Resolved
Comment thread internal/cloud/broker.go Resolved
Comment thread internal/cloud/broker.go Resolved
claude added 2 commits October 6, 2026 02:26
A request the owner's ready or launching lease already serves no longer
waits for a stale catalog to be listed again; only a new lease does. A
launching lease keeps the offer it was made from, so a matching request
still shares it after the catalog drops that offer instead of renting
another machine. A listing that fails is tried again after 5 s, doubling
up to the refresh interval, instead of leaving the catalog's offers
missing for two minutes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01QRtura6rhpHQz6RRGcL3uk
Keeps #49's changes: no Lambda user setting, optional prices, the Seen
check on release, and installing the copy of errand that was checked,
which now covers downloaded and self builds too.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01QRtura6rhpHQz6RRGcL3uk
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@lydakis
lydakis merged commit ca81e43 into main Oct 6, 2026
8 of 9 checks passed
@lydakis
lydakis deleted the claude/lambda-catalog branch October 6, 2026 02:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd5b00a032

ℹ️ 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".

Comment on lines +69 to +71
arch, ok := lambdaArch(t.Architecture)
if !ok || binaryArch != "" && arch != binaryArch {
continue // errand has no build for it, or errand_binary is for another

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Filter architectures unavailable to development builds

When errand_binary is unset, this retains every known architecture even if the cloud peer is a development build. The explicit-binary fix does not cover this path: errandBuild can use the running executable only for the peer's own Linux architecture and rejects every other architecture because a -dev version has no downloadable release. Consequently, an arm64 request from a Linux/amd64 development peer—or an ordinary request for which an ARM offer is cheapest—selects an offer guaranteed to fail instead of using a compatible catalog offer. Restrict such catalogs to the runnable host architecture, or mark the other offers unavailable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #50: Lambda types this cloud peer has no errand build for, including the other architectures of a development build without errand_binary, are now listed as unavailable with the launch's reason. Placement passes over them, and a request only they match says what to set.


Generated by Claude Code

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: ca81e43d3b

ℹ️ 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".

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: ca81e43d3b

ℹ️ 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".

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: ca81e43d3b

ℹ️ 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".

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