Allow cloud environments without a docker_image key#13679
Draft
warp-dev-github-integration[bot] wants to merge 1 commit into
Draft
Allow cloud environments without a docker_image key#13679warp-dev-github-integration[bot] wants to merge 1 commit into
warp-dev-github-integration[bot] wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The client failed to deserialize cloud environments whose stored JSON has no
docker_imagekey:AmbientAgentEnvironmentused#[serde(flatten)]on theBaseImageenum, which made the top-leveldocker_imagekey 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_imageis nowOption<BaseImage>, serialized via a smallbase_image_fieldserde helper module (rename = "docker_image",default,skip_serializing_if) instead of#[serde(flatten)]."docker_image": "<image>"string; environments without one deserialize successfully (absent ornullkey) and re-serialize with the key omitted (nonull, no empty string).base_imagenow handle theOption: CLIenvironment list/getoutput, 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 showNonewhen no image is pinned; the editable form field and clipboard copy use an empty string.Linked Issue
ready-to-specorready-to-implement.Testing
Added unit tests in
crates/cloud_object_models/src/cloud_environment_tests.rs:docker_imagenulldocker_imagebase_imageobject)Validation run locally:
cargo test -p cloud_object_models— 30 passed, 0 failedcargo clippy -p cloud_object_models --all-targets --all-features --tests -- -D warnings— cleancargo clippy -p warp --lib -- -D warnings— cleancargo check -p warp --lib— clean./script/format— no diffsI have manually tested my changes locally with
./script/runAgent 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.