fix: add secrets field to AmbientAgentEnvironment to prevent CLI updates from resetting secrets [REMOTE-1880]#12280
Conversation
…tes from resetting secrets The Rust AmbientAgentEnvironment struct was missing a secrets field that exists on the server-side CloudEnvironmentConfig model. When the CLI updated an environment via Warp Drive sync, the serialized JSON omitted the secrets key entirely. The server then deserialized this as nil, which means "all secrets" (no scoping), effectively clearing any previously configured secret selection. This adds an Option<Vec<EnvironmentSecretRef>> field with serde defaults so existing serialized data without secrets still deserializes correctly (as None), while environments that have secrets configured will now properly round-trip through CLI updates. Fixes REMOTE-1880 Co-Authored-By: Oz <oz-agent@warp.dev>
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds EnvironmentSecretRef and a secrets field to AmbientAgentEnvironment, preserving managed-secret scoping when cloud environment JSON is deserialized and reserialized by Rust clients. It also covers legacy missing-field behavior, explicit empty selections, specific secret selections, omission of None, and round-trip serialization.
Concerns
- No blocking correctness, security, or spec-drift concerns found in the annotated diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
Verified the end-to-end locally and it seems to do the trick! |
Description
Add a
secretsfield to the RustAmbientAgentEnvironmentstruct to match the server-sideCloudEnvironmentConfigGo model. Without this field, CLI environment updates via Warp Drive sync would serialize JSON without asecretskey, causing the server to interpret the missing field asnil(= "all secrets" / no scoping), effectively clearing any previously configured secret selection.Root Cause
The
AmbientAgentEnvironmentstruct incrates/cloud_object_models/src/cloud_environment.rswas missing asecretsfield that the server-sideCloudEnvironmentConfighas (Secrets *[]EnvironmentSecretRef). When the CLI'soz environment updatecommand updated an environment:AmbientAgentEnvironmentmodel (no secrets field)secretskey → Go deserialized it asnil→ "all secrets"The web UI was unaffected because it goes through the
upsertCloudEnvironmentGraphQL mutation, which properly includes secrets from the current environment data.Fix
EnvironmentSecretRefstruct andsecrets: Option<Vec<EnvironmentSecretRef>>toAmbientAgentEnvironment#[serde(default, skip_serializing_if = "Option::is_none")]for backward compatibilityNoneLinked Issue
ready-to-specorready-to-implement.Testing
Added 7 new unit tests covering secrets serialization/deserialization:
None)Some([])Nonesecrets are omitted from serialized JSONSome([])secrets are included in serialized JSONAll 14 tests in
cloud_environment::testspasscargo check -p warpsucceeds with no errorsI have manually tested my changes locally with
./script/runAgent Mode
Conversation: https://staging.warp.dev/conversation/cfdf3038-1c57-4a8c-9d3c-4e7df3f85332
Run: https://oz.staging.warp.dev/runs/019e99cd-9dc8-72eb-a7e4-c20662f3239c
This PR was generated with Oz.