Fix env edit: preserve server fields + show source_repos repos in form#13677
Draft
liliwilson wants to merge 2 commits into
Draft
Fix env edit: preserve server fields + show source_repos repos in form#13677liliwilson wants to merge 2 commits into
liliwilson wants to merge 2 commits into
Conversation
When editing an environment via the UI: - Merge form changes into the existing environment model instead of creating a fresh one, preserving server-managed fields (secrets, providers, code_forge) that the form doesn't expose. - Source_repos is cleared so the server falls back to github_repos (which the form now correctly populates from effective_github_repos). - Init the repos field from effective_github_repos() so environments that store repos via source_repos show them in the edit form. - Hide 'Image:' label on environment cards when no docker image is set. These address remaining gaps after #13553 for environments without a docker image: the form now correctly shows and saves their repos. Co-Authored-By: Oz <oz-agent@warp.dev>
The server uses source_repos as the authoritative repo list when present. When updating only github_repos (the legacy field) while source_repos is non-nil in the payload, the server ignores github_repos and the changes are silently dropped. Use effective_github_repos() to compute the canonical list (reading from source_repos when set), apply adds/removes to it, write back to github_repos, and clear source_repos so the server falls back to github_repos as authoritative. This is the root cause of David's reported issue where CLI repo updates appeared to succeed but repos were not present on re-fetch. 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
Followup to #13553 (which fixed deserialization of environments without a docker image). Two remaining client-side issues:
UI edit form lost server-managed fields: When saving an environment via the edit form, a fresh
AmbientAgentEnvironmentwas created from only the form fields, droppingsecrets,providers,code_forge, andsource_repos. Now we merge form changes into the existing environment model, preserving those fields.Repos not shown/saved for
source_repos-based environments: The form initialized repos only fromgithub_repos. Environments that store repos via the newersource_reposfield showed an empty repo list, and any saves would leave repos stranded insource_repos(silently ignored by the server). Addedeffective_github_repos()helper that returns repos fromsource_repos(when all GitHub) or falls back togithub_repos. The merge now also clearssource_reposso the server usesgithub_reposas authoritative.Confusing "Image: " display: The environment list card always rendered
Image: <empty>for environments without a docker image. Now the image row is omitted entirely when no image is set.Linked Issue
ready-to-specorready-to-implement.Testing
cargo test -p cloud_object_models— all 27 tests pass.cargo clippy -p cloud_object_modelsandcargo clippy --lib -p warp— clean.cargo check --lib -p warp— compiles.I have manually tested my changes locally with
./script/runAgent Mode
Conversation: https://staging.warp.dev/conversation/15acb581-7405-4c1e-852a-2d3007d38705
Run: https://oz.staging.warp.dev/runs/019f5d5a-a09d-716c-b670-8140359eca07
CHANGELOG-BUG-FIX: Fixed environment edit form losing server-managed fields (secrets, providers) and not showing repos from source_repos-based environments.
This PR was generated with Oz.