Skip to content

[codex] Add Lambda Labs cloud adapter#726

Merged
ralyodio merged 3 commits into
profullstack:masterfrom
caydyan:codex/add-lambda-labs-cloud-adapter
Jun 14, 2026
Merged

[codex] Add Lambda Labs cloud adapter#726
ralyodio merged 3 commits into
profullstack:masterfrom
caydyan:codex/add-lambda-labs-cloud-adapter

Conversation

@caydyan

@caydyan caydyan commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add @profullstack/sh1pt-cloud-lambda-labs for Lambda Labs GPU Cloud
  • implement quote, dry-run-safe provision, list, status, destroy, setup guidance, and Lambda API response mapping
  • register lambda-labs in CLI adapter discovery, default scale pricing, docs, and pnpm-lock.yaml

Validation

  • git diff --check
  • node --check packages/cloud/lambda-labs/src/index.ts
  • node --check packages/cloud/lambda-labs/src/index.test.ts
  • corepack pnpm --filter @profullstack/sh1pt-core build
  • corepack pnpm --filter @profullstack/sh1pt-cloud-lambda-labs typecheck
  • corepack pnpm vitest run packages/cloud/lambda-labs/src/index.test.ts
  • corepack pnpm install --frozen-lockfile --lockfile-only --ignore-scripts --filter @profullstack/sh1pt-cloud-lambda-labs...

Notes

  • Uses the official Lambda Cloud API (https://docs.lambda.ai/public-cloud/cloud-api/).
  • Provisioning requires LAMBDA_CLOUD_API_KEY and one Lambda Cloud SSH key name; dryRun returns before any billable API call.
  • Full CLI package typecheck was not rerun successfully in this local checkout because CLI dependencies are not installed in packages/cli/node_modules; the new adapter package typecheck and focused tests pass.

@caydyan caydyan marked this pull request as ready for review June 13, 2026 19:27
@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds @profullstack/sh1pt-cloud-lambda-labs, a new cloud adapter for Lambda Labs GPU Cloud that implements quote, provision, list, status, and destroy against the Lambda Labs v1 API. All issues raised in the previous review round (timestamp accuracy, terminating status mapping, single-SSH-key enforcement, empty instance_ids error, and key:value tag parsing) have been addressed in this revision.

  • New adapter (packages/cloud/lambda-labs/src/index.ts): Implements the full cloud adapter contract with fetchInstanceTypes, pickInstanceType, gpuModelMatches, tagsFromList/tagsToEntries, instanceCreatedAt, and a stripUndefined serializer; tests cover GPU model disambiguation, dry-run isolation, SSH key validation, launch shape, and timestamp fallback.
  • CLI integration: lambda-labs is added alphabetically to the adapter registry, PROVIDER_PRICING, and DEFAULT_PRICING at $0.75/hr (matching the public A10 tier); docs updated accordingly.

Confidence Score: 5/5

Safe to merge — the adapter is well-tested, all previous blocking issues are resolved, and the two remaining observations are about optional config fields that default to undefined and are stripped before the API call.

All bugs identified in the previous review round are addressed: instanceCreatedAt reads the API timestamp and falls back to epoch, terminating maps to stopped, multiple SSH keys throw instead of silently truncating, an empty instance_ids array throws instead of producing a fake 'pending' id, and tagsFromList correctly splits key:value strings. The remaining observations (undocumented image/user_data fields in the launch body, and a colon in the tag-key normalizer regex) only affect users who explicitly configure those optional fields and have no impact on default usage.

packages/cloud/lambda-labs/src/index.ts — the launch body includes image and user_data fields that are not in the Lambda Labs v1 API spec, and normalizeTagKey allows colons in tag keys which the API may reject.

Important Files Changed

Filename Overview
packages/cloud/lambda-labs/src/index.ts Core Lambda Labs adapter — implements connect, quote, provision, list, status, destroy; previous review issues (createdAt, terminating status, SSH key count, empty instance_ids, tag key parsing) are all addressed; two minor forward-looking gaps remain (unsupported image/user_data fields, normalizeTagKey colon allowance).
packages/cloud/lambda-labs/src/index.test.ts Comprehensive test coverage including contract tests, error mapping, GPU model matching, dry-run, SSH key validation, empty instance-ids error, timestamp fallback, and terminating status — all key edge cases are exercised.
packages/cli/src/adapter-registry.ts Adds lambda-labs in alphabetical order to the cloud adapter list — straightforward, correct.
packages/cli/src/commands/scale.ts Adds lambda-labs to PROVIDER_PRICING and DEFAULT_PRICING at $0.75/hr — consistent with the A10 tier price from the Lambda Labs public pricing page.
packages/cloud/lambda-labs/package.json Standard monorepo package manifest; dev-time main points to src/index.ts, publishConfig rewires to dist — pattern matches other adapters in the repo.
sites/sh1pt.com/app/docs/page.tsx Adds Lambda Labs to two doc strings (setup description and provider table) — text-only change, correct.

Sequence Diagram

sequenceDiagram
    participant CLI
    participant Adapter as cloud-lambda-labs
    participant API as Lambda Labs API

    CLI->>Adapter: connect(ctx)
    Adapter->>API: GET /instances (token verify)
    API-->>Adapter: "200 { data: [...] }"
    Adapter-->>CLI: "{ accountId }"

    CLI->>Adapter: quote(ctx, spec, config)
    Adapter->>API: GET /instance-types
    API-->>Adapter: "{ data: { type_name: {...} } }"
    Adapter->>Adapter: pickInstanceType(items, spec, region)
    Adapter-->>CLI: "Quote { hourly, sku, ... }"

    CLI->>Adapter: provision(ctx, spec, config)
    Note over Adapter: dryRun → return stub immediately
    Adapter->>API: GET /instance-types
    API-->>Adapter: instance types
    Adapter->>Adapter: pickInstanceType + price check
    Adapter->>API: POST /instance-operations/launch
    API-->>Adapter: "{ data: { instance_ids: [id] } }"
    Adapter-->>CLI: "Instance { id, status: provisioning }"

    CLI->>Adapter: status(ctx, id)
    Adapter->>API: "GET /instances/{id}"
    API-->>Adapter: "{ data: LambdaInstance }"
    Adapter->>Adapter: instanceToInstance (status map, createdAt)
    Adapter-->>CLI: "Instance { id, status: running, ... }"

    CLI->>Adapter: destroy(ctx, id)
    Adapter->>API: POST /instance-operations/terminate
    API-->>Adapter: "{ data: { terminated_instances: [...] } }"
Loading

Reviews (4): Last reviewed commit: "Require Lambda launch instance ID" | Re-trigger Greptile

Comment thread packages/cloud/lambda-labs/src/index.ts Outdated
Comment thread packages/cloud/lambda-labs/src/index.ts Outdated
Comment thread packages/cloud/lambda-labs/src/index.ts Outdated
Comment thread packages/cloud/lambda-labs/src/index.ts
Comment thread packages/cloud/lambda-labs/src/index.ts
Comment thread packages/cloud/lambda-labs/src/index.ts Outdated
@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@caydyan caydyan force-pushed the codex/add-lambda-labs-cloud-adapter branch from ee67c32 to 3d0a085 Compare June 14, 2026 00:57
@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

8 similar comments
@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@ralyodio ralyodio merged commit 22fd667 into profullstack:master Jun 14, 2026
5 checks passed
@github-actions

Copy link
Copy Markdown

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

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