Skip to content

bug: flaky trace assertion in scheduler activation test #2071

Closed

Description

@PsiACE

Describe the bug

test_scheduler_activation_drops_finished_startup_request[memory] failed in the Python 3.11 CI job, then passed when that job was rerun on the same commit without code changes. This intermittently blocks PR checks and requires a manual retry.

The likely cause is an assumption about the number of scheduler activations. The test schedules work every 20 ms and compares every completion log's trace ID with the first root span's trace ID. However, each activation creates an independent trace root.

The failed run captured two completion logs, which is consistent with multiple activations reaching the assertion. This explanation still needs confirmation: the failure output does not include the individual trace IDs.

Steps to reproduce

  1. Use commit 5ecdbc4dcdee574109ec2332e6cc2bad822eedb1.

  2. Run the unit suite in the Python 3.11 environment configured by the Main workflow:

    PYTEST_WORKERS=4 make unit-test
  3. Check the scheduler activation test's trace ID assertion.

This is intermittent. One failure has been observed in the full CI suite; a deterministic minimal reproduction has not been established. Rerunning the failed job on the same commit passed.

Expected behavior

The test should tolerate multiple valid activations and verify that each completion log corresponds to its own background root trace. It should continue to check that the startup request ID does not leak and that scheduled root spans have no parent.

Actual behavior

The assertion at tests/builtin/runtime/test_scheduler.py:580 failed:

assert all(r.trace_id == format(roots[0].context.trace_id, "032x") for r in records)

The captured log contained two entries:

INFO     powercontext.builtin.runtime.application:_logging.py:94 Scheduled background processing completed
INFO     powercontext.builtin.runtime.application:_logging.py:94 Scheduled background processing completed

The preceding assertions for successful outcomes, cleared request IDs, and parentless root spans all passed.

Execution Result
Attempt 1: failed job 1 failed, 4963 passed, 151 skipped
Attempt 2: same commit, rerun 4964 passed, 151 skipped

Environment

  • Commit: 5ecdbc4dcdee574109ec2332e6cc2bad822eedb1
  • GitHub Actions: Main / tests (3.11, unit), run 39210212970, October 19, 2026
  • OS: Linux (ubuntu-latest)
  • Python: 3.11.17
  • pytest: 9.1.1
  • pytest-xdist: 4 workers, 5115 collected tests
  • Related PR: refactor(cli): unify agent installation lifecycle #2052

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

Activity

  1. Skylm808 commented on Oct 19, 2026

    @Skylm808
    Contributor

    请分配给我

  2. AlexStocks commented on Oct 19, 2026

    @AlexStocks
    Contributor

    @Skylm808 done. just do it. and do it quickly ^_^

  3. moved this from Todo to In progress in PowerContexton Oct 20, 2026
  4. moved this from In progress to Done in PowerContexton Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions