Skip to content

Allow cloud environments without a docker_image key#13679

Draft
warp-dev-github-integration[bot] wants to merge 1 commit into
masterfrom
oz/env-optional-docker-image
Draft

Allow cloud environments without a docker_image key#13679
warp-dev-github-integration[bot] wants to merge 1 commit into
masterfrom
oz/env-optional-docker-image

Conversation

@warp-dev-github-integration

Copy link
Copy Markdown
Contributor

Description

The client failed to deserialize cloud environments whose stored JSON has no docker_image key: AmbientAgentEnvironment used #[serde(flatten)] on the BaseImage enum, which made the top-level docker_image key required. Environments that don't pin a docker image were rejected and could not be loaded.

This PR makes the base image optional:

  • AmbientAgentEnvironment.base_image is now Option<BaseImage>, serialized via a small base_image_field serde helper module (rename = "docker_image", default, skip_serializing_if) instead of #[serde(flatten)].
  • Wire format is preserved exactly: environments with an image still serialize as a top-level "docker_image": "<image>" string; environments without one deserialize successfully (absent or null key) and re-serialize with the key omitted (no null, no empty string).
  • All call sites that read base_image now handle the Option: CLI environment list/get output, the settings Environments page (card display and edit form), the conversation details panel (render and copy-to-clipboard), and the environment context-chip sidecar. Read-only surfaces show None when no image is pinned; the editable form field and clipboard copy use an empty string.

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

Added unit tests in crates/cloud_object_models/src/cloud_environment_tests.rs:

  • deserialize an environment without docker_image
  • deserialize with an explicit null docker_image
  • serialization omits the key when no image is set (and never emits a nested base_image object)
  • serialization emits the exact legacy wire format when an image is set
  • serde roundtrips both with and without an image

Validation run locally:

  • cargo test -p cloud_object_models — 30 passed, 0 failed

  • cargo clippy -p cloud_object_models --all-targets --all-features --tests -- -D warnings — clean

  • cargo clippy -p warp --lib -- -D warnings — clean

  • cargo check -p warp --lib — clean

  • ./script/format — no diffs

  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Fixed cloud environments without a pinned docker image failing to load in the client.

Conversation: https://staging.warp.dev/conversation/ba380890-e12d-46e4-af8b-2be973f06b1d
Run: https://oz.staging.warp.dev/runs/019f5d57-d27e-70d7-b0be-adff71e67992

This PR was generated with Oz.

AmbientAgentEnvironment used #[serde(flatten)] on a BaseImage enum,
making the top-level docker_image key required. Environments stored
without one failed to deserialize.

Replace the flattened BaseImage field with Option<BaseImage> using a
custom serde helper module (base_image_field) that flattens the enum
to/from the top-level docker_image string. This preserves the exact
legacy wire format for environments that pin an image (serialize as
"docker_image": "<image>") while allowing environments without one
to deserialize (key absent or null -> None) and re-serialize without
emitting the key (no null, no empty string).

Updated all call sites that read base_image to handle Option:
- environment.rs: print/details match, update path, EnvironmentInfo
  table cell + JSON serialization
- environments_page.rs: card display + edit form values
- conversation_details_panel.rs: env section render + copy action
- display_menu.rs: environment sidecar image

Display fallback for missing images is "None" (empty string for the
editable form field and clipboard copy, which are naturally empty).

Added unit tests covering: deserialize without docker_image, null
docker_image, serialization omits key when absent, serialization
emits legacy wire format when present, and roundtrips for both.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant