- Audit roadmap vs TASKS (D-033); scope Wave 11 to M-FUNCTIONAL-03, M-TIME-03,
M-ASYNC-04/05, S-IO-03/04, S-RUNTIME-02/03 (D-034..D-036)
- Schedule VoidForge upstream requests after Wave 11 (D-037)
- Persist planner output, PREFLIGHT findings and contract addendum (D-038)
- Add AsyncErrorCode::closed, IoErrorCode::sync_failed,
RuntimeErrorCode::{self_join, shutdown_incomplete}
- Update Functional/IO/Runtime area plans and MIGRATION per C-13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 KiB
W11-PREFLIGHT output (opus-reviewer, 2026-11-29)
Verbatim agent return. Advisory input; root dispositions are recorded in DECISIONS.md.
Task: W11-PREFLIGHT. Verdict: CHANGES_REQUIRED.
The plan's direction is sound. The layering holds, no INTERNAL_DEPS change is needed, no two packages own a path at the same time, the gates G1–G5 contain no cycle, and almost every baseline claim matches the source. It is not yet complete enough to write specs from. There is one P1: the plan has no rule for what happens to driver teardown on a worker or poll thread. Eleven P2s need a fix or an explicit risk acceptance before dispatch.
Paths below are relative to /home/faumaray/Projects/VoidLibrary. "Plan" means docs/agent-workflow/tasks/W11-PLAN-OUTPUT.md.
P1
F1. S-IO-03: no destructor or teardown-thread rule once the driver owns threads. (Inferred defect if the spec is written as the plan reads.)
- Location: plan :542-548.
Driver::~Driveratsrc/IO/EpollDriver.cpp:1737-1742and~EpollBackendat :953-963 both callshutdown_and_join()and ignore the result. - Evidence:
Driver::poll_once(:1843-1847) does not hold its own reference to the backend during a turn.- Streams hold only a
weak_ptrto the backend (include/Void/IO/Detail/Backend.hpp:85-125). Stop forwarders lock it briefly (:279-285). So the last owning reference can drop on any thread.
- Trigger: the plan makes
shutdown_and_joinreturnself_joinon a worker or during poll dispatch, and makes it block until the poll turn and the workers finish. Then either:~Driveror~EpollBackendruns on a file worker or the poll thread. The self_join result is ignored, and a joinablestd::threadis destroyed or joins itself, which callsstd::terminate. Or the poll turn waits on itself and deadlocks.- The last backend reference drops on a worker or poller.
- Also, after
ThreadExecutor::jointhe plan resumes coroutines inline, so a coroutine can run on a file worker and destroy theDriveror aFilethere.
- Impact: abort or deadlock on the main teardown path every 1.x IO user takes (IPC, SystemAsync, CryptoAsync, Storage, Runtime).
- Fix: add mandatory invariants to the S-IO-03 spec:
- Only
~Driverdoes a blocking teardown. It defines what happens on a worker or poll thread: a documented programmer error such asterminate, or deferring the join to a safe owner. ~EpollBackendand~FileWorkersnever block and never destroy a joinable thread.- Workers and pollers never hold the last owning reference to the backend, or the pool's state is owned separately.
- Tests: Driver destroyed inside a coroutine resumed by poll dispatch, and inside a worker completion.
- Only
P2
F2. S-IO-03 shutdown step 5 opens a new fd-reuse hazard.
- Location: plan :547, "close the fds, epoll and eventfd".
- Evidence: in 1.x,
epoll_fd_andwake_fd_are closed only in~EpollBackend(:953-963).wake()reads a plainintand writes to it (:1033-1042).enqueue_cancel(:153-166) andrequest_stopcallwake(). - Trigger: S-RUNTIME-03 phase 7 shuts the driver down, then phase 8 stops the reactor, which typically calls
wake(). Late stop forwarders do the same. The write lands on a closed, possibly reused, integer fd. That is also a data race that TSan will report. - Fix: keep epoll/eventfd closure in the backend destructor (1.x placement), or guard
wake()with a lock and a closed flag. After shutdown,poll_oncemust return before touching any fd. 1.x already returns early oncestopping_is set (:1056-1058).
F3. S-RUNTIME-03 contradicts itself on exporter vs executor order.
- Plan :729-730 joins the executor (phase 8) before dropping component references (phase 9).
- The test at :742 asserts
exporter_destroyed < executor_joined. - Fix: drop exporter/component references after their stop finishes and before reactor/executor join (this matches the row name), or change the assertion. Decide in the spec.
F4. S-RUNTIME-03: a repeated join after expiry has no budget.
- Plan :719 fixes the total deadline at the first
begin_shutdown. Plan :734 says the next call continues. - After the first expiry, every later
shutdown_blockinghas zero wait budget. Thread joins and executor progress need real waiting, so "release → join again → complete" (:742) becomes a busy loop or a flaky test. - Fix: after a total-budget expiry, later calls use the caller's new deadline. Expired phase deadlines (drain, flush) stay expired. Also say explicitly that an incomplete phase stops the sequence; plan :728 "if incomplete, retain it" is ambiguous.
F5. Host lifecycle holes.
- Move-assignment:
Host& operator=(Host&&) = default(include/Void/Runtime/Host.hpp:91) destroys the overwritten state through theunique_ptr<HostCore>without running~Host. If teardown lives in~Host(plan :661), move-assigning over a started Host leaks joinable threads, andstd::thread's destructor terminates. Put teardown in~HostCoreor write a custom move-assignment. - Moved-from Host: accessors like
options()andstate()need defined behaviour when the core is null. ~Hoston a Runtime worker: behaviour is unspecified. The roadmap calls it a detected programmer error.~Hostoff the owner thread: a non-owner destructor cannot restore the mask, andSignalWatchersilently skips the restore off-thread (src/System/SignalWatcher.cpp:27-37). The plan (:731) must say whether the gate is leaked or uninstalled without a mask restore.
F6. Embedded mode would shut down borrowed resources.
- Phase 7 calls
driver->shutdown()and phase 8 joins the executor unconditionally (plan :728-729). In embedded mode both are borrowed (include/Void/Runtime/Host.hpp:31-56). The roadmap says borrowed resources must outlive final cleanup. - Fix: tear down by
ResourceOwnership. Embeddedshutdown_pumpingdrains only the business scope and components, and must drive IO and timers throughpump_until;TaskScope::join_pumpingnever polls IO (include/Void/Async/TaskScope.hpp:639-647).
F7. AsyncChannel: hand-off vs stop/close arbitration is unspecified (value-loss risk).
- Plan :327-344 states only the outcomes.
- Fix: mandate that a waiter is claimed under the channel lock before a value moves; the stop callback must take the same lock to remove a waiter; a value is never in limbo; a sender gets either success or its value back, exactly once.
- Add a receiver-stop test (no value lost).
F8. Retry: the default URBG is deterministic.
- Plan :102, :137 and :228 default-construct
std::mt19937_64, which always starts from the same fixed seed. Every process then draws the same jitter, which defeats jitter's purpose. - House convention seeds from
random_deviceunless a deterministic seed is given (include/Void/Functional/Retry.hpp:87;include/Void/Resilience/AsyncPolicy.hpp:487,525-529). - Fix: seed from
random_deviceby default; tests pass a seeded engine.
F9. D-W11-05 routing: sonnet takes the riskiest code.
- A4 (sonnet) rewrites the bounded, repeatable shutdown, poll-owner exclusion, manual-clock-sliced waits and
run()concurrency in the samesrc/IO/EpollDriver.cppB2 just changed. That is astra-level work. - Fix: B2 delivers an internal deadline-aware shutdown/poll-owner primitive; A4 only adds the public wrappers,
pump_untiland tests. Or route that part to opus.
F10. C-13: area plans must be updated before parallel work.
- The plan changes contracts in area plans:
- Functional.md: the clock/sleeper adapter moves out of the separate Time header (D-W11-02).
- Runtime.md: awaited shutdown becomes blocking/polling APIs;
file_workersauthority. - IO.md: the "driver thread" model.
- Several row prerequisites change.
docs/roadmap/ARCHITECTURE.mdC-13 (:246-252) requires the decision ledger and area plans to be updated before parallel implementation.docs/roadmap/**is missing from the root-owned list (plan :786-790). Add a root step before dispatch.
F11. Within-step start failures are not covered (S-RUNTIME-02 acceptance).
- The
before_stephook (plan :652, :686) only injects failure between steps. - Not specified or tested:
- partial failure inside
start_file_workers() - the reactor thread constructor throwing
std::system_error std::threadthrowing insideThreadExecutor::start- the stop budget for components during failed-start cleanup.
- partial failure inside
- Fix: add an IO fault hook and
io_file_workers_partial_start_failure_joins_started, catch thread-creation exceptions, and bound the cleanup.
F12. Async lifetimes of borrowed objects.
- EventBus (Injected mode):
~TaskScopeskips joining when it runs on an executor thread (include/Void/Async/TaskScope.hpp:562-575). If~EventBusruns on a worker, dispatch frames can still touch the destroyed bus. Dispatch must reference only a shared core, or this must be a documented error.flush()semantics in Injected mode are also unspecified. - TimerHandle: move-only and may outlive its
TimerQueue(plan :198-199). It needs shared control state. - Bounded
parallel_for: "All started runners are always joined" (plan :358). Runners that were queued but not yet started would later touch the caller's stack. Either wait for all submitted runners (and document that nested use on the same pool is unsupported) or put runner state, including the copiedF, in shared ownership.
F13. File lifetime is unspecified.
~Filewith requests still in flight must defer the fd close until they drain; otherwise the fd can be reused while a worker still uses it.File::close_and_joinon expiry should returnincomplete_shutdown(exists atinclude/Void/IO/Types.hpp:32) and keep the fd and buffers.- The roadmap says workers keep the descriptor until the syscall returns.
P3
retry_blockingsignature: the template parameters have no defaults (plan :139-141), soretry_blocking(spec, fn)cannot deduceNowFnand the rest from the defaulted argument. Add the defaults.- Observable/Signal: queuing nested
(old, new)notifications and arguments requires copyableT/Args, which breaks 1.x compile for move-only types (D-029). Also state "state restored" precisely: the value stays new, as in 1.x. - S-IO-03 downstream build (plan :576): omits CryptoAsync, Runtime and ConfigurationAsync, which also depend on IO.
- Error kinds: Runtime
shutdown_incompletemaps totimeout, but IOincomplete_shutdownmaps toconflict(include/Void/IO/Types.hpp:50-52). Align them. - D1 regression test needs a seam: the double release isn't visible through the public API. Suggested deterministic trigger: an injected clock whose
now()requests stop. That call happens between the step-1 drain and the event dispatch (:1083). - Mock reactor spin: the mock
poll_onceignoresmax_wait(:739-740), so a Runtime reactor on a mock driver busy-spins under TSan. - Host business scope: the default
stop_on_first_error=true(include/Void/Async/TaskScope.hpp:32) means one failing business task stops all of them, against the roadmap's per-component failure policy. - MIGRATION records needed ("observable behavior" row):
shutdown_and_joinnow blocks and joins;validate_limitsrejectsmax_file_queue==0; Sync EventBus becomes snapshot dispatch; legacyparallel_forwaits for all tasks. - Unspecified: behaviour of concurrent
poll_oncecallers; who owns IO files after G5; a stop-and-report rule if B3 or B4 needs an IO edit; how Runtime detects that it is running on a file worker. - ThreadExecutor:
join()can drain forever ifpost()keeps re-posting after close.~ThreadExecutorwithoutjoinis unspecified.
D1 claims (all confirmed)
- (a) Unconditional release — CONFIRMED.
complete_op_and_collect_ticketsreleases at :448, even thoughretire_op_lockedis idempotent (:391-394).release_backend_refcannot be called twice safely (include/Void/Async/Operation.hpp:185-193); the count underflows. - (b) Cancel path doesn't skip finished operations — CONFIRMED (:1332-1351). The mock path does skip them (:770-781).
- Precise trigger: a stop arrives after the start-of-turn drain (:1053) while
drive_read/drive_writecompletes the operation (including their own stop check, :1453-1458 and :1527-1535). The end-of-turn drain (:1173) then releases a second time. - Impact the plan omits: if the waiting coroutine has not suspended yet,
try_arm_suspendsees a non-zero count and the coroutine hangs forever. Otherwise the counter is silently corrupted.
- Precise trigger: a stop arrives after the start-of-turn drain (:1053) while
- (c) Syscalls outside
mu_withoutin_execution— CONFIRMED.::readat :1466;::sendand::writeat :1549 and :1560.in_executionis used only by the mock (:653-671, 758, 774, 791, 847-850). - (d) Cross-thread shutdown — CONFIRMED (:1179-1238).
- It finishes operations regardless of whether a syscall is in progress (:1186-1206). The caller can then free its buffer while
::readis still writing into it. - It closes the fd (:1221 → :363) while the poller still holds the integer it read at :1151, so the number can be reused.
- Additional facet: when
~Driveris the shutdown path, the backend object itself can be destroyed mid-turn (F1).
- It finishes operations regardless of whether a syscall is in progress (:1186-1206). The caller can then free its buffer while
- "No test covers it" — CONFIRMED.
tests/standalone/IO/IoDriver.cpp:458-508cancels a read that never becomes readable and joins the poller before teardown.
Other source claims
- ManualExecutor bound — CONFIRMED.
postcounts without a check (include/Void/Async/Executor.hpp:128-135);run_onedecrements before resuming (:216-228). - SignalWatcher — CONFIRMED (
include/Void/System/SignalWatcher.hpp:13-15;src/System/SignalWatcher.cpp:27-37,74-90). - Host movable, default destructor, worker count always 0 — CONFIRMED (
include/Void/Runtime/Host.hpp:88-92,173). - Threads flags — CONFIRMED (
tests/package/InstalledComponents.cmake:73-79,104-112;cmake/VoidConfig.cmake.in:97). - Minor:
tests/standalone/Async/OperationScope.cpp:135is not a thread-backed executor; it wraps a ManualExecutor.
D-W11-01..15
| ID | Recommendation |
|---|---|
| D-W11-01 | Accept |
| D-W11-02 | Accept, and update Functional.md (F10) |
| D-W11-03 | Accept; label the pinned test as defect characterization and record it for Wave C |
| D-W11-04 | Accept. System requires Threads, so a Runtime→System edge would also break RuntimeOnly. Add the off-owner rules from F5 |
| D-W11-05 | Modify (F9) |
| D-W11-06 | Accept, provided a throwing error_sink is caught and counted and Sync propagation is unchanged; record the change |
| D-W11-07 | Accept |
| D-W11-08 | Accept, provided IOOnly/RuntimeOnly start a real worker thread with Threads disabled; record the libc-with-integrated-pthreads assumption (IO already relies on it at src/IO/EpollDriver.cpp:47) |
| D-W11-09 | Accept |
| D-W11-10 | Accept; it fixes a real use-after-free when caller-stack captures outlive a throw. Record the timing change |
| D-W11-11 | Accept, plus partial-start semantics (F11) |
| D-W11-12 | Accept (max_output_* unused in src/Net, confirmed) |
| D-W11-13 | Accept; record that the C-05 defaults are deferred |
| D-W11-14 | Accept; document that nothing polls a TimerQueue under managed Runtime, so channel deadlines and retry_async need caller-driven polling or pump_until |
| D-W11-15 | Accept; align error kinds (P3) |
Acceptance sentences not covered
- S-IO-04: "no IO→Runtime/Net dependency" has no check. Add
rg -n "Void/(Runtime|Net|System)/" include/Void/IO src/IO(expect no output) plus a diff ofsrc/IO/module.cmake. - S-RUNTIME-02: "failure at every creation/start step" only covers failures between steps (F11).
- S-RUNTIME-03: "exporter-before-executor ordering" contradicts the phase order (F3). "Budget accounting" is ambiguous: only the shutdown budget is tested, not memory or admission permits.
- M-ASYNC-04: no test for receiver-side cancellation.
- M-ASYNC-05: "no captured state in use after join" is tested only for Injected mode, not the legacy Async or Sync modes.
- M-FUNCTIONAL-03, M-TIME-03 and S-IO-03 are fully mapped.
Checks not run
- No builds or compile probes; every plan command is unverified.
- No Serena or codebase-memory coverage checks; all evidence comes from direct
sed/rgreads. - The advisor call timed out.
- Not inspected: the SystemAsync
ProcessManagershutdown path, IPC/Storage/CryptoAsync internals,docs/roadmap/VALIDATION.md,docs/roadmap/PERFORMANCE.md.
Re-review scope: the revised S-IO-03, S-IO-04 and S-RUNTIME-03 contracts (F1–F6, F9, F13), the AsyncChannel, Retry, EventBus and TimerQueue invariants (F7, F8, F12), and the area-plan updates (F10).