Skip to content

Conversation

@dobrac
Copy link
Contributor

@dobrac dobrac commented Sep 18, 2025

Handle fromTemplate with template status instead of API error. This unifies the handling the SDK afterwards.

@dobrac dobrac self-assigned this Sep 18, 2025
@dobrac dobrac added the improvement Improvement for current functionality label Sep 18, 2025
@linear
Copy link

linear bot commented Sep 18, 2025

@dobrac dobrac marked this pull request as ready for review September 18, 2025 12:16
cursor[bot]

This comment was marked as outdated.

@dobrac dobrac force-pushed the handle-fromtemplate-with-template-status-instead-of-api-eng-3016 branch from 41bf40c to f851af6 Compare September 18, 2025 12:19
@dobrac dobrac enabled auto-merge (squash) September 18, 2025 12:21
Copy link

@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.

Bug: Error Overwrite in Template Status Handling

The err variable is reassigned when calling tm.SetStatus, causing err.Error() to use the tm.SetStatus error instead of the original FromTemplateError. This results in an incorrect build status message. If tm.SetStatus fails, the function returns an error, which may trigger a deferred status update, leading to double status setting or overwriting the message.

packages/api/internal/template-manager/create_template.go#L132-L146

err = tm.SetStatus(
ctx,
templateID,
buildID,
envbuild.StatusFailed,
&templatemanagergrpc.TemplateBuildStatusReason{
Message: err.Error(),
Step: ut.ToPtr("base"),
},
)
if err != nil {
return fmt.Errorf("failed to set build status: %w", err)
}
return nil

Fix in Cursor Fix in Web


@dobrac dobrac disabled auto-merge September 18, 2025 12:23
@dobrac dobrac enabled auto-merge (squash) September 18, 2025 12:23
@dobrac dobrac merged commit 3756032 into main Sep 18, 2025
25 checks passed
@dobrac dobrac deleted the handle-fromtemplate-with-template-status-instead-of-api-eng-3016 branch September 18, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement for current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants