Skip to content

Conversation

@fretz12
Copy link
Contributor

@fretz12 fretz12 commented Nov 19, 2025

What changed?

Added standalone activity termination handling.

Why?

Needed to support standalone activities full operation.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Note

Adds termination support for standalone activities across API, frontend/handler, state machine, and tests.

  • API/Proto:
    • Add TerminateActivityExecution RPC: request/response messages in proto/v1/request_response.proto and service in proto/v1/service.proto.
    • Regenerate clients/servers: activitypb request/response, service, layered client, and gRPC stubs.
  • Frontend:
    • Implement TerminateActivityExecution in frontend.go to resolve namespace and forward to activity service.
  • Backend/Handler:
    • Add handler TerminateActivityExecution to update component via (*Activity).handleTerminated.
    • Add Activity.handleTerminated to apply termination transition.
  • State Machine:
    • Enhance TransitionTerminated to finalize execution, set LastWorkerIdentity, and record TerminatedFailureInfo in outcome.
  • Tests:
    • Add unit test TestTransitionTerminated.
    • Add functional tests for terminating an activity and preventing termination after completion.

Written by Cursor Bugbot for commit de5e4f2. This will update automatically on new commits. Configure here.

@fretz12 fretz12 force-pushed the saa-terminate-activity branch from c31f512 to 146055a Compare November 20, 2025 03:56
@fretz12 fretz12 force-pushed the saa-complete-activity branch from afa9058 to d19eee6 Compare November 26, 2025 00:00
@fretz12 fretz12 force-pushed the saa-terminate-activity branch from 8710d0b to de5e4f2 Compare November 26, 2025 18:30
@fretz12 fretz12 marked this pull request as ready for review November 26, 2025 19:10
@fretz12 fretz12 requested review from a team as code owners November 26, 2025 19:10
@fretz12
Copy link
Contributor Author

fretz12 commented Nov 26, 2025

cursor review

}

return store.RecordCompleted(ctx, func(ctx chasm.MutableContext) error {
attempt, err := a.Attempt.Get(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Why update the last attempt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we're updating the last worker identity from the termination req. If the identity should not be updated on termination, lmk.

return heartbeat, nil
}

func (a *Activity) handleTerminated(ctx chasm.MutableContext, req *activitypb.TerminateActivityExecutionRequest) (
Copy link
Member

Choose a reason for hiding this comment

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

We should dedupe based on the request ID. I forgot that detail in my initial review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this requires API change, I'll do this as a separate PR.

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.

3 participants