Skip to content

Fix: preserve native run drain context and acceptance checks - #1726

Closed
Crane-Liu wants to merge 1 commit into
hw-native-sys:mainfrom
Crane-Liu:codex/pr1694-followup
Closed

Fix: preserve native run drain context and acceptance checks#1726
Crane-Liu wants to merge 1 commit into
hw-native-sys:mainfrom
Crane-Liu:codex/pr1694-followup

Conversation

@Crane-Liu

Copy link
Copy Markdown
Contributor

Follow-up to #1694.

#1694 was merged while its review fixes were being prepared, so this PR carries only the remaining review corrections on top of the merged mainline.

Scope:

  • attach the current thread before wait/finalize drain and propagate attach/drain failures;
  • document and diagnose the child-progress-thread host-graph invariant;
  • centralize receipt-bound acceptance publication;
  • restore matching/stale receipt acceptance regression coverage.

Validation on LCW commit 2e6d639:

  • clang-format --dry-run --Werror: passed;
  • test_native_run_execution build: passed;
  • ctest -R ^test_native_run_execution$: 1/1 passed.

@coderabbitai

coderabbitai Bot commented Aug 6, 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: 838d7a34-4ff5-4e8e-b1d2-6b3608a08124

📥 Commits

Reviewing files that changed from the base of the PR and between 4f41773 and 2e6d639.

📒 Files selected for processing (9)
  • src/a2a3/runtime/host_build_graph/host/dep_gen_host_graph.cpp
  • src/a2a3/runtime/host_build_graph/runtime/dep_gen_host_graph.h
  • src/a5/runtime/host_build_graph/host/dep_gen_host_graph.cpp
  • src/a5/runtime/host_build_graph/runtime/dep_gen_host_graph.h
  • src/common/platform/onboard/host/c_api_shared.cpp
  • src/common/platform/sim/host/c_api_shared.cpp
  • src/common/worker/native_run_context.h
  • src/common/worker/native_run_execution.h
  • tests/ut/cpp/common/test_native_run_execution.cpp

📝 Walkthrough

Walkthrough

The change aligns native run lifecycle handling with runner-thread attachment, updates graph-state lifecycle diagnostics, and centralizes launch-receipt acceptance publication with stale-receipt tests.

Changes

Native run lifecycle

Layer / File(s) Summary
Graph-state lifecycle alignment
src/a2a3/runtime/host_build_graph/..., src/a5/runtime/host_build_graph/...
Documentation now describes thread-local graph state through preparation and drain. No-capture diagnostics identify missing capture setup or child progress-thread mismatch.
Receipt-bound acceptance publication
src/common/worker/native_run_execution.h, src/common/worker/native_run_context.h, tests/ut/cpp/common/test_native_run_execution.cpp
publish_native_run_acceptance validates receipt identity before release-storing acceptance. Tests cover matching and stale receipts.
Attachment and drain lifecycle
src/common/platform/onboard/host/c_api_shared.cpp, src/common/platform/sim/host/c_api_shared.cpp
Wait and finalize paths attach before drain, propagate attachment failures, log drain exceptions, and reuse attachment results during validation.

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

Sequence Diagram(s)

sequenceDiagram
  participant simpler_wait_run
  participant attach_current_thread
  participant drain_execution
  participant runtime_validation
  simpler_wait_run->>attach_current_thread: Attach runner thread
  attach_current_thread-->>simpler_wait_run: Return attachment status
  simpler_wait_run->>drain_execution: Drain when attachment succeeds
  simpler_wait_run->>runtime_validation: Reuse attachment status
Loading

Possibly related PRs

Poem

A rabbit checks the receipt with care,
Then binds the run to threads that share.
The graph stays close from start to drain,
Stale launch slips are stopped again.
Attach, validate, and log the trail—
Clean native runs can now prevail.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes to native run drain context and acceptance checks.
Description check ✅ Passed The description directly explains the changes, scope, follow-up context, and validation results.
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.

@Crane-Liu Crane-Liu closed this Aug 7, 2026
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