-
Notifications
You must be signed in to change notification settings - Fork 219
Don't return an error on already present #1623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| so.teamSandboxesCreated.Add(ctx, 1, metric.WithAttributes(attributes...)) | ||
| func (so *TeamObserver) Add(ctx context.Context, teamID uuid.UUID) { | ||
| attributes := []attribute.KeyValue{ | ||
| attribute.String("team_id", teamID.String()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
telemetry.WithTeamID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't do it, because that changes it to team.id, that isn't compatible. Bless the tests 🙇🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, then one of the places is incorrect
| callback(ctx, sandbox, newlyCreated) | ||
| } | ||
| // Add sandbox info to node for routing | ||
| s.callbacks.AddToSandboxRoutingTable(ctx, sandbox) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be called twice for the race condition, is it idempotent correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make sense to call it multiple times. Changed it, so we're calling it only on the first insert
433ae5b to
2319697
Compare
There's a race condition when the sandbox is added from sync and then the create fails
Note
Swallows ErrAlreadyExists on sandbox add and refactors insert flow into structured sync/async callbacks, updating orchestrator/metrics and adding comprehensive tests.
Callbacksstruct withAddSandboxToRoutingTable(sync),AsyncSandboxCounter, andAsyncNewlyCreatedSandbox(async) hooks.Addnow ignoresErrAlreadyExists(logs warning), calls routing-table + counter only on first insert, and triggers newly-created hook based onnewlyCreatedflag.InsertCallbacksignature (dropscreatedarg);SyncusesAdd(..., false).Addreturnssandbox.ErrAlreadyExistsinstead of string error.ErrAlreadyExiststosandbox/errors.go.addSandboxToRoutingTable,sandboxCounterInsert, andhandleNewlyCreatedSandbox(sends analytics, updates team metrics, increments created counter).TeamObserver.AddAPI simplified toAdd(ctx, teamID)and always incrementsteam_sandboxes_createdwithteam_id.store_test.gocovering new callback behavior, already-existing cases, storage error propagation, and high-concurrency scenarios.Written by Cursor Bugbot for commit 3a890d8. This will update automatically on new commits. Configure here.