refactor(api): persist routing with sandboxes#3255
Conversation
PR SummaryMedium Risk Overview Reviewed by Cursor Bugbot for commit 634026f. Bugbot is set up for automated code reviews on this repo. Configure here. |
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Code Review
This pull request refactors sandbox routing management by moving the responsibility of storing and deleting routing metadata from orchestrator callbacks directly into the sandbox store and Redis storage layers. A new Routing field has been added to the Sandbox struct, and the Redis storage now handles route persistence, rollback on failure, and cleanup during removal. The review feedback highlights a potential nil pointer dereference in the new sandboxRoutingMetadata helper function when the node parameter is nil, recommending a defensive nil check.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| return errors.Join( | ||
| fmt.Errorf("failed to store sandbox in Redis: %w", err), | ||
| s.rollbackRouting(context.WithoutCancel(ctx), sbx, routing), | ||
| ) |
There was a problem hiding this comment.
Route stored before sandbox
Medium Severity
Storage.Add writes the routing catalog before the Lua SET that persists the sandbox. The prior flow registered routes only after a successful store add, so catalog lookups could briefly point at a sandbox that is not yet in Redis team storage.
Reviewed by Cursor Bugbot for commit 7b437df. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 634026f. Configure here.
| var sbx sandboxtypes.Sandbox | ||
| if err := json.Unmarshal([]byte(raw), &sbx); err != nil { | ||
| return fmt.Errorf("failed to unmarshal removed sandbox: %w", err) | ||
| } |
There was a problem hiding this comment.
Remove fails after key deleted
Medium Severity
After removeSandboxScript deletes the sandbox key, a JSON unmarshal error makes Remove return an error and skips expiration-index and routing cleanup that follow.
Reviewed by Cursor Bugbot for commit 634026f. Configure here.


No description provided.