Skip to content

Add: verify remote startup failure cleanup - #1692

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:test/p0-3-zero-residual
Aug 5, 2026
Merged

Add: verify remote startup failure cleanup#1692
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:test/p0-3-zero-residual

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add the failed remote worker ID to open and attach errors while preserving
    TimeoutError classification when the startup budget is exhausted.
  • Add deterministic failure injection for remote-open timeout,
    later-remote activation failure, and native endpoint-attach failure.
  • Exercise real L4, local SUB, and remote L3 process trees, then assert
    exact child PIDs, remote process groups, shared-memory names, sessions,
    and native resources are reclaimed.
  • Verify the same remote daemon accepts a healthy session after rollback.

Testing

  • .venv/bin/python -m pytest -q tests/ut/py/test_worker/test_remote_zero_residual.py tests/ut/py/test_worker/test_remote_startup_budget.py tests/ut/py/test_remote_l3_lifecycle.py tests/ut/py/test_callable_identity.py
    • 178 passed after rebasing onto latest upstream/main
  • .venv/bin/pre-commit run --files python/simpler/worker.py tests/ut/py/test_worker/test_remote_zero_residual.py tests/ut/py/test_worker/_remote_zero_residual_target.py
    • Passed

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Remote L3 activation now adds contextual errors for session opening and endpoint attachment failures. Linux acceptance tests verify complete process, SHM, session, and worker cleanup after several failure paths and confirm later daemon reuse.

Changes

Remote session rollback

Layer / File(s) Summary
Contextual remote activation errors
python/simpler/worker.py
Session opening and endpoint attachment failures now raise RuntimeError values that identify the remote worker and preserve the original exception details.
Remote cleanup test harness
tests/ut/py/test_worker/_remote_zero_residual_target.py, tests/ut/py/test_worker/test_remote_zero_residual.py
Added a delayed no-op remote target and helpers that inspect process trees, process groups, SHM mappings, sessions, and worker state.
Rollback and daemon reuse scenarios
tests/ut/py/test_worker/test_remote_zero_residual.py
Added Linux tests for open timeout, later-session failure, and attachment failure. Each test checks resource reclamation and subsequent daemon reuse.

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

Possibly related PRs

Poem

A rabbit watched the workers run,
Then checked each process, every one.
When sessions failed, the paths grew clear,
No stray SHM remained near.
The daemon hopped back into play. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the added verification for remote startup failure cleanup.
Description check ✅ Passed The description directly explains the failure-injection tests, resource cleanup checks, error handling, and validation results.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/ut/py/test_worker/test_remote_zero_residual.py`:
- Around line 212-214: Update the cleanup in the test’s finally block after
thread.join(timeout=1.0) to assert that the observer thread is no longer alive
before returning. Use the existing thread object and preserve the stop signal
and timed join order.
- Around line 228-230: Update the assertions before
observed.assert_reclaimed(worker) in the test to require observed.shm_names to
be non-empty, ensuring the failure path captured at least one SHM segment before
cleanup.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 99b60ece-de26-40f2-8288-e0a5c1abbf48

📥 Commits

Reviewing files that changed from the base of the PR and between 06fbd42 and 6f032e1.

📒 Files selected for processing (3)
  • python/simpler/worker.py
  • tests/ut/py/test_worker/_remote_zero_residual_target.py
  • tests/ut/py/test_worker/test_remote_zero_residual.py

Comment thread tests/ut/py/test_worker/test_remote_zero_residual.py
Comment thread tests/ut/py/test_worker/test_remote_zero_residual.py
- Exercise open timeout, later-remote failure, and endpoint attach
  failure against real L4/L3 process trees.
- Assert exact PID, process-group, shared-memory, and session cleanup
  before reusing the daemon.
- Preserve failed worker identity without flattening startup timeout
  classification.
@ChaoWao
ChaoWao force-pushed the test/p0-3-zero-residual branch from 6f032e1 to 7aad1e3 Compare August 5, 2026 03:15
@ChaoWao
ChaoWao merged commit c866c82 into hw-native-sys:main Aug 5, 2026
18 checks passed
@ChaoWao
ChaoWao deleted the test/p0-3-zero-residual branch August 5, 2026 04:36
ChaoWao added a commit to ChaoWao/simpler-fork that referenced this pull request Aug 6, 2026
`simpler-remote-worker` rejects anything but `host_tcp` (hw-native-sys#1011), and hw-native-sys#1688
narrowed the unit tests it knew about onto that profile. The zero-residual
acceptance tests landed from hw-native-sys#1692 in the same window still asked for `sim`, so
the merge of two independently green PRs left every case in that file failing
its own setup with `only host_tcp transport is accepted by simpler-remote-worker`
— the rollback each one exists to observe never ran.

Unrelated to the Buffer ABI; it rides here because it is one line and it is what
keeps `ut` red on every PR that touches nothing near it.
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