Repository navigation
proxy_fallback: reboot a trial that would stop in the proxy - #436
RyanTheTide wants to merge 5 commits into
Conversation
A stage that cannot start its payload, or whose NVMe or display handoff fails, stops in the proxy, where only a USB host can drive or reboot it. On an aura-try trial that strands a Mac with nobody at it: the NVMe and display handoff failures had no trial check at all, and the trial watchdog is the only other way out. Route every host-less proxy stop through one proxy_fallback(), which waits PROXY_FALLBACK_HOST_MS for a host on the carriers already up and then reboots when a reboot is known to end: - on an aura-try trial, always: its marker was spent before its image was read, so the reboot lands on the configured image. This needs nothing new from Stage 1. - otherwise while the chain's failed-boot count (aura.failed-boots=) is under PROXY_FALLBACK_REBOOTS, as the ANS start failure did, so a failure that persists still ends in the proxy. A host that syncs inside the window keeps the proxy. run_actions() decides before it brings USB up for the proxy: that bring-up may reset a port controller and arm a watchdog of its own. The old trial-only reboot in run_actions() and the ANS-only decision in payload.c become this one path. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
left a comment
There was a problem hiding this comment.
Review of fb9b62f. One blocker: a persistent handoff failure on a normal (non-trial) boot can now reboot forever.
What I checked and found fine: the trial branch keys on aura_trial_enabled(), the same flag that arms the trial watchdog (main.c:430, main.c:534), set only by the stage that spent the aura-try marker (chainload.c:359). That stage spent the marker before it read the image, so a trial reboot lands on the configured image and the trial branch can't loop by itself. Trial plus a failing configured image gives reboot, reboot, proxy, as trial-fails-configured-fails shows. Stage 1 gets no aura.failed-boots=, so a non-trial Stage 1 still stops in the proxy as before. The Stage 1 and aura-proxy windows are unchanged. No chip or board gates are added. uartproxy_wait_host() reuses the Stage 1 sync check and skips DockChannel under CDC. I don't see a semantic conflict with #416 (its uartproxy.c hunk only renames the CDC schedule constants), but the two will need a rebase against each other.
-
Blocker: unbounded reboot loop on a persistent NVMe or display handoff failure. See
src/main.c:490-523andsrc/proxy_fallback.c:25. When the next stage is not chained (Linux or U-Boot, the normal Stage 2 handoff),main.c:490callspmu_chain_leave()beforenvme_shutdown()anddisplay_shutdown(), so iBoot's count in the PMU is already cleared.proxy_fallback()then decides from the in-memory snapshot (pmu_failed_boots_passed()), not from the PMU. So with a count under 2 it takesPROXY_FALLBACK_REBOOT_COUNTEDon a count that no longer exists. iBoot counts that reset as 1, the next boot fails the same way, sees 1 < 2, clears and reboots again, and so on. The count never reaches the limit, so the bound from #401 doesn't hold on these two paths. A deterministic failure (for example a DCP that won't sleep with an external display attached) used to stop in the proxy. Now it reboots every boot+15 s with no end. For the display failure,usb_iodev_shutdown()has already run, so a USB host can't catch the window either. Fix: either move theif (!next_stage.chained) pmu_chain_leave();after both handoffs succeed (right before vectoring), or haveproxy_fallback_decide()take "chain already left" (expose it frompmu_counter.c) and returnPROXY_FALLBACK_PROXYfor a counted reboot when it's set. Then add a multi-boot case totest_nvme_start_reboot.pyfor a persistent handoff failure on a non-chained next stage, expecting reboot, reboot, proxy. Today the handoff paths are only checked for source structure (test_every_host_less_proxy_stop_falls_back), so the chain model never runs them. -
Ordering after a host attaches in the window (
main.c:307-319). Inrun_actions()a host can now sync on UART or a VDM tether beforeusb_init(), and the comment above it says that bring-up may reset a port controller. On a VDM-tethered laptop that can drop the link the host has just synced on, anduartproxy_run()then treats the iodev as already synced. Haveproxy_fallback()return whether a host attached, and skip the USB bring-up in that case (the host already has a carrier). -
A trial host keeps the proxy, but not for long (
uartproxy.c:187,wdt.c:141).wdt_host_attached()only disarms the boot watchdog. On a trial, the trial watchdog (178 s from its last arm) still resets the Mac in the middle of the session thattrial-host-attachespromises. Either disarm the trial watchdog once a host has synced (someone is at the other end) or say in the panel line and the PR text that the session is time-limited. -
Deliberate proxy use and lab recovery. With a count handed on, any host-less stop in a Stage 2 now costs up to two reboots of boot+15 s before the proxy, and during the window USB is not up yet (Stage 2 has no Stage 1 window). Hosts on UART or a VDM tether can claim the window, but a USB-CDC-only host can't. A proxy-only trial image (no payload, on purpose) can't be reached over USB at all now. Consider keeping the counted reboot for stops where something failed to start (ANS start, handoff, a load that returned an error) and stopping in the proxy as before when the image simply has nothing to start. That uses what
payload_run()already knows, with no new knob. -
Stage 1 scope. Nothing in the diff touches Stage 1 or boot objects, but Stage 1 builds from this same
run_actions()/handoff code. A Stage 1 that takes a trial marker and then fails its own NVMe handoff to the trial Stage 2 now reboots instead of stopping. That looks right, but shipping a new Stage 1 that includes it needs the owner's sign-off. The PR should say the hardware evidence covers Stage 2 only.
Tests and evidence: the host suite and the J713 trial rows (forced handoff failure: reboot at 49 s vs the watchdog at 220 s) cover the trial branch. Still missing: a non-trial boot with a forced handoff failure, which is the row that would show finding 1, and the no-payload path. Suggested row after the fix, on a tethered lab Mac (J713 or J615): a normal boot (no aura-try) with a newer Stage 1 that hands on the count and the lab-only forced NVMe handoff failure. Pass = two self-reboots, then the proxy, reachable over the tether, with the next boot reading the count as cleared. Then repeat it on the display handoff path.
Assisted-by: LLM (Claude:Opus 5.5)
|
J616s (T6041) normal path, this head merged with main 6affb8e ( Assisted-by: LLM (Claude:Opus 5.5) |
|
M1 Pro (T6000) normal path, this head merged with main 6affb8e ( Assisted-by: LLM (Claude:Opus 5.5) |
|
M2 (T8112) normal path, same method as the J616s and M1 Pro rows (this head merged with main 6affb8e, Assisted-by: LLM (Claude:Opus 5.5) |
…failed start Review of fb9b62f: - A normal Stage 2 left the chain (pmu_chain_leave()) before its NVMe and display handoffs, so a counted reboot after a handoff failure decided on a count it had already cleared, and a persistent failure rebooted forever. Leave the chain after both handoffs instead, right before vectoring; a handoff failure now finds the count and ends in the proxy after two reboots. - Count-based reboots only where something failed to start: a load that returned an error or a refused handoff (payload_start_failed()). An image with nothing to start stops in the proxy as before; a trial still reboots. - A host that attached in the window keeps its carrier: run_actions() no longer brings USB up under it. - Say on the panel that the trial watchdog still bounds a host's session on a trial. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks. 60c1269 addresses the review:
Host suite 874/0, format clean, Stage 1 and Stage 2 build. Normal-path rows on this head are next. Assisted-by: LLM (Claude:Opus 5.5) |
|
M2 (T8112), normal path on 60c1269 merged with main 58e712b ( Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review at 60c1269572ac7472d57d276bb92d9221c8eb6297.
Commit 60c12695 cleanly addresses the prior blocker by moving if (!next_stage.chained) pmu_chain_leave(); after both handoffs (src/main.c:532-533), gating counted reboots on payload_start_failed() (src/payload.c:472-477, 563, 575, 675), skipping USB bring-up when a host attached in the fallback window (src/main.c:307-318), and documenting on the panel that the trial watchdog still bounds a host session (src/proxy_fallback.c:61-65). No chip/board/firmware gates added; commits/DCO and clean-room rules are clean.
Remaining merge gates (not approving yet)
- CI incomplete on
60c12695: Because the PR targetsj713/ans-start-reboot(#401) rather thanmain, onlypolicyandESP stage 2 vital sizeran —build,gcc,clang-macos,format-check, andPytesthave not run in CI on this head. - Hardware evidence on
60c12695: All posted J713/J616s/M1 Pro/M2 rows ran onfb9b62f2, beforepmu_chain_leave()moved afterexception_shutdown()(src/main.c:505, 532-533, runningspmi_init()withDAIFmasked on every normal boot). Before merge, please post:- normal-path boot rows on
60c12695(confirmingpmu_chain_leave()clears the counter cleanly afterexception_shutdown(), 0 AVC, 0 failed units, 0 new kernel errors); - a non-trial forced handoff-failure row under a count-passing Stage 1 (
reboot -> reboot -> proxy).
- normal-path boot rows on
Minor / defensive code notes
src/main.c:504-525&src/usb_cdc.c:179-186: OnDisplay handoff failed,proxy_fallback()callsuartproxy_wait_host()->usb_cdc_poll()afterusb_cdc_cleanup()(src/main.c:504) andusb_iodev_shutdown()(src/main.c:508).usb_cdc_cleanup()disarmswatchdog_armedbut leavescdc.stateintact; resettingcdc.statetoUSB_CDC_IDLEinusb_cdc_cleanup()ensuresusb_cdc_poll()can never trigger a scheduled CDC transition after USB shutdown.src/main.c:494-503, 516-525: Neither handoff-failure path callsfb_set_active(true), so underFB_SILENT_MODEthe messages commented/* Shown on the panel */(src/proxy_fallback.c:51) won't appear on screen (unlikerun_actions()atsrc/main.c:270).tests/python/test_nvme_start_reboot.py:173:.replace("\nvoid proxy_fallback(", "\nstatic void proxy_fallback(")is stale now thatproxy_fallback()returnsbool(src/proxy_fallback.c:32).
Assisted-by: LLM (Google:Gemini 4 Neon)
|
J713 (M4 Air, 27.2) on 60c1269, cherry-picked onto the J713's configured aura (58db743 + #401), as aura-try one-shots on the default kernel with the configured image's own DTB/U-Boot tail:
Normal-path rows on this head so far: M2 (above) and J713. Assisted-by: LLM (Claude:Opus 5.5) |
|
J616s (T6041), normal path on 60c1269 merged with main 58e712b ( Assisted-by: LLM (Claude:Opus 5.5) |
|
A18 Pro (J700), normal path on 60c1269 merged with main 58e712b ( Assisted-by: LLM (Claude:Opus 5.5) |
|
Still needed: rebase onto main as the trial-reboot part alone, without the failed-boot count from #401 (that count only works behind a new Stage 1), so the full CI runs on it. Then a forced handoff-failure trial row on that head showing the reboot back to the configured image; the cdc.state reset and the panel messages from the review can go into the same push. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-reviewed at 280f7725911512ba22274d02939e13e8af65c316 against the pre-PR checklist (§1–§6).
Diff since prior review (60c12695..280f7725)
- There are no code or test changes since
60c1269572ac. - The only new commit is
280f77259115(gfya, authored and committed bygithub-actions[bot]), which deletes.github/copilot-instructions.md,AGENTS.md,CLAUDE.md, andGEMINI.md.
Progress acknowledged (§5)
- Thank you for running and posting the four normal-path
aura-tryrows on60c12695(M2, J713, J616s, and A18 Pro / J700 — Enforcing, 0 failed units, 0 AVCs, 0 kernel errors, with Stage 2 logs confirmingpmu_chain_leave()runs after handoffs) plus the J713 forced NVMe handoff-failure trial reboot row (self-rebooted to configured Stage 2 in 62 s with no VDM).
Blockers
- Why CI is
UNSTABLE& §4 commit hygiene (280f7725):280f7725is bot-authored (github-actions[bot]) with no humanSigned-off-by:and deletes the four policy files (which also conflicts modify/delete againstmain6e1ac76745, only appearingMERGEABLEbecause the base branchj713/ans-start-reboot(#401) got the same bot commit8500213bd1). The twopull_requestworkflows triggered on280f7725(aurora-agent-policyrun45018362374andesp-stage2-sizerun45018362376) both ended incompleted/action_requiredwithout executing jobs, causingUNSTABLE. - Incomplete CI coverage (still targeting
j713/ans-start-reboot):build,test(Pytest on Linux/macOS),format-check, andstage1-sizetrigger only onbranches: [main], so they still have never run in CI on this PR. Rebase ontomain(dropping280f7725and splitting off the #401 failed-boot-count dependency as noted in your latest comment) so full CI runs and passes on the live head. - §5 Evidence on the rebased head: After rebasing onto
main(and folding in theusb_cdc_cleanup()cdc.statereset andfb_set_active(true)panel visibility items), re-run the forced handoff-failure trial row on that new head showing the self-reboot back to the configured image (with 0 failed units, 0 AVCs, 0 kernel errors). If the counted-reboot path from #401 remains in scope instead of being split out, the non-trial forced handoff-failure row (reboot -> reboot -> proxyunder a count-passing Stage 1) is also still required.
Checklist summary
- §1 No model gating / §2 Production-ready / §3 Safety / §6 Naming: Clean on
60c12695(unchanged; defensive notes onusb_cdc_cleanup()andfb_set_active(true)remain good to include in the rebase). - §4 Attribution: Blocked by bot commit
280f7725;fb9b62f2/60c12695and PR body disclosure are clean. - §5 Evidence & CI: Blocked on
UNSTABLE/action_requiredCI, missingmain-branch CI workflows, and post-rebase forced-failure trial verification.
Assisted-by: LLM (Gemini 4 Neon)
An automated policy commit deleted AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md on this branch after the policy file changed on the default branch. Restore them as copies of its .github/aurora/AGENTS.md so the branch merges cleanly again. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-reviewed at c3f2e443cf52fa61a70f899b6d44857aa216e1e8 against the pre-PR checklist (§1–§6).
Diff since prior review (280f7725..c3f2e443)
- No code or test changes since
60c1269572ac. Commitc3f2e443cf52restores.github/copilot-instructions.md,AGENTS.md,CLAUDE.md, andGEMINI.mdto matchmain's.github/aurora/AGENTS.md(MERGEABLE/CLEANagainst basej713/ans-start-reboot, andpolicypush check isSUCCESS).
Remaining blockers
- §4 Commit hygiene (
280f7725still in branch history): Bot-authoredgfyacommit280f77259115(github-actions[bot], no humanSigned-off-by:) is still in the PR commit list (c3f2e443only restored the 4 files on top). - Incomplete CI coverage & non-
mainbase (j713/ans-start-reboot, #401 still open): Only 1 check (policyonpush) ran onc3f2e443.build,gcc,clang-macos,fedora,alarm,nix,format-check,ESP stage 2 vital size, and all 5Pytestjobs have still not run in CI on this head. Please rebase ontomain(dropping280f7725+c3f2e443and splitting off the #401 failed-boot-count dependency as noted in your earlier comment) so full CI runs and passes. - §5 Evidence on the rebased head: Re-verify the forced handoff-failure trial reboot row after rebasing onto
main(and if #401's counted-reboot path stays in scope, the non-trialreboot -> reboot -> proxyforced handoff-failure row under a count-passing Stage 1 is also still owed). Prior non-blocking defensive notes (usb_cdc_cleanup()cdc.statereset,fb_set_active(true)on handoff-failure paths underFB_SILENT_MODE, and the stale\nvoid proxy_fallback(replacement intests/python/test_nvme_start_reboot.py) remain good to fold into that push.
Checklist summary
- §1 No model gating / §2 Production-ready / §3 Safety / §6 Naming: Pass on
60c12695(unchanged). - §4 Attribution:
fb9b62f2,60c12695,c3f2e443, and PR body disclosure are clean; blocked by retained unsigned bot commit280f7725. - §5 Evidence & CI: Blocked on missing
main-branch CI workflows (onlypolicyran) and post-rebase forced-failure verification.
Assisted-by: LLM (Gemini 4 Neon)
…TS.md Aurora agent policy: remove assistant instruction files that are not policy copies, and sync AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md to .github/aurora/AGENTS.md on main.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-reviewed at 30ca5d5c3f11da325eb1e10d683801cd2d0aa9a1 against the pre-PR checklist (§1–§6).
Diff since prior review (c3f2e443cf52..30ca5d5c3f11)
- No code or test changes since
60c1269572ac. The only new commit is30ca5d5c3f11(github-actions[bot],agent-policy: sync assistant instruction files to .github/aurora/AGENTS.md), updating the four assistant instruction files (+47/-0net unrelated diff across60c12695..30ca5d5c).
Blockers
- §4 Commit hygiene (
280f77259115,30ca5d5c3f11): Branch history now carries two unsignedgithub-actions[bot]commits without humanSigned-off-by:(plusc3f2e443cf52), leaving unrelated diffs on.github/copilot-instructions.md,AGENTS.md,CLAUDE.md, andGEMINI.md. - CI
action_required& non-mainbase (j713/ans-start-reboot,#401still open): Both Actions workflows triggered on30ca5d5c3f11(esp-stage2-size,aurora-agent-policy) ended incompleted / action_requiredwith 0 check runs executed (mergeStateStatus = UNSTABLE), andbuild,test(Pytest),format-check, andstage1-sizehave still never run in CI on this PR because it does not targetmain. - §5 Evidence on the rebased head: Please rebase cleanly onto
main(dropping the bot/policy commits and splitting off#401's failed-boot-count dependency as planned), get full CI green, and re-verify the forced handoff-failure trial reboot row on that new head (plus the non-trialreboot -> reboot -> proxyrow under a count-passing Stage 1 if the counted path stays in scope). Prior non-blocking defensive notes (usb_cdc_cleanup()cdc.statereset,fb_set_active(true)on handoff-failure paths underFB_SILENT_MODE, and the stale\nvoid proxy_fallback(replacement intests/python/test_nvme_start_reboot.py) remain good to fold into that rebase.
Assisted-by: LLM (Gemini 4 Neon)
Stacked on #401 (base
j713/ans-start-reboot); it uses #401's failed-boot count andpmu_chain_leave().Problem
An aura-try trial that ends up in the proxy strands the Mac until someone holds the power button. The trial path only reboots when the stage finds no payload. The NVMe and display handoff failures go straight to
uartproxy_run()with no trial check. Otherwise, getting out depends on the trial watchdog alone.#401 added a second, separate decision for one case (a post-M4 ANS that a Stage 2 can't start from off): reboot while the chain's failed-boot count is under 2.
Change
One function,
proxy_fallback(), now sits in front of every proxy stop that has no host:run_actions()),It waits 15 s for a host, then reboots:
PROXY_FALLBACK_REBOOTS(2). "Failed to start" means a load that returned an error, or a refused handoff (ANS start, NVMe or display handoff). An image with nothing to start stops in the proxy as before. This is payload: reboot, bounded, when a Stage 2 can't start ANS from off #401's rule, extended from the ANS start to every failed start. A failure that persists still ends in the proxy after two reboots. A stage handed no count keeps the proxy, as before.A normal Stage 2 now leaves the chain (clears iBoot's count) after both handoffs, right before vectoring, not before them. A handoff that fails still finds the count it reboots on.
A host that syncs within the window keeps the proxy, and
run_actions()then doesn't bring USB up under it. On a trial, the trial watchdog still bounds a host's session, and the panel says so. The old trial-only reboot inrun_actions()and the ANS-only decision inpayload.care now this one path. No chip, board or firmware checks; the window is shorter than the trial watchdog.Testing
CHAINLOADING=1) builds too.format-checkpasses with clang-format 20.1.8. Stage 2 (RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1) builds with gcc.test_nvme_start_reboot.pyruns the realproxy_fallback()against the iBoot count model, with new trial cases:main.c's order, and fails if the chain leave moves back before the handoffs;test_proxy_fallback.py:main.cgoes throughproxy_fallback(), andrun_actions()has no second trial path;uartproxy_wait_host()ends at the deadline with no host, and returns early, presynced, on a host's sync word over USB or DockChannel;run_actions()path): it came back by itself the same way, at 52 s.The J713 rows ran on the first commit (fb9b62f). The trial paths they cover are unchanged on this head.
Still to run
Details for reviewers
Stage 1 scope: Stage 1 builds the same
run_actions()and handoff code. A Stage 1 that took a trial marker and then fails its own handoff to the trial Stage 2 now reboots instead of stopping, which lands on the configured image. The hardware evidence here covers Stage 2 only, and shipping a Stage 1 with this needs the owner's sign-off.Trial reboot:
pmu_chain_leave()runs first, as forrun_actions()'s other deliberate reboots. iBoot still counts the reset itself, so after a failed trial the configured image gets one reboot of its own before the proxy (trial-fails-configured-fails).Counted reboot: the count is not cleared, as in payload: reboot, bounded, when a Stage 2 can't start ANS from off #401. A host attach and the proxy decision both leave the chain (
pmu_chain_leave()) before the proxy runs.uartproxy_wait_host()uses the same sync check as the Stage 1 windows (uartproxy_sync_iodev()) and hands the synced iodev touartproxy_run()as presynced. It doesn't start USB or schedule CDC, so it only listens where the stage already brought a carrier up.run_actions()brings USB up right before the fallback, as it did before the proxy.The window (15 s,
PROXY_FALLBACK_HOST_MS) matches the aura-proxy request window. The test asserts it is under half ofWDT_TRIAL_SECONDS, so the stage's own reboot, with its log line, comes first.Behaviour change for non-trial boots: with a count from Stage 1, a Stage 2 that finds no payload or fails a handoff now reboots up to twice before the proxy, where before only the ANS start failure did. Without a count (every enrolled Stage 1 today), nothing changes.
Assisted-by: LLM (Claude:Opus 5.5)