- Notifications
You must be signed in to change notification settings - Fork925
fix: upsertcoder_app
resources in case they are persistent#18509
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
mafredri approved these changesJun 23, 2025
coderd/agentapi/subagent.go Outdated
_, err := a.Database.InsertWorkspaceApp(ctx, database.InsertWorkspaceAppParams{ | ||
ID: uuid.New(), | ||
_, err := a.Database.UpsertWorkspaceApp(ctx, database.UpsertWorkspaceAppParams{ | ||
ID: uuid.New(), // TODO: we may need to maintain the app's ID here for stability, but for now we'll leave this as-is. |
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.
Minor nit: This is a note rather than a todo, or if I'm wrong, consider opening an issue. (Committed todo's are where todo's go to die, etc etc.)
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
4699393
intomain 34 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
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.
Uh oh!
There was an error while loading.Please reload this page.
#18487 was merged, meaning
coder_app
IDs generated by the provider are used to insert into the database.Consequently:
coder_app
resources may be defined as persistent resources (i.e. not definingcount = data.coder_workspace.me.start_count
) means that the ID for these will not change across workspace builds, therefore we need to upsert instead of insert.Disclaimer: this change was mostly implemented by Claude Code.