Skip to content

Update and reorg sessions page with propagation - #1830

Open
scottnuma wants to merge 6 commits into
mainfrom
scott/propagated-sessions-doc
Open

Update and reorg sessions page with propagation#1830
scottnuma wants to merge 6 commits into
mainfrom
scott/propagated-sessions-doc

Conversation

@scottnuma

@scottnuma scottnuma commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
  • We're releasing propagated sessions, let's include it in the sessions docs
  • Let's also reorg the sessions page to make it friendlier to get started.
  • I recommend reviewing by reading the rendered sessions page as a whole
  • EXE-2007
  • Do not merge until sessions propagation is released with opt-out

scottnuma and others added 5 commits August 4, 2026 14:27
A run's sessions now automatically propagate into events created by
that run (step.sendEvent, step.invoke, inngest.send, defer, and
lifecycle events). Replace the "Sessions and steps" section — which
documented the old non-inherited behavior — with a "Session
propagation" section covering how propagation works, overriding and
clearing propagated sessions, disabling propagation on the client,
and runtime caveats. Split the unchanged step.waitForEvent behavior
into its own section, add a middleware note, and update "Supported
values" now that null is a valid value for clearing a session.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a "Sessions and batching" section distinguishing the run's own
session association (union of all batch events' sessions, first 25
unique pairs) from propagated sessions (intersection across all batch
events, limited to 5). Link the batched-function limit to the new
section.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Line-for-line moves only — review with --color-moved=dimmed-zebra.
Move the dashboard and historical-search sections up after "Add
sessions to an event", followed by "Choose a good session key" and
the reference sections (Supported values, Limits), so propagation
and other interactions come last. Move the SDK version callout next
to the code sample it qualifies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Content changes on top of the pure-move reorder: split the
high-cardinality callout and one-off-filtering paragraph into a
"When not to use sessions" section, replacing the historical-lag
callout it duplicated; rename "Use sessions for historical search"
to a "Data freshness" subsection of the dashboard section; and note
the 5-session limit alongside the send example.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@scottnuma
scottnuma requested a review from djfarrelly as a code owner August 6, 2026 20:35
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website Ready Ready Preview Aug 6, 2026 11:15pm

Request Review

@gester-bot gester-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Solid reorg overall; the main issue is the new middleware example at the end, which references a meta.propagated_sessions field that doesn't exist anywhere else in the doc — every other example (including the "overriding propagated sessions" section a few paragraphs above) treats propagated and manual sessions as merged into the single meta.sessions object. This will confuse readers about which field to actually read/write.


Re-review (2026-08-06): Only new commit since the last review fills in the SDK version placeholder (vX.Y.Zinngest-js v4.18.0) for session propagation and removes the "Add in the releasing version" TODO comment. No functional or content issues introduced by this change.

// Runs for `step.sendEvent()` and `inngest.send()`.
transformSendEvent(arg: Middleware.TransformSendEventArgs) {
for (const event of arg.events) {
delete event.meta?.propagated_sessions?.internal_trace_id;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This references event.meta?.propagated_sessions, but that field is never introduced anywhere else in the doc. Every other example in this page (including "Overriding propagated sessions" just above) treats propagated and manual sessions as living together in the single meta.sessions object (e.g. meta.sessions.conversation_id = null to override/clear). If propagated_sessions is a real distinct field on the wire, it needs to be documented; if not, this should be event.meta?.sessions?.internal_trace_id.

transformStepInput(arg: Middleware.TransformStepInputArgs) {
if (arg.stepInfo.stepType === "invoke") {
const opts = arg.input[0] as { payload: { meta?: EventMeta } };
delete opts.payload.meta?.propagated_sessions?.internal_trace_id;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same propagated_sessions field used here as in the transformSendEvent example above — also, this casts arg.input[0] to { payload: { meta } }, but the step.invoke() example earlier in this same page passes meta as a top-level property alongside data/function, not nested under payload. Worth double-checking this snippet actually matches the real shape of input[0] for an invoke step before publishing.


Good examples:
{/* Add in the releasing version */}
A run's sessions automatically propagate into events created by that run, starting in JS SDK vX.Y.Z.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need to replace vX.Y.Z once we have the real version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added in the projected version, will reconfirm closer in

```tsx
const inngest = new Inngest({
id: "my-app",
sessionPropagation: false, // disable propagation in this client for inngest.send, step.sendEvent, step.invoke, and defer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are there any other parts of the docs we need to mention sessionPropagation? For example /typescript/v4/client/create.mdx

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

2 participants