[SDK Sentinel] Fix concurrent OpenTelemetry ID seed isolation - #1758
Open
sdk-sentinel-bot wants to merge 1 commit into
Conversation
tconley1428
marked this pull request as ready for review
August 17, 2026 17:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
This draft contains untrusted AI-generated code. Do not approve or run CI until a maintainer has reviewed the diff. SDK Sentinel verified that GitHub Actions remained approval-gated with zero executable jobs when this PR was opened.
Summary
The OpenAI OTel hierarchy test failed in an [earliest captured macOS job](https://github.com/temporalio/sdk-python/actions/runs/31820269667/job/94831574136) and a [later Windows recurrence](https://github.com/temporalio/sdk-python/actions/runs/31842411677/job/94919382813). An [intervening successful CI run](https://github.com/temporalio/sdk-python/actions/runs/31823119676) used byte-identical relevant files; no preceding equivalent success was captured before the earliest failure.
Root cause
Propagated trace and span seeds were stored in shared LIFO lists on
TemporalIdGenerator. Concurrent worker contexts could consume each other's IDs, corrupting parent relationships nondeterministically.Fix
Store seed stacks in execution-local context variables. Add a deterministic two-thread regression test covering both trace and span IDs, plus a changelog entry.
Validation
The regression test failed before and passed after the fix. The original focused tracing test also passes. Canonical validation passed all Python lint and type checks, then stopped because the local rustup installation had no toolchain; the unchanged baseline passed the full validation. Python 3.10 macOS and Windows CI remain required.
Validation status:
validation-incompletehighhighhighstandard— 3 changed files; 6.1 KiBreproduced— The natural CI assertion did not reproduce in two Linux runs, but a deterministic two-thread regression test reproduced the causal trace/span seed exchange before the fix.fail-before-pass-after— Both span-ID and trace-ID cases returned the other thread's seed before the fix and their own seed afterward.Poe lint, bridge lint, and editable build) — passedPoe lint, bridge lint, and editable build) — passedInvestigator-run checks
poe test -s -k test_otel_tracing_in_runner— passed; 1 attempt(s). Natural Linux reproduction did not occur before the fix.uv run pytest -s tests/contrib/openai_agents/test_openai_tracing.py::test_otel_tracing_in_runner— passed; 1 attempt(s). A second natural Linux reproduction attempt passed before the fix.poe test -s -k temporal_id_generator_seeds_are_context_local— failed; 1 attempt(s). Expected pre-fix failure: both parameterizations deterministically exchanged IDs across threads.poe test -s -k 'temporal_id_generator_seeds_are_context_local or test_otel_tracing_in_runner'— passed; 1 attempt(s). After the fix, both seed-isolation cases and the original tracing test passed..ci-flake-runtime/input/validate.sh— failed; 1 attempt(s). Python lint and type checks passed; validation then stopped before bridge lint/build because rustup had no installed or default toolchain. The trusted unchanged-checkout baseline passed the full command.Required target CI
Residual risks
Automation provenance
680a6b4f32e9d5f2484e9a2e1c604178553c3f55If this finding should not be fixed, apply the
sdk-sentinel:false-positivelabel and close the PR. Sentinel will suppress the finding until its affected source changes.SDK Sentinel recurrence history
2026-08-14 16:51 UTC2026-08-14 16:51 UTC