Skip to content

fix: Convert Continue-As-New suggestion reason symbol to int#469

Open
jasonligg wants to merge 2 commits into
temporalio:mainfrom
jasonligg:can-suggestion-reason-sym-to-int
Open

fix: Convert Continue-As-New suggestion reason symbol to int#469
jasonligg wants to merge 2 commits into
temporalio:mainfrom
jasonligg:can-suggestion-reason-sym-to-int

Conversation

@jasonligg

@jasonligg jasonligg commented Jun 24, 2026

Copy link
Copy Markdown

What was changed

This PR proposes two changes each as their own commit:

  • 3908113
    • Fixes WorkflowInstance#activate to convert bridge enum symbols to integers using ProtoUtils.enum_to_int instead of calling .to_i directly on suggest_continue_as_new_reasons.
    • Updates the integration test (HistoryInfoWorkflow) to also assert on suggest_continue_as_new_reasons.
    • Updates the CHANGELOG.md to move the existing changes under a release for 1.5.0. This was probably forgotten for the most recent release.
  • 16361c6
    • Updates the proto code generator (proto_gen.rb) to preserve repeated enum field type information in generated RBS signatures (using a new _RepeatedEnumField interface).
    • Adds an internal _Activation RBS interface for WorkflowInstance#activate, replacing the previous untyped activation parameter so Steep can see the repeated enum reason types used by the workflow instance code.
    • Regenerates RBS signatures.
    • Adds unit tests for both the proto gen normalization and the workflow instance continue-as-new reason handling.

Why?

The first commit addresses the actual problem encountered during workflow execution. When a workflow's history grows large enough for Temporal to suggest continue-as-new, the bridge returns suggest_continue_as_new_reasons as an array of protobuf enum symbols (e.g., :SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS). The existing code called .to_i on these symbols, which raises undefined method 'to_i' for an instance of Symbol. This caused workflow tasks to fail repeatedly, leaving workflows permanently stuck.

The second commit is a bit out-of-scope but I was thinking about how this could be avoided in the future. I understand that there are parts of the SDK that are intentionally kept wide or even untyped so this change may not be welcome. I'm not super familiar with Steep as I use Sorbet a lot at work so I get the gist (footguns 😅) of adding types to an untyped language like Ruby or JS/TS.

💡 I'm fine with reverting that commit if it isn't appropriate!

Checklist

  1. Closes [Bug] Symbol Conversion on suggestContinueAsNew event. #463

  2. How was this tested:

    • Added a unit test (WorkflowInstanceTest#test_continue_as_new_suggestion_reasons_are_visible_as_workflow_enum_ints) that exercises the activation path with symbol enum reasons.
    • Added a unit test for the proto gen RBS normalization.
    • Updated the existing test_history_info integration test to verify suggest_continue_as_new_reasons is returned correctly.
  3. Any docs updates needed?

    • No

@CLAassistant

CLAassistant commented Jun 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@jasonligg jasonligg force-pushed the can-suggestion-reason-sym-to-int branch from 6742d73 to 16361c6 Compare June 24, 2026 01:40
@jasonligg jasonligg marked this pull request as ready for review June 24, 2026 01:42
@jasonligg jasonligg requested a review from a team as a code owner June 24, 2026 01:42
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.

[Bug] Symbol Conversion on suggestContinueAsNew event.

2 participants