Skip to content

Conversation

@dobrac
Copy link
Contributor

@dobrac dobrac commented Aug 12, 2025

This is a breaking change, but in the new SDK, so it's acceptable. The old Template SDK versions will show [object Object] instead of the reason, this will be fixed in the new SDK release.

Return failed step in the reason for the build. This changes the original reason format to:

BuildStatusReason:
  required:
    - message
  properties:
    message:
      type: string
      description: Message with the status reason, currently reporting only for error status
    step:
      type: string
      description: Step that failed

The step value can be either:

  • base
  • step number (like 3)
  • finalize

The reason is saved in the DB as serialized JSON instead of just a string message (the string reason was never actually saved, there was a bug).

This PR also reduce error wrapping for main paths where the error source is obvious.

@linear
Copy link

linear bot commented Aug 12, 2025

@dobrac dobrac changed the title return failed step in the reason Return failed step in the reason Aug 12, 2025
@dobrac dobrac force-pushed the return-failed-step-in-the-reason-e2b-2751 branch from 39dc02b to a19c51a Compare August 12, 2025 13:44
@dobrac dobrac self-assigned this Aug 12, 2025
@dobrac dobrac added the improvement Improvement for current functionality label Aug 12, 2025
@dobrac dobrac force-pushed the return-failed-step-in-the-reason-e2b-2751 branch 6 times, most recently from c753ef9 to f7dc5a5 Compare August 13, 2025 10:40
@dobrac dobrac marked this pull request as ready for review August 13, 2025 10:40
cursor[bot]

This comment was marked as outdated.

@dobrac
Copy link
Contributor Author

dobrac commented Aug 13, 2025

Bug: BuildStatusReason Violates API Contract

The OpenAPI schema for BuildStatusReason defines both message and step as required fields. However, the codebase frequently constructs BuildStatusReason objects with an empty step field in various scenarios, such as build timeouts, general failures, cancelled builds, and when deserializing malformed JSON. This violates the API contract and can cause client-side validation errors.

spec/openapi.yml#L672-L683
packages/api/internal/utils/build_status_reason.go#L49-L54
packages/orchestrator/internal/template/build/builderrors/errors.go#L16-L20
packages/api/internal/template-manager/template_status.go#L43-L46
packages/api/internal/template-manager/create_template.go#L61-L64
packages/orchestrator/internal/template/server/delete_template.go#L36-L39
packages/api/internal/template-manager/template_status.go#L264-L267
Fix in Cursor Fix in Web

Bug: Context Cancellation Error Masked

When the main context is cancelled, the error reported incorrectly wraps a stale err variable from a previous operation instead of the actual context cancellation error (ctx.Err()).

packages/orchestrator/internal/template/build/phases/finalize/builder.go#L258-L265
Fix in Cursor Fix in Web
Comment @cursor review or bugbot run to trigger another review on this PR

both fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have it as a string in db and not json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot about that, thx, will add a migration

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am mainly asking about why we don't save it to DB as a json, why do we do the parsing ourself

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the column type to jsonb + added migration

@dobrac dobrac force-pushed the return-failed-step-in-the-reason-e2b-2751 branch from 508a8cb to b60a9a8 Compare August 15, 2025 18:01
@dobrac dobrac requested a review from jakubno August 15, 2025 20:12
@dobrac
Copy link
Contributor Author

dobrac commented Aug 15, 2025

@cursor review

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.

✅ Bugbot reviewed your changes and found no bugs!

Comment @cursor review or bugbot run to trigger another review on this PR

@dobrac dobrac enabled auto-merge (squash) August 18, 2025 09:29
@dobrac dobrac merged commit 5365242 into main Aug 18, 2025
24 checks passed
@dobrac dobrac deleted the return-failed-step-in-the-reason-e2b-2751 branch August 18, 2025 09:37
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.

4 participants