AWESOME-OS ENGINEERING BLOG
05 — Full-Speed Internal, Paced Legacy Host: Inventing the Host Debugging Facade
05 — Full-Speed Internal, Paced Legacy Host: Inventing the Host Debugging Facade
Anchored Code:
- Portable B8G-SECT-1 Core: intersections/host-debug-facade/index.mts
- HostfsyncFlight Recorder & 8 s Auto-Exit:intersections/host-debug-facade/flight-recorder.host.mts
- Unifiedbin-shimCLI (bin\host-debug.ps1):intersections/host-debug-facade/cli.host.mts
- Livecanvas-branchIntegration:sections/canvas-branch/cli.host.mts
1. A New Class of Problem: Crash-Log Starvation on Legacy Hosts
During verification of @awesome-os/b8g-layout (5,000-node flat-array layout solving in ~7 ms) and sections/canvas-branch (native wgpu + winit + glyphon IPC rendering), we hit a genuinely funny and revealing systems problem:
- Inside Awesome-OS / B8G, flat
SharedArrayBufferstate transitions, CoW branch snapshots, and 48 B/quad projections run at microsecond / sub-millisecond full speed. - At the Legacy Host OS boundary (
.host.mts— Windows 11 DX12/Vulkan swapchain presentations, Win32 pipes, process spawns), firing un-debounced bursts into a legacy GPU driver — especially on hardware with marginal CPU or RAM timings — can hard-reset the host machine before the legacy OS even has time to flush its own crash logs to disk.
Slowing down the internal microkernel would be a crime. The bug isn't inside Awesome-OS — it's the impedance mismatch at the legacy host boundary.
2. The Solution: HostDebugFacadeIntersection
We introduced a dedicated B8G-SECT-1 Intersection (intersections/host-debug-facade/) that sits strictly on .host.mts boundary layers:
- Internal B8G Full Speed (
internalside): Zero throttling oncomputeFlatLayout,computeWindowManagerLayout, CoW branching, or SAB mutations. Every internal call still executes immediately and incrementsinternalOpsTotal. - Legacy Host Back-Off (
hostside): - Latest-Wins Burst Coalescing (
debounceMs): 250 rapid internalgpu.presentmutations collapse into 1 paced host submission with the latest frame. - Per-Channel Pacing & Burst Cooldown (
minIntervalMs,maxBurstPerWindow,cooldownMs): Prevents hammering a legacy GPU driver or IPC pipe. - Synchronous
fsyncPre-Crash Breadcrumbs (BEFORE/AFTER/ERROR): Before crossing into the legacy OS,HostFlightRecorderSinkappends a sequenced NDJSON breadcrumb to.b8g-logs/host-flight-recorder.ndjson, callsfs.fsyncSync, and waitspreCallBreathMs. After the host call returns, it flushesAFTERand waitspostCallSettleMs. - Post-Mortem Suspect Detection (
detectUnfinishedCrashBreadcrumbs): After a hard reboot, anyBEFOREbreadcrumb with no matchingAFTERorERROR(or a truncated final line) pinpoints the exact legacy host boundary call and payload that was in flight. - 8-Second Safety Auto-Exit Watchdog (
autoExitMs: 8000): Armed automatically indiagnosticandparanoidprofiles so a stuck GPU overlay can never lock the legacy desktop (disable anytime with--auto-exit 0).
3. Unified Usage via @awesome-os/bin-shim
bin\host-debug.ps1 profiles # inspect off|gentle|diagnostic|paranoid
bin\host-debug.ps1 inspect # detect unfinished BEFORE crash suspects
bin\host-debug.ps1 run --profile diagnostic -- canvas-branch # paced + fsync breadcrumbs + 8s auto-exit
bin\host-debug.ps1 run --profile paranoid -- dev-catalog wgpu # wrap any bin/ host tool safely