Refactor: publish a2a3 stream ownership outside the arming block - #1724
Conversation
mark_submitted() marks the slot as owned by query and drain, so it is a state change rather than arming. Inside the arming try it left the block's invariant — everything here is rollback-free — resting on the fact that the statements after it happen not to throw. Moving it past the catch makes the invariant local, and matches a5, which already publishes its poll state after arming. Also state the safe-versus-uncertain rule for the two submissions on ExactLaunchTransaction, so the boundary each callback has to respect is legible from the header rather than from a working document outside the repository. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe launch flow now publishes stream-set submission after successful arming and before AICore launch. Arming failures no longer publish ownership. Native-run documentation now defines rollback and partial-launch failure states. ChangesLaunch transaction
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/a2a3/platform/onboard/host/device_runner.cpp`:
- Around line 629-635: Update the AICore submission failure path in
ExactLaunchTransaction::run so a non-zero submit_aicore result resets or
unpublishes the stream slot after mark_submitted(slot) and before returning
NotStarted. Ensure polling no longer treats the slot as executable, while
preserving resource recovery via recover_device_or_mark_unusable.
🪄 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: 7e4e7fe2-2e19-49cf-bde5-a92f9669f4d4
📒 Files selected for processing (2)
src/a2a3/platform/onboard/host/device_runner.cppsrc/common/worker/native_run_execution.h
Summary
Review follow-up to #1714 (merged as
0e3851a4). Two points from that review, no behavior change.mark_submitted()moves out of a2a3's arming block. #1714 wrapped the AICoresubmit callback's arming prologue in
try/catchso an allocation or thread-spawnfailure is reported as an rc rather than grading the run
Partial. That blockended up spanning
run_stream_slots_.mark_submitted(slot), which is not arming —it publishes the slot as owned by query and drain. Nothing is broken today: the
only statement after it inside the block is the non-throwing
aicore_doneclearingloop, and the rollback path runs
retire_aicore(slot, Unproven), which clearssubmitted. But the block's invariant — everything here is rollback-free — heldonly by inspection of what happened to follow, and a2a3 and a5 drew the boundary in
different places for no stated reason. a5 already publishes its poll state after
the
catch; a2a3 now does the same with its stream ownership, so the two archesare structurally identical and the invariant is local.
The safe-versus-uncertain rule is restated on
ExactLaunchTransaction. #1714'sPR body cited
contracts.mdfor it, which is not a file in this repository — itlives in untracked working state, so the citation resolved to nothing for any
reader. The docblock already carried the callback half of the contract; it now also
states the rule the callback exists to serve: a failure before the first
execution-visible submission rolls back clean, while an AICPU failure after a
successful AICore submission is uncertain execution that retains resources and
poisons admission.
Testing
native_run_lifecycle(the prepared-collector regression barrieradded in Fix: release prepared collectors and keep arming failures safe #1714) passes on
a2a3simNot re-run on hardware. The moved statement is on the a2a3 onboard launch path, so
CI's
st-onboard-a2a3is the check that matters here; the full local onboard sweepwas skipped deliberately rather than held up behind a busy shared box.
Two notes carried over from the #1714 review for the record:
under
a2a3simand so cost no device time. It does not — I re-injected thepre-fix gate and the case still passes on sim, because only the two onboard
runners ever gated collector release on
launched; sim'sabandon_prepared_executionhas always released them unconditionally viacleanup_active_run(). The barrier is real but onboard-only, which is how it wasverified in Fix: release prepared collectors and keep arming failures safe #1714.
…before any stream submissionvs…before any simulated core started) are left as-is: they name their real mechanism, andarming failedis a common greppable stem across all four.