Skip to content

Add supported box image picker#792

Merged
DorianZheng merged 6 commits into
mainfrom
codex/fix-supported-images-dashboard
Jun 15, 2026
Merged

Add supported box image picker#792
DorianZheng merged 6 commits into
mainfrom
codex/fix-supported-images-dashboard

Conversation

@law-chain-hot

@law-chain-hot law-chain-hot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add Cloud API GET /box/supported-images backed by the curated/pinned image allowlist
  • add the dashboard Create Box image picker and disable submit until supported images are loaded
  • regenerate TypeScript and Go API clients from the updated OpenAPI spec
  • include two dashboard format-only changes applied by the repository pre-commit hook

Validation

  • cd apps && npx vitest run dashboard/src/lib/cloudBox.test.ts
  • cd apps && npx jest --config api/jest.config.ts api/src/box/constants/curated-images.constant.spec.ts --runInBand
  • cd apps && NX_DAEMON=false npx nx build dashboard --configuration=development --skipNxCache --outputStyle=stream
  • cd apps && NX_DAEMON=false npx nx build api --configuration=production --skipNxCache --outputStyle=stream
  • generated clients on the dev machine with Linux Docker/JDK because local Docker was hanging before codegen

Notes

  • Draft PR only; no merge and no deploy performed from this branch.

Summary by CodeRabbit

  • New Features

    • Users can now select box images during the creation process
  • Changes

    • Default resource allocations for new boxes have been adjusted
  • Style

    • Dashboard logo assets have been updated
    • Onboarding guide layout has been improved for better visual display
  • Documentation

    • Updated documentation regarding box creation workflow status and guidance

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Refactors the API SupportedImageSource type to a named alias, lowers box table cpu/mem column defaults in a migration, and integrates a static image picker (SUPPORTED_BOX_IMAGES) plus BOX_CREATE_DEFAULTS resource placeholders into CreateBoxSheet. Includes a new queryKeys.box.supportedImages helper, logo asset swaps, layout overflow fixes, and documentation/formatting cleanup.

Changes

Image Picker, Resource Defaults, and Cosmetic Fixes

Layer / File(s) Summary
API type refactor, resource defaults, and migration
apps/api/src/box/constants/curated-images.constant.ts, apps/api/src/box/services/box.service.ts, apps/api/src/migrations/1741087887225-migration.ts
Extracts the inline { envVar; fallbackRef } object type into a named SupportedImageSource type. Updates the TODO(image-rewrite) comment in box.service.ts. Lowers box table cpu and mem DDL defaults from 2/4 to 1/1.
CreateBoxSheet image picker and BOX_CREATE_DEFAULTS
apps/dashboard/src/components/Box/CreateBoxSheet.tsx, apps/dashboard/src/hooks/queries/queryKeys.ts
Adds optional image field to the Zod schema and form defaults, defines SUPPORTED_BOX_IMAGES and BOX_CREATE_DEFAULTS constants, derives defaultImage, renders an image Select field, passes the chosen image in the create mutation payload, uses BOX_CREATE_DEFAULTS for resource field placeholders, and gates the Create button on organization selection. Adds queryKeys.box.supportedImages(organizationId).
Logo, layout fixes, formatting, and docs
apps/dashboard/src/assets/Logo.tsx, apps/dashboard/src/components/OnboardingGuideDialog.tsx, apps/dashboard/src/components/ui/sheet.tsx, apps/dashboard/src/components/admin/AdminTelemetryDrawer.tsx, apps/infra-local/README.md
Swaps LogoText to use boxlite-black/light assets. Adds overflow-x-hidden and min-w-0 containers to OnboardingGuideDialog and updates CodeBlock styling. Collapses SheetContentProps extends to one line. Reformats hasPartialContract expression. Updates README to reflect pinned-image list behavior and unverified boot status.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • boxlite-ai/boxlite#758: Introduced the pinned-image restriction in curated-images.constant.ts and the supportedImages() allowlist that this PR refactors with the named SupportedImageSource type and integrates into CreateBoxSheet.
  • boxlite-ai/boxlite#730: Touches the same CreateBoxSheet.tsx create-box submission payload (resources inclusion), overlapping with this PR's addition of the image field to that same handler.
  • boxlite-ai/boxlite#713: Modifies the same apps/dashboard/src/components/ui/sheet.tsx file, reformatting the SheetContentProps extends clause that this PR also touches.

