Don't retry Activity after Start-To-Close Timeout

Is there a way to prevent Start-To-Close Timeout failures from being retried?

We have a resource-intensive Activity and we don’t want it to run indefinitely. We’ve configured a Start-To-Close Timeout, and also coded our Activity Worker to halt if the Timeout is exceeded. This works as expected; the Activity is halted, but it’s also queued for retry. These retries are undesirable as they tend to produce the same outcome (i.e. they also time out, which leads to retry after retry), wasting resources. Although we want retries in general, we would like to avoid retrying in this particular case.

I’m aware that Retry Policies can have Non-Retryable Errors, but that doesn’t appear to work for Start-To-Close Timeouts, unless I’m missing something?

Are there other solutions we could consider?

Thank you!

Set activity RetryOptions.maximumAttempts to 1 to disable retries.