@@ -69,6 +69,39 @@ const (
6969 VersioningBehaviorAutoUpgrade
7070)
7171
72+ // ContinueAsNewSuggestedReason specifies why ContinueAsNewSuggested is true.
73+ //
74+ // NOTE: Experimental
75+ //
76+ // Exposed as: [go.temporal.io/sdk/workflow.ContinueAsNewSuggestedReason]
77+ type ContinueAsNewSuggestedReason int
78+
79+ const (
80+ // ContinueAsNewSuggestedReasonUnspecified - ContinueAsNewSuggestedReason unknown.
81+ // Reason will be Unspecified if the server is not configured to suggest continue as new,
82+ // if the server is not configured to provide a reason for continue as new suggested, or
83+ // if continue as new is not suggested.
84+ //
85+ // Exposed as: [go.temporal.io/sdk/workflow.ContinueAsNewSuggestedReasonUnspecified]
86+ ContinueAsNewSuggestedReasonUnspecified ContinueAsNewSuggestedReason = iota
87+
88+ // ContinueAsNewSuggestedReasonHistorySizeTooLarge - Workflow History size is getting too large.
89+ //
90+ // Exposed as: [go.temporal.io/sdk/workflow.ContinueAsNewSuggestedReasonHistorySizeTooLarge]
91+ ContinueAsNewSuggestedReasonHistorySizeTooLarge
92+
93+ // ContinueAsNewSuggestedReasonUpdateRegistryTooLarge - Workflow Update registry is getting too large.
94+ //
95+ // Exposed as: [go.temporal.io/sdk/workflow.ContinueAsNewSuggestedReasonUpdateRegistryTooLarge]
96+ ContinueAsNewSuggestedReasonUpdateRegistryTooLarge
97+
98+ // ContinueAsNewSuggestedReasonWorkerDeploymentVersionChanged - Workflow's Worker Deployment has a new Ramping
99+ // Version or Current Version, and the workflow's Versioning Behavior is PinnedUntilContinueAsNew.
100+ //
101+ // Exposed as: [go.temporal.io/sdk/workflow.ContinueAsNewSuggestedReasonWorkerDeploymentVersionChanged]
102+ ContinueAsNewSuggestedReasonWorkerDeploymentVersionChanged
103+ )
104+
72105// NexusOperationCancellationType specifies what action should be taken for a Nexus operation when the
73106// caller is cancelled.
74107//
@@ -1350,9 +1383,10 @@ type WorkflowInfo struct {
13501383 // this worker
13511384 currentTaskBuildID string
13521385
1353- continueAsNewSuggested bool
1354- currentHistorySize int
1355- currentHistoryLength int
1386+ continueAsNewSuggested bool
1387+ continueAsNewSuggestedReason ContinueAsNewSuggestedReason
1388+ currentHistorySize int
1389+ currentHistoryLength int
13561390 // currentRunID is the current run ID of the workflow task, deterministic over reset
13571391 currentRunID string
13581392}
@@ -1404,6 +1438,12 @@ func (wInfo *WorkflowInfo) GetContinueAsNewSuggested() bool {
14041438 return wInfo .continueAsNewSuggested
14051439}
14061440
1441+ // GetContinueAsNewSuggestedReason returns the reason for ContinueAsNewSuggested if one exists.
1442+ // This value may change throughout the life of the workflow.
1443+ func (wInfo * WorkflowInfo ) GetContinueAsNewSuggestedReason () ContinueAsNewSuggestedReason {
1444+ return wInfo .continueAsNewSuggestedReason
1445+ }
1446+
14071447// GetWorkflowInfo extracts info of a current workflow from a context.
14081448//
14091449// Exposed as: [go.temporal.io/sdk/workflow.GetInfo]
0 commit comments