Skip to content

Fix: drain SUB workers during scheduler test teardown - #1668

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
puddingfjz:codex/fix-sub-worker-teardown-drain
Aug 4, 2026
Merged

Fix: drain SUB workers during scheduler test teardown#1668
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
puddingfjz:codex/fix-sub-worker-teardown-drain

Conversation

@puddingfjz

Copy link
Copy Markdown
Contributor

Summary

  • Drain both registered SUB mock workers before stopping the scheduler in
    GroupSchedulerFixture.
  • Extend the teardown regression test to leave an in-flight SUB group alongside
    running and queued NEXT_LEVEL work.

Why

GroupSchedulerFixture registers sub_worker_a and sub_worker_b, but its
teardown previously drained only the NEXT_LEVEL workers. Scheduler::stop()
waits for WorkerManager::any_busy(), which includes SUB workers, so an
unfinished SUB dispatch could hang fixture teardown.

This is a follow-up to #1611 and addresses:
#1611 (comment)

Testing

  • Before the fix, the extended teardown test timed out after 5 seconds.
  • TearDownDrainsCurrentAndQueuedDispatches: 100 iterations passed.
  • Full test_scheduler: 62 tests passed.
  • All 76 non-hardware CTest entries passed; 75 ran inside the sandbox, and
    test_remote_endpoint passed when rerun outside because socket creation is
    restricted inside the Codex sandbox.
  • clang-format --dry-run --Werror passed.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 51c96094-f164-47f2-9dbc-e88a2b437341

📥 Commits

Reviewing files that changed from the base of the PR and between b5261a7 and c2fbce1.

📒 Files selected for processing (1)
  • tests/ut/cpp/hierarchical/test_scheduler.cpp

📝 Walkthrough

Walkthrough

The scheduler teardown fixture now drains SUB workers before shutdown. The teardown test submits a SUB group and verifies that both SUB workers run alongside NEXT_LEVEL workers.

Changes

Scheduler teardown coverage

Layer / File(s) Summary
Drain and validate SUB workers
tests/ut/cpp/hierarchical/test_scheduler.cpp
The fixture drains both SUB workers before shutdown. The teardown test covers running and queued work across NEXT_LEVEL and SUB workers.
Estimated code review effort: 1 (Trivial) ~5 minutes

Possibly related PRs

Poem

A rabbit checks the workers in line,
SUB hops twice; NEXT_LEVEL shines.
Running and queued tasks clear the way,
Teardown now ends a tidy day.
“All drained!” cries the bunny, “Hooray!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: draining SUB workers during scheduler test teardown.
Description check ✅ Passed The description directly explains the teardown fix, the regression test extension, the failure mode, and the reported test results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ChaoWao
ChaoWao merged commit fe74ccf into hw-native-sys:main Aug 4, 2026
15 checks passed
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