Skip to content

Decode LastHeartbeatDetails for reset-workflow failures - #2522

Merged
yuandrew merged 5 commits into
temporalio:mainfrom
mittalpk:fix/reset-workflow-failure-heartbeat-details
Aug 25, 2026
Merged

yuandrew merged 5 commits into
temporalio:mainfrom
mittalpk:fix/reset-workflow-failure-heartbeat-details

Conversation

@mittalpk

@mittalpk mittalpk commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

FailureToError's ResetWorkflowFailureInfo branch passed the raw *commonpb.Payloads proto straight through as the ApplicationError's details, instead of wrapping it with newEncodedValues like every sibling branch (Timeout, Canceled, Activity, etc.) does. Calling Details() on the resulting error failed with too many arguments instead of decoding the payload. Fixed to match the sibling pattern.

Why?

Every other failure-info branch in FailureToError wraps its payload the same way before handing it to the caller; this one didn't, so Details() broke specifically for reset-workflow failures — an easy case to miss since it's not the common path, but a genuine inconsistency with the rest of the function.

Checklist

  1. Closes: no linked issue — found via code audit, not filed as a bug report first
  2. How was this tested: added a regression test constructing a Failure with ResetWorkflowFailureInfo directly and asserting Details() decodes correctly; confirmed it fails on main with too many arguments and passes after the fix. go run . check and the full internal package test suite pass with no regressions.
  3. Any docs updates needed?: no

FailureToError passed the raw *commonpb.Payloads proto straight through
as the ApplicationError's details for a reset-workflow failure, instead
of wrapping it with newEncodedValues like every sibling branch does.
Calling Details() on the resulting error failed instead of decoding the
payload.
@mittalpk
mittalpk requested a review from a team as a code owner August 4, 2026 22:25
@CLAassistant

CLAassistant commented Aug 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dplyukhin dplyukhin self-assigned this Aug 13, 2026
@dplyukhin

dplyukhin commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contrib. Does this close an existing issue? Please use the PR template we provided and review the contributing guide: https://github.com/temporalio/sdk-go/blob/main/CONTRIBUTING.md

@mittalpk

Copy link
Copy Markdown
Contributor Author

No linked issue — this is a small, scoped bug fix (root cause + fix + regression test in the description above), which your CONTRIBUTING.md says can go straight to a PR. I don't see a PR template file in .github either, just ISSUE_TEMPLATE. Happy to add anything specific if I'm missing something.

@yuandrew

Copy link
Copy Markdown
Contributor

The template is org-wide, which is why I believe there is no file in .github. But when you open a PR, the template loads

<!--- Note to EXTERNAL Contributors -->
<!-- Thanks for opening a PR! 
If it is a significant code change, please **make sure there is an open issue** for this. 
We work best with you when we have accepted the idea first before you code. -->

<!--- For ALL Contributors 👇 -->

## What was changed
<!-- Describe what has changed in this PR -->

## Why?
<!-- Tell your future self why have you made these changes -->

## Checklist
<!--- add/delete as needed --->

1. Closes <!-- add issue number here -->

2. How was this tested:
<!--- Please describe how you tested your changes/how we can test them -->

3. Any docs updates needed?
<!--- update README if applicable
      or point out where to update docs.temporal.io -->

@mittalpk

Copy link
Copy Markdown
Contributor Author

PR updated as per template.

@yuandrew yuandrew left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contrib, can we update this branch and ensure the CHANGELOG.md entry is in the right spot? We just released 1.48, so I think the entry needs to be moved to a new section

Comment thread internal/error_test.go Outdated
Comment on lines +1274 to +1276
// Before the fix, the raw *commonpb.Payloads proto was passed straight through as the
// error's details instead of being wrapped by newEncodedValues, so Details() panicked
// with a reflect type mismatch instead of decoding the payload.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would return ErrTooManyArg instead of decoding it,

Suggested change
// Before the fix, the raw *commonpb.Payloads proto was passed straight through as the
// error's details instead of being wrapped by newEncodedValues, so Details() panicked
// with a reflect type mismatch instead of decoding the payload.
// Before the fix, the raw *commonpb.Payloads proto was treated as a single
// detail value, so Details() returned ErrTooManyArg instead of decoding it.

@yuandrew yuandrew assigned yuandrew and unassigned dplyukhin Aug 19, 2026
The raw *commonpb.Payloads proto was treated as a single detail value
before the fix, so Details() returned ErrTooManyArg rather than panicking
with a reflect type mismatch as the comment claimed.

Found via review on the PR.
1.48.0 was cut and released before this fix merged, so the entry landed in
an already-shipped section instead of the one that will actually include
it. Also incorporates the corrected wording from review (ErrTooManyArg,
not a panic).
@mittalpk

Copy link
Copy Markdown
Contributor Author

Rebased onto main and updated the comment per your suggestion. Also moved the CHANGELOG entry -- 1.48.0 had already been cut and released while this was open, so it was sitting in an already-shipped section instead of Unreleased.

@yuandrew yuandrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution!

@yuandrew
yuandrew enabled auto-merge (squash) August 25, 2026 14:37
@yuandrew
yuandrew merged commit 2a4d370 into temporalio:main Aug 25, 2026
64 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants