Skip to content

Add: post-init eligibility re-check in Worker.register() - #1672

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:fix/fence-register-unregister-and-sticky-shutdown
Aug 4, 2026
Merged

Add: post-init eligibility re-check in Worker.register()#1672
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:fix/fence-register-unregister-and-sticky-shutdown

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Worker.register() now re-validates callable eligibility against the frozen topology on every post-init dynamic register path — the same _eligible_target_need rule that _validate_eligible_targets applies at init. Previously, a post-init ChipCallable on a chipless L3 silently returned an inert handle; it now raises ValueError.

  • Two post-READY branches (RemoteCallable and L3+ local) each call _eligible_target_need before acquiring the operation lease
  • Raises ValueError (not RuntimeError): post-init is a direct user API call, not a startup context
  • L2 is naturally exempt via _eligible_target_need's level < 3 guard
  • Eligibility fires before cid budget when both checks would fail — "no chip child" is more actionable than "out of slots"
  • Removes the P0.2-b2 xfail(strict=True) marker from test_post_init_chip_callable_on_chipless_l3_rejected

Testing

  • 277/277 unit tests pass (test_startup_readiness.py + test_host_worker.py)

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e47aa9c-e0c6-481b-90a5-058cf7624257

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Worker.register now checks callable eligibility against the frozen topology for post-init registrations. Tests cover remote, Python, and chip callables, updated error precedence, chip registration setup, cleanup, and CID reuse.

Changes

Callable registration eligibility

Layer / File(s) Summary
Post-init registration validation
python/simpler/worker.py
Worker.register now rejects remote, Python, and chip callables without an eligible dispatch target. Documentation covers initialization and post-init validation.
Eligibility and registration tests
tests/ut/py/test_worker/test_host_worker.py, tests/ut/py/test_worker/test_startup_readiness.py
Tests verify eligibility errors, error precedence, chip registration setup, cleanup, CID reuse, and post-init chip-callable rejection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Poem

A rabbit checks each callable’s way,
Against the paths that stand today.
No target? ValueError hops in sight,
CID slots stay in proper flight.
The worker registers clean and right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding post-init eligibility validation to Worker.register().
Description check ✅ Passed The description directly explains the Worker.register() eligibility re-check, behavior change, affected paths, and 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 force-pushed the fix/fence-register-unregister-and-sticky-shutdown branch 3 times, most recently from 6e9de2a to 87116dd Compare August 4, 2026 04:23
- Call _eligible_target_need on every post-READY dynamic register path,
  same rule as init()-time _validate_eligible_targets
- Raise ValueError (not RuntimeError): post-init is a direct user API
  call, not a startup context
- L2 naturally exempt via _eligible_target_need's level < 3 guard
- Eligibility fires before cid budget when both checks would fail
- LOCAL_CHIP eligibility also considers _next_level_workers, not just
  device_ids, so L4+ workers with chip-capable L3 children are eligible
- Remove P0.2-b2 xfail from test_post_init_chip_callable_on_chipless_l3_rejected
- Update tests that relied on the gap to provide eligible dispatch targets
@ChaoWao
ChaoWao merged commit 0c6a227 into hw-native-sys:main Aug 4, 2026
17 of 18 checks passed
@ChaoWao
ChaoWao deleted the fix/fence-register-unregister-and-sticky-shutdown branch August 4, 2026 05:01
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