Skip to content

Validate Jetty Activity writers with task tokens - #363

Closed
moetemp wants to merge 10 commits into
moe/jetty/v2/j6-read-takeoversfrom
moe/jetty/v2/j7-native-takeovers
Closed

moetemp wants to merge 10 commits into
moe/jetty/v2/j6-read-takeoversfrom
moe/jetty/v2/j7-native-takeovers

Conversation

@moetemp

@moetemp moetemp commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

This PR sends Activity task tokens with native writes and adds Streams owned by Standalone Activities. The native server closes those Streams when their Activity ends.

This is a frozen Jetty prototype. See the Brook design and Python implementation for current work.

The November review inspected the source and existing test coverage. It did not rerun the frozen native server stack.

Reviewer's guide

This is a frozen prototype. Review current Streams behavior in the Python implementation.

  1. Start with temporalio/contrib/streams/_activity.py and _activity_stream.py. Check the task token for each Activity attempt and the selected owner.
  2. Review tests/contrib/streams/test_native_server.py with server validation. Client-side token forwarding alone does not establish authorization or closure.

k2 gives a ref the owner fields of a Standalone Activity and keeps the Workflow write fields, which Jetty's handles and creates send (S118).
The native server checks an Activity Producer against the Activity's current attempt, so nobody else writes as that Activity, with no stamp setting (S114).
The server nests the Stream in the Activity and closes it when the Activity ends, so nothing stays open. Redis has no such close, so it refuses (S118). One native plugin on two clients calls each on its own connection (bug 10).
@moetemp moetemp changed the title [Jetty] Sent Activity task tokens and let Standalone Activities own Streams. [Jetty] Sent Activity task tokens and gave Standalone Activities Streams. Oct 23, 2026
@moetemp moetemp changed the title [Jetty] Sent Activity task tokens and gave Standalone Activities Streams. [Jetty] Sent task tokens and gave Standalone Activities their Streams. Oct 23, 2026
…ken.

The server checks a Standalone Activity's create by its owner Producer and its task token together, and k2 sent one or the other (S118).
…tive-takeovers

Brook's Activity close check also lets a Standalone Activity close the Stream it owns (S114, S118).
The early owner check lets only a Local Activity of the chain or the owning Activity close, so the test shows the Activity's close and not the server's.
…tive-takeovers

An Activity's close sends its task token with Brook's close ref, which names the chain of a handle that has only an id.
The server takes at most 2 MiB in one append, below the crate's 4 MiB, so a merge that the codec grew between the two failed as a whole on native.
The native server finds a Workflow's Stream only by both owner fields, so a close that named the Activity's chain with no first run id was invalid there.
@moetemp moetemp changed the title [Jetty] Sent task tokens and gave Standalone Activities their Streams. Validate Jetty Activity writers with task tokens Nov 27, 2026
@moetemp moetemp closed this Nov 28, 2026
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