Suggested reviewers

  • DorianZheng

🐰 A pinned image list, now tidy and bright,
With defaults for cpu — now trimmed just right!
The logo swapped smoothly, black, light, and clean,
The overflow is hidden, the layout serene.
Hop hop, little boxes — picked well, built with care! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.15% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add supported box image picker' directly and clearly describes the main feature addition: implementing an image picker for selecting supported box images, which aligns with the primary objective of adding a curated box image picker feature to the dashboard.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-supported-images-dashboard

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread apps/libs/api-client/src/api/box-api.ts Fixed
@law-chain-hot
law-chain-hot marked this pull request as ready for review June 15, 2026 13:35
@law-chain-hot
law-chain-hot requested a review from a team as a code owner June 15, 2026 13:35

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api-client-go/model_supported_box_image.go`:
- Around line 176-221: The UnmarshalJSON method in SupportedBoxImage currently
validates that required fields exist as keys in the JSON object but does not
check if their values are null, allowing malformed responses like {"id": null,
...} to pass validation. Update the custom template at
apps/hack/go-client/openapi-templates/model.mustache to add null-value checks
for required fields in the validation logic alongside the existing key existence
checks, ensuring that any null values for id, name, ref, and isDefault are
rejected with an appropriate error message. After updating the template,
regenerate the Go client using nx run api-client-go:generate:api-client to apply
the fix to SupportedBoxImage and all other generated models.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a698aac-6cf9-480d-9805-1783cdd41a35

📥 Commits

Reviewing files that changed from the base of the PR and between 5f93780 and 8bbb15a.

📒 Files selected for processing (21)
  • apps/api-client-go/.openapi-generator/FILES
  • apps/api-client-go/api/openapi.yaml
  • apps/api-client-go/api_box.go
  • apps/api-client-go/model_supported_box_image.go
  • apps/api/src/box/constants/curated-images.constant.spec.ts
  • apps/api/src/box/constants/curated-images.constant.ts
  • apps/api/src/box/controllers/box.controller.ts
  • apps/api/src/box/dto/supported-box-image.dto.ts
  • apps/api/src/box/services/box.service.ts
  • apps/dashboard/src/components/Box/CreateBoxSheet.tsx
  • apps/dashboard/src/components/admin/AdminTelemetryDrawer.tsx
  • apps/dashboard/src/components/ui/sheet.tsx
  • apps/dashboard/src/hooks/queries/queryKeys.ts
  • apps/dashboard/src/hooks/queries/useSupportedBoxImagesQuery.ts
  • apps/infra-local/README.md
  • apps/libs/api-client/src/.openapi-generator/FILES
  • apps/libs/api-client/src/api/box-api.ts
  • apps/libs/api-client/src/docs/BoxApi.md
  • apps/libs/api-client/src/docs/SupportedBoxImage.md
  • apps/libs/api-client/src/models/index.ts
  • apps/libs/api-client/src/models/supported-box-image.ts

Comment thread apps/api-client-go/model_supported_box_image.go Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api/src/migrations/1741087887225-migration.ts`:
- Line 73: The historical migration Migration1741087887225 is being mutated with
default value changes, but existing databases that already applied this
migration will retain the old defaults, causing schema drift. Instead of
modifying the existing migration, revert the changes to the CREATE TABLE
statement in Migration1741087887225 back to its original state, then create a
new separate migration file that applies the default value changes via ALTER
TABLE statements. This ensures existing databases can receive the schema updates
through the new forward migration without conflicts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e7a2352-c74d-40cf-b6c5-8efe86f01de7

📥 Commits

Reviewing files that changed from the base of the PR and between 8bbb15a and ff5ef12.

⛔ Files ignored due to path filters (2)
  • apps/dashboard/src/assets/boxlite-black.png is excluded by !**/*.png
  • apps/dashboard/src/assets/boxlite-light.png is excluded by !**/*.png
📒 Files selected for processing (10)
  • apps/api/src/box/constants/box-create-defaults.constant.ts
  • apps/api/src/box/entities/box.entity.ts
  • apps/api/src/box/services/box.service.ts
  • apps/api/src/config/dto/configuration.dto.ts
  • apps/api/src/migrations/1741087887225-migration.ts
  • apps/dashboard/src/assets/Logo.tsx
  • apps/dashboard/src/components/Box/CreateBoxSheet.tsx
  • apps/dashboard/src/components/OnboardingGuideDialog.tsx
  • apps/dashboard/src/providers/ConfigProvider.tsx
  • apps/dashboard/src/types/DashboardConfig.ts
