Skip to content

test: pin read_env's completion-behavior claims for get_scheduler() (#2098) - #2338

Open
alwaysprince05 wants to merge 1 commit into
NVIDIA:mainfrom
alwaysprince05:test/2098-read-env-completion-behavior
Open

alwaysprince05 wants to merge 1 commit into
NVIDIA:mainfrom
alwaysprince05:test/2098-read-env-completion-behavior

Conversation

@alwaysprince05

@alwaysprince05 alwaysprince05 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

A regression guard for the co_await path in #2098.

read_env may advertise inline completion only for the completion tags it can
actually send. It advertised more than that before 9a301946, so a task that
co_awaits

get_scheduler() | let_value([](auto sch) { return schedule(sch); })

was classified as completing inline. The awaiter then kept the composed
operation state in its own stack frame while a nested schedule() operation was
still queued, which is the lifetime bug reported in #2098.

These assertions pin the current behaviour:

  • get_scheduler() claims inline completion for set_value_t — read_env
    completes in its start();
  • it does not claim set_error_t or set_stopped_t, which it never sends;
  • the composition above is not __as_awaitable::__completes_inline.

All three hold on current main and fail at 482c2605, so a regression of the
completion-behaviour claim is caught at compile time rather than as a crash.
Type-level rather than a runtime test, so it needs no sanitizer to be
deterministic.

Since __completes_inline has to consider every tag, the single-tag form is not
sufficient here — the two read_env claims and the composition are checked
separately so a failure says which one moved.

Built and run with Apple clang 21, -std=c++20, in both configurations:
test.stdexec passes 630 test cases / 50088 assertions with and without
STDEXEC_ENABLE_EXTRA_TYPE_CHECKING against the current base, no new warnings,
clang-format clean.

@copy-pr-bot

copy-pr-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

…VIDIA#2098)

read_env may advertise inline completion only for the completion tags it can
actually send. When it advertised more than that, a task co_awaiting
get_scheduler() | let_value(schedule) was classified as completing inline, so
the awaiter kept the composed operation state in its own stack frame while a
nested schedule() operation was still queued.

Assert that get_scheduler() claims inline completion for set_value_t alone, and
that the composed expression is not treated as completing inline.
@alwaysprince05
alwaysprince05 force-pushed the test/2098-read-env-completion-behavior branch from 9acb47c to ed4cb1d Compare October 15, 2026 16:13

This branch has not been deployed

No deployments
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