Skip to content

Use callback-reported close time in CHASM Nexus completion events#10915

Open
tekkaya wants to merge 2 commits into
gokhan/nexus-reset-chasm-fallback-draftfrom
gokhan/nexus-343-chasm-completion-time
Open

Use callback-reported close time in CHASM Nexus completion events#10915
tekkaya wants to merge 2 commits into
gokhan/nexus-reset-chasm-fallback-draftfrom
gokhan/nexus-343-chasm-completion-time

Conversation

@tekkaya

@tekkaya tekkaya commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What changed?

CHASM Nexus operations now stamp their terminal history events (NexusOperationCompleted / Failed / Canceled) and the operation's ClosedTime with the close time reported in the async completion callback, instead of the server time at which the callback happens to be processed.

  • HandleNexusCompletion reads completion.GetCloseTime() and threads it through onCompleted / onFailed / onCanceled into the terminal transitions.
  • The OperationStore interface's completion methods take a closeTime *time.Time, and the workflow store overrides the emitted history event's EventTime when it is set — mirroring how the started event already overrides StartTime.
  • The synchronous invocation path passes nil, and completions with no close time fall back to the current component time, preserving existing behavior.

Why?

The completion callback's close time is the moment the operation actually finished, which can precede callback delivery/processing (queueing, retries, cross-tree fallback, reset re-apply). Recording processing time made event timing drift from reality. This matches the precedent already set for the started event's StartTime.

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)

Potential risks

Behaviour is unchanged when no close time is present (nil fallback to current time). A caller-reported close time earlier than the operation's scheduled time would make the schedule-to-close latency metric negative, but that reflects real reported timing .

tekkaya added 2 commits July 2, 2026 22:44
Async Nexus completion callbacks carry a CloseTime — the time the
operation actually completed, which may precede the moment the callback
is processed by the history service. Previously the CHASM completion path
dropped it and stamped the NexusOperationCompleted/Failed/Canceled events
(and the operation's ClosedTime) with server-processing time.

Thread the reported close time from HandleNexusCompletion through
onCompleted/onFailed/onCanceled into the terminal transitions and the
workflow store's history events, mirroring how EventStarted already
overrides StartTime. The value is applied only when present; the sync
invocation path and completions without a close time fall back to the
current component time as before.
Removed comments regarding close time handling in tests.
@tekkaya tekkaya marked this pull request as ready for review July 3, 2026 17:25
@tekkaya tekkaya requested review from a team as code owners July 3, 2026 17:25
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.

1 participant