Skip to content

Dashboard template id is not always accurate eng 3740#2285

Merged
matthewlouisbrockman merged 11 commits intomainfrom
dashboard-template-id-is-not-always-accurate-eng-3740
Apr 2, 2026
Merged

Dashboard template id is not always accurate eng 3740#2285
matthewlouisbrockman merged 11 commits intomainfrom
dashboard-template-id-is-not-always-accurate-eng-3740

Conversation

@matthewlouisbrockman
Copy link
Copy Markdown
Contributor

@matthewlouisbrockman matthewlouisbrockman commented Apr 1, 2026

Problem:

/sandboxes/{sandboxID} would return templateID which could be either the base template ID or a snapshot/ env ID depending on sandbox state. The dashboard fallback record query also surfaced env_id directly for killed sandboxes, so users could see different IDs for the same sandbox across running, paused, resumed, and killed states.

Solution:

Updates the DB query to select the base_env_id or the env_id instead of just env_id to get the actual template id.

Similarly, ensures we use base_template_id wherever we were expecting template_id when reporting the template_id to the user in sandbox API responses and dashboard fallback sandbox record responses, so templateID consistently means the base template ID at the API boundary.

Remaining: We should normalize what we mean by template_id throughout the infra repo, not addressed in this PR (started to address it but simplified the change because the full review is gonna be gnarly; that would require a separate refactor)

@linear
Copy link
Copy Markdown

linear bot commented Apr 1, 2026

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 1, 2026

PR Summary

Medium Risk
Changes the templateID returned by sandbox endpoints and underlying SQL to prefer snapshots.base_env_id, which could affect clients relying on the previous mixed semantics; the added join to public.snapshots may also impact query performance on hot paths if not indexed well.

Overview
Fixes inconsistent templateID values returned by sandbox APIs by consistently using the sandbox’s base template ID for both running and paused sandboxes, updating the sandbox-to-API mappings and the GetSandboxRecordByTeamAndSandboxID SQL query to prefer snapshots.base_env_id (with fallback to env_id) and adjusting tests to assert the stable value across create/connect/resume/detail flows.

Written by Cursor Bugbot for commit 1db1916. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

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 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@matthewlouisbrockman matthewlouisbrockman merged commit 64c3e19 into main Apr 2, 2026
36 checks passed
@matthewlouisbrockman matthewlouisbrockman deleted the dashboard-template-id-is-not-always-accurate-eng-3740 branch April 2, 2026 00:07
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.

3 participants