Skip to content

fix: See in Editor button works without page refresh#5327

Open
bender-rodriguez-unit1 wants to merge 3 commits into
mainfrom
fix/agent-see-in-editor
Open

fix: See in Editor button works without page refresh#5327
bender-rodriguez-unit1 wants to merge 3 commits into
mainfrom
fix/agent-see-in-editor

Conversation

@bender-rodriguez-unit1

Copy link
Copy Markdown
Contributor

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-version handler looks up the version in selectableVersionsById, 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

  1. If the version is found in cache, switch to it immediately (unchanged)
  2. If not found, store the version ID in a pendingViewVersionRef and invalidate the versions queries to trigger a refetch
  3. A useEffect on selectableVersionsById picks up the pending ID once the refetched data arrives and switches to the version

Bender Rodriguez added 3 commits June 11, 2026 07:24
…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.
@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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) });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 69ba59b. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant