feat: support updating egress proxy secret envs for key rotation#158
Conversation
Enables key rotation for egress proxy credentials without instance restart.
Updates are propagated to the running guest via the host-side egress proxy
service — the proxy recompiles header inject rules with the new secret
values in-place, so the guest never needs to be restarted or signaled.
Changes:
- Add UpdateInstanceRules() to egressproxy.Service for live rule updates
- Add UpdateInstance() to instances.Manager with UpdateInstanceRequest type
- Add PATCH /instances/{id} API endpoint (OpenAPI + handler + codegen)
- Extend egress proxy integration test with key rotation verification
- Update mock in lib/builds to satisfy Manager interface
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✱ Stainless preview buildsThis PR will update the ✅ hypeman-go studio · code
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
masnwilliams
left a comment
There was a problem hiding this comment.
solid PR — credential rotation with rollback semantics is well-designed. the integration test proving secrets never leak to the VM is the highlight. main feedback is around histogram bucket config for useful latency data and a minor observability gap in the CONNECT setup path.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Summary
PATCH /instances/{id}API endpoint for updating mutable instance propertiesUpdateInstanceRules()to egress proxy service for live header inject rule updatesUpdateInstance()to instance manager withUpdateInstanceRequesttypeHow it works
The egress proxy runs on the host and intercepts outbound HTTPS traffic from the guest. Credential secrets are never exposed to the guest — the guest only sees mock placeholder values. When secrets are updated via the API:
UpdateInstanceRules()No guest restart or signaling is needed because the proxy operates entirely on the host side.
Test plan
TestEgressProxyRewritesHTTPSHeadersintegration test to include:UpdateInstance()go build ./...passesgo vet ./...passesNote
Medium Risk
Adds a new instance mutation API and runtime egress-proxy rule updates; incorrect validation/rollback could leave proxies injecting stale or inconsistent credentials for running VMs.
Overview
Adds
PATCH /instances/{id}to update an instance’s env vars (limited to credential-policysource.envkeys) to support live secret/key rotation without restarting the VM.Implements
manager.UpdateInstancewith validation, metadata persistence, and egress proxy rule recompilation plus rollback if saving metadata fails; the egress proxy gainsUpdateInstanceRulesand improved logging/tracing/metrics around register/update/unregister and request handling.Updates OpenAPI/stainless specs, scopes, and tests (new unit tests and an integration test that rotates a key and verifies the guest still sees mock env while outbound HTTPS uses the rotated value).
Written by Cursor Bugbot for commit 5bdd7a6. This will update automatically on new commits. Configure here.