qemu: wait for the UI test hook to answer a ping before the first override (flare-edge#2602) #39

Merged
noah merged 1 commits from rb/ln-hook-ready into rebuild 2026-10-30 22:29:59 -06:00
Owner

Refs flare-edge#2602 (the SDK half; the flare-edge half is a pin bump after this merges).

Why

QEMU flow relays/failsafe-ack-sends-trip-count failed at its first step after boot, override io/state/failsafe ..., with bridge: hook request got no answer (client exit 2): wthctl: no reply (-5) (proof run 10128 job 114970 twice, nightlies 9727 and 9462).

  • -5 is WBUS_E_TIMEOUT, not WBUS_E_NOSUB: the UI was subscribed, but did not take the request within wthctl's 5 s.
  • The request carries a 5 s message expiry. Attempt 1 never applied the pin (the message expired in the broker queue); attempt 2 applied it after the client gave up.
  • The UI's bus came up just before the drive started and was still taking the broker's retained replay under its per-tick budget (WBUS_TICK_PACKETS, WBUS_TICK_BUDGET_US).

What

  • qemu/tests/qmp.py: hook_wait_ready. A run's first hook request is sent only after the UI's hook answered a ping. ping changes nothing, so it is retried while the bridge reports no answer, up to HOOK_READY_S (90 s, 1 s apart); the override goes out once. A ping that is answered but not ok ends the wait without marking the hook ready, so the override's own reply decides. A hook that never answers is a fatal step naming the ping count.
  • qemu/tests/test_qmp_drive.py: 3 new cases (the override waits for a ping that is lost twice; a hook that never answers is fatal and gets no override; a refused ping leaves the verdict to the override), and the existing pieces and pin/unpin cases account for the ping.
  • qemu/README.md: one paragraph.

Gate on bfe-mpc-0056 (lane-remote)

  • python3 -m unittest qemu/tests/test_qmp_drive.py: Ran 86 tests, OK.
  • Mutant (the wait removed from verb_override): 4 failures and 1 error, including all 3 new cases.

The real proof is the flow in a QEMU run on the flare-edge pin bump; one run can only show it does not break the flow, since the failure is intermittent.

Generated with Claude Code
https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG

Refs flare-edge#2602 (the SDK half; the flare-edge half is a pin bump after this merges). ## Why QEMU flow `relays/failsafe-ack-sends-trip-count` failed at its first step after boot, `override io/state/failsafe ...`, with `bridge: hook request got no answer (client exit 2): wthctl: no reply (-5)` (proof run 10128 job 114970 twice, nightlies 9727 and 9462). - -5 is WBUS_E_TIMEOUT, not WBUS_E_NOSUB: the UI was subscribed, but did not take the request within wthctl's 5 s. - The request carries a 5 s message expiry. Attempt 1 never applied the pin (the message expired in the broker queue); attempt 2 applied it after the client gave up. - The UI's bus came up just before the drive started and was still taking the broker's retained replay under its per-tick budget (WBUS_TICK_PACKETS, WBUS_TICK_BUDGET_US). ## What - `qemu/tests/qmp.py`: `hook_wait_ready`. A run's first hook request is sent only after the UI's hook answered a `ping`. ping changes nothing, so it is retried while the bridge reports no answer, up to `HOOK_READY_S` (90 s, 1 s apart); the override goes out once. A ping that is answered but not ok ends the wait without marking the hook ready, so the override's own reply decides. A hook that never answers is a fatal step naming the ping count. - `qemu/tests/test_qmp_drive.py`: 3 new cases (the override waits for a ping that is lost twice; a hook that never answers is fatal and gets no override; a refused ping leaves the verdict to the override), and the existing pieces and pin/unpin cases account for the ping. - `qemu/README.md`: one paragraph. ## Gate on bfe-mpc-0056 (lane-remote) - `python3 -m unittest qemu/tests/test_qmp_drive.py`: Ran 86 tests, OK. - Mutant (the wait removed from `verb_override`): 4 failures and 1 error, including all 3 new cases. The real proof is the flow in a QEMU run on the flare-edge pin bump; one run can only show it does not break the flow, since the failure is intermittent. Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah added 1 commit 2026-10-30 22:07:28 -06:00
qemu: wait for the UI test hook to answer a ping before the first override (flare-edge#2602)
ci / quality (pull_request) Successful in 1m43s
ci / badges (pull_request) Skipped
ci / test (push) Successful in 11s
ci / prune-artifacts (push) Skipped
ci / quality (push) Successful in 26s
ci / qemu-tools (push) Successful in 4m32s
ci / kernel-symbols (push) Successful in 5m22s
ci / bench (push) Successful in 11s
ci / mcdc (push) Successful in 21s
ci / kernel-build (push) Skipped
ci / badges (push) Skipped
ci / patches-apply (push) Successful in 54s
ci / mcdc (pull_request) Successful in 18s
ci / bench (pull_request) Successful in 15s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / patches-apply (pull_request) Successful in 40s
ci / qemu-tools (pull_request) Successful in 2m3s
ci / kernel-symbols (pull_request) Successful in 3m59s
ci / test (pull_request) Successful in 26s
61ecfac844
Right after boot the UI is still taking the broker's retained replay under
its per-tick bus budget, so a hook request queued behind it missed wthctl's
5 s bound and its own 5 s message expiry: the failsafe-ack flow's first
override was lost, or applied with its reply lost.

qmp.py now sends a run's first hook request only after the hook has
answered a ping. ping changes nothing, so it is retried while the bridge
reports no answer, up to HOOK_READY_S (90 s); the override itself goes out
once. A hook that never answers stays a fatal step with its own message.
Three offline tests in test_qmp_drive.py; removing the wait fails them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah merged commit 0232823855 into rebuild 2026-10-30 22:29:59 -06:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blueflare/bfe-core1106-sdk#39