✅ Files skipped from review due to trivial changes (1)
  • apps/dashboard/src/providers/ConfigProvider.tsx

)
await queryRunner.query(
`CREATE TABLE "box" ("id" character varying NOT NULL DEFAULT uuid_generate_v4(), "boxId" character varying(12) NOT NULL, "organizationId" uuid NOT NULL, "name" character varying NOT NULL, "region" character varying NOT NULL, "image" character varying, "runnerId" uuid, "prevRunnerId" uuid, "class" "public"."box_class_enum" NOT NULL DEFAULT 'small', "state" "public"."box_state_enum" NOT NULL DEFAULT 'unknown', "desiredState" "public"."box_desiredstate_enum" NOT NULL DEFAULT 'started', "osUser" character varying NOT NULL, "errorReason" character varying, "recoverable" boolean NOT NULL DEFAULT false, "env" jsonb NOT NULL DEFAULT '{}', "public" boolean NOT NULL DEFAULT false, "networkBlockAll" boolean NOT NULL DEFAULT false, "networkAllowList" character varying, "labels" jsonb, "cpu" integer NOT NULL DEFAULT '2', "gpu" integer NOT NULL DEFAULT '0', "mem" integer NOT NULL DEFAULT '4', "disk" integer NOT NULL DEFAULT '10', "volumes" jsonb NOT NULL DEFAULT '[]', "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "autoStopInterval" integer NOT NULL DEFAULT '15', "autoDeleteInterval" integer NOT NULL DEFAULT '-1', "pending" boolean NOT NULL DEFAULT false, "authToken" character varying NOT NULL, "daemonVersion" character varying, CONSTRAINT "box_organizationId_name_unique" UNIQUE ("organizationId", "name"), CONSTRAINT "box_id_pk" PRIMARY KEY ("id"))`,
`CREATE TABLE "box" ("id" character varying NOT NULL DEFAULT uuid_generate_v4(), "boxId" character varying(12) NOT NULL, "organizationId" uuid NOT NULL, "name" character varying NOT NULL, "region" character varying NOT NULL, "image" character varying, "runnerId" uuid, "prevRunnerId" uuid, "class" "public"."box_class_enum" NOT NULL DEFAULT 'small', "state" "public"."box_state_enum" NOT NULL DEFAULT 'unknown', "desiredState" "public"."box_desiredstate_enum" NOT NULL DEFAULT 'started', "osUser" character varying NOT NULL, "errorReason" character varying, "recoverable" boolean NOT NULL DEFAULT false, "env" jsonb NOT NULL DEFAULT '{}', "public" boolean NOT NULL DEFAULT false, "networkBlockAll" boolean NOT NULL DEFAULT false, "networkAllowList" character varying, "labels" jsonb, "cpu" integer NOT NULL DEFAULT '1', "gpu" integer NOT NULL DEFAULT '0', "mem" integer NOT NULL DEFAULT '1', "disk" integer NOT NULL DEFAULT '10', "volumes" jsonb NOT NULL DEFAULT '[]', "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "autoStopInterval" integer NOT NULL DEFAULT '15', "autoDeleteInterval" integer NOT NULL DEFAULT '-1', "pending" boolean NOT NULL DEFAULT false, "authToken" character varying NOT NULL, "daemonVersion" character varying, CONSTRAINT "box_organizationId_name_unique" UNIQUE ("organizationId", "name"), CONSTRAINT "box_id_pk" PRIMARY KEY ("id"))`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Create a forward migration instead of mutating a historical one.

At Line 73, defaults are changed inside Migration1741087887225. Environments that already applied this migration will keep old DB defaults, causing schema drift against current entity defaults.

Suggested approach
+// add a new migration file (new timestamp), e.g. Migration<newTimestamp>
+await queryRunner.query(`ALTER TABLE "box" ALTER COLUMN "cpu" SET DEFAULT '1'`)
+await queryRunner.query(`ALTER TABLE "box" ALTER COLUMN "mem" SET DEFAULT '1'`)
+
+// down()
+await queryRunner.query(`ALTER TABLE "box" ALTER COLUMN "cpu" SET DEFAULT '2'`)
+await queryRunner.query(`ALTER TABLE "box" ALTER COLUMN "mem" SET DEFAULT '4'`)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api/src/migrations/1741087887225-migration.ts` at line 73, The
historical migration Migration1741087887225 is being mutated with default value
changes, but existing databases that already applied this migration will retain
the old defaults, causing schema drift. Instead of modifying the existing
migration, revert the changes to the CREATE TABLE statement in
Migration1741087887225 back to its original state, then create a new separate
migration file that applies the default value changes via ALTER TABLE
statements. This ensures existing databases can receive the schema updates
through the new forward migration without conflicts.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api-client-go/api/openapi.yaml`:
- Line 5216: The boxCreateDefaults field at line 5216 in the OpenAPI YAML is set
to an empty string, but the schema defines it as a BoxCreateDefaults object
type, creating a type mismatch in the example. Replace the empty string value
with a valid BoxCreateDefaults object structure that conforms to the schema
definition for that type. This will ensure generated documentation and SDK
examples correctly represent the expected object format rather than a string.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e6f6020-c988-4788-ab00-43cebf517b50

📥 Commits

Reviewing files that changed from the base of the PR and between ff5ef12 and 54df1eb.

📒 Files selected for processing (10)
  • apps/api-client-go/.openapi-generator/FILES
  • apps/api-client-go/api/openapi.yaml
  • apps/api-client-go/model_box_create_defaults.go
  • apps/api-client-go/model_boxlite_configuration.go
  • apps/libs/api-client/src/.openapi-generator/FILES
  • apps/libs/api-client/src/docs/BoxCreateDefaults.md
  • apps/libs/api-client/src/docs/BoxliteConfiguration.md
  • apps/libs/api-client/src/models/box-create-defaults.ts
  • apps/libs/api-client/src/models/boxlite-configuration.ts
  • apps/libs/api-client/src/models/index.ts
✅ Files skipped from review due to trivial changes (4)
  • apps/libs/api-client/src/docs/BoxCreateDefaults.md
  • apps/api-client-go/.openapi-generator/FILES
  • apps/libs/api-client/src/models/box-create-defaults.ts
  • apps/api-client-go/model_box_create_defaults.go

Comment thread apps/api-client-go/api/openapi.yaml Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/dashboard/src/components/Box/CreateBoxSheet.tsx`:
- Around line 138-139: The form visually displays defaultImage but the
submission can send undefined when the user doesn't interact with the image
picker, causing a UI/payload mismatch. Initialize the image field in the form's
defaultValues object (or form initialization logic) to use the defaultImage
variable that is calculated on line 138-139. This ensures that when the form is
submitted without user interaction, it reflects what the UI shows by default.
Check the form submission logic in the CreateBoxSheet component and ensure the
image field's default value is properly set to align with the visual default at
all locations where the form is used or submitted (particularly around lines
169-172 and 257-267 where the image handling occurs).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ab1695f5-4e9f-4b65-9ad7-e685b70c01e4

📥 Commits

Reviewing files that changed from the base of the PR and between 72e6ae7 and 05aad75.

📒 Files selected for processing (4)
  • apps/api/src/box/constants/curated-images.constant.ts
  • apps/api/src/box/services/box.service.ts
  • apps/dashboard/src/components/Box/CreateBoxSheet.tsx
  • apps/dashboard/src/hooks/queries/queryKeys.ts
💤 Files with no reviewable changes (1)
  • apps/dashboard/src/hooks/queries/queryKeys.ts
✅ Files skipped from review due to trivial changes (1)
  • apps/api/src/box/constants/curated-images.constant.ts

Comment thread apps/dashboard/src/components/Box/CreateBoxSheet.tsx
@DorianZheng
DorianZheng merged commit 82abc8b into main Jun 15, 2026
30 of 31 checks passed
@DorianZheng
DorianZheng deleted the codex/fix-supported-images-dashboard branch June 15, 2026 14:46
DorianZheng pushed a commit that referenced this pull request Jun 15, 2026
## Summary
- switch curated Box image refs from digest pins to public
`20260605-p0-r3` tags
- keep API env overrides intact while updating fallback refs
- sync Dashboard Create Box presets and SST API env fallbacks

## Testing
- `git diff --check`
- `cd apps && yarn jest --config api/jest.config.ts
api/src/box/constants/curated-images.constant.spec.ts`

Note: created from a clean branch off latest `origin/main` because the
earlier `codex/fix-supported-images-dashboard` branch was already merged
via PR #792.
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