fix(sandbox): add logging for session resets#446
Merged
Conversation
Log when the sandbox hint is dropped (profile mismatch), when a hinted sandbox cannot be restored (Sandbox.get failure), and when an unavailable sandbox triggers recreation. All three paths were previously silent, making it impossible to diagnose unexpected session resets from Sentry after the fact. Co-Authored-By: claude-sonnet-4-5 <noreply@anthropic.com> Co-authored-by: David Cramer <david@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
recovery.source and the profile hash attrs are set on the active sandbox.acquire span via setSpanAttributes immediately above each log call. No need to duplicate them in the log record. Co-authored-by: David Cramer <david@sentry.io>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d4ca56b. Configure here.
Log records should carry the key attrs inline so they're debuggable without jumping to the correlated span. Re-adds recovery.source to sandbox_unavailable_recreating and the profile hashes to sandbox_hint_discarded_profile_mismatch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Three paths in
session.tsthat create a new sandbox session were completely silent, making it impossible to diagnose unexpected workspace resets from Sentry after the fact. This adds minimal structured log events to each.Changes
sandbox_restore_hint_failed(warn) —Sandbox.get()threw when trying to resume by name; logs hint ID and error message. These aren't captured anywhere on thesandbox.getspan.sandbox_hint_discarded_profile_mismatch(info) — dependency profile hash changed between turns (deploy happened); event name only, profile hashes already on the active span viasetSpanAttributes.sandbox_unavailable_recreating(warn) — sandbox returned unavailable during a reachability probe; event name only, recovery source already on the active span viasetSpanAttributes.No behavioral change.
Verified
pnpm --filter @sentry/junior typecheck)View Session in Sentry