fix: See in Editor button works without page refresh#5327
fix: See in Editor button works without page refresh#5327bender-rodriguez-unit1 wants to merge 3 commits into
Conversation
…opic vaults At execution time, configured secrets are resolved from SuperPlane's secret store and injected as environment_variable credentials in a temporary Anthropic vault. The agent sees opaque placeholders; real values are substituted at the network egress layer. Changes: - client.go: CreateVault, CreateEnvVarCredential, DeleteVault methods - types.go: SecretBinding, SecretRef types, Secrets field on Spec - run_agent.go: secrets config field (object list with envName, value secret-key, allowedHosts), validation in Setup, provisionSecretsVault in Execute, cleanup on all error paths - monitor.go: vault cleanup on poll success, timeout, error, cancel Closes #5314
After session creation succeeds, error returns for metadata persistence, KV writes, sending prompt, session refresh, and emit all now call cleanupManagedVault to prevent orphaned vaults with injected credentials.
When the agent creates a draft, the version isn't loaded yet. The button dispatched agent:view-version but the handler couldn't find the version in selectableVersionsById, silently doing nothing. Fix: store the pending version ID in a ref, invalidate the versions query to trigger a refetch, then pick up the version once the refetched data arrives via a useEffect on selectableVersionsById.
|
👋 Commands for maintainers:
|
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.
Reviewed by Cursor Bugbot for commit 69ba59b. Configure here.
| // Version not loaded yet. Store pending ID and refetch. | ||
| pendingViewVersionRef.current = versionId; | ||
| await queryClient.invalidateQueries({ queryKey: canvasKeys.versionList(canvasId) }); | ||
| await queryClient.invalidateQueries({ queryKey: canvasKeys.versionHistory(canvasId) }); |
There was a problem hiding this comment.
Missing draft branch cache invalidation
High Severity
When “See in Editor” misses the version in cache, the handler refetches versionList and versionHistory only. Agent drafts enter selectableVersionsById through draftVersionsFromBranches, which depends on the draftBranches query. Without invalidating that query, the pending version ID may never resolve after refetch.
Reviewed by Cursor Bugbot for commit 69ba59b. Configure here.
| // Don't write terminal status to metadata yet — only after emit. | ||
| refreshed, err := client.GetManagedSession(session.ID) | ||
| if err != nil { | ||
| cleanupManagedVault(client, ctx, ctx.Logger.Warnf) |
There was a problem hiding this comment.
Vault deleted while session running
High Severity
After a managed session is created with a provisioned secrets vault, several failure paths call cleanupManagedVault before the session is deleted or polling finishes. That removes credentials while Anthropic may still be running the session, breaking secret injection for in-flight agent runs.
Reviewed by Cursor Bugbot for commit 69ba59b. Configure here.


Problem
When the in-app agent creates a draft version and shows the draft actions widget, clicking "See in Editor" does nothing until the page is refreshed.
Cause
The
agent:view-versionhandler looks up the version inselectableVersionsById, which is built from the cached versions query. The agent's newly created draft isn't in the cache yet, so the lookup silently returns nothing.Fix
pendingViewVersionRefand invalidate the versions queries to trigger a refetchuseEffectonselectableVersionsByIdpicks up the pending ID once the refetched data arrives and switches to the version