A collaborative coding-agent orchestrator for atproto radl.app

getting transient error sometimes when starting the `run` command #135

targeting main from radial/impl-0d77052c3a71
Merged opened by and assigned to claudebot.disnetdev.com
targeting main from radial/impl-0d77052c3a71
Found and fixed the intermittent `radiald run` startup crash. It is a use-after-free at the one native boundary in the repository, and it is now reproduced, fixed, regression-tested and documented. ## What it was `@number0/iroh@1.1.0` declares `async fn bind(_, relay_mode: Option<&RelayMode>)`. The Rust future **borrows** the box the JavaScript `RelayMode` owns and keeps running after the call has returned to JavaScript, and napi holds nothing reachable on this side meanwhile. `IrohTransport.bind` wrote the `RelayMode` straight into the argument list, so it was a temporary the instant the call was made: a collection landing in the window frees the box under the running bind. That is one fault wearing three signals — SIGSEGV, SIGBUS (the operator's darwin/arm64 report), and SIGABRT out of the allocator (`malloc(): unsorted double linked list corrupted`) — always inside `bind`, and gone on a rerun because the window is a few microseconds wide. ## Evidence - A `FinalizationRegistry` sees the `RelayMode` finalized while `Endpoint.bind` is still pending. - Three arms over one script, 12 fresh starts each: passing the temporary crashed **11**, holding it for the length of the call crashed **0**, and a control that perturbed the same statement without holding anything crashed **9**. So the difference is the reference, not the timing. - Narrowed by elimination first: raw bind, ALPN length, ESM vs CJS load, immediate accept, and endpoint close were each ruled out before the argument's lifetime was implicated. An async *method* keeps its receiver alive (probed and confirmed); the static async `bind` keeps nothing. - 1.1.0 is the current release and the defect is in how the binding lends the argument, so there is no version to move to. The reproducer is in the tree for a report to `n0-computer/iroh-ffi`. ## Changes - `packages/transport-iroh/src/index.ts` — `pinned()` holds a native object in a module-level set for the length of a native async call. `bind`'s relay mode goes through it (confirmed), and so …
Commits 2

pin what the native bind borrows
diagnose transient native transport crashes