Bound task runtime execution and recovery futures

Merged
VA
3d ago
+1221-917

Problem

Task execution and recovery retain large futures and poll frames, overflowing a default 2 MiB test thread. The original size assertions missed deadline, execution, model-step, run-task and execution reconciliation.

Design

Use the existing funded future builders at execution, recovery, command dispatch and filesystem publication boundaries. Select the execution/publication path before constructing its future; separate preparation, mutation and commit phases. Drop the BLAKE3 scratch state before awaiting the worker step. Measure every reviewed public path against 4 KiB, plus command and worker dispatch futures.

Deletions

Remove inline future construction and the generic publication guard whose only caller supplied a no-op. Delta against main 61c5cd430: +1221/-917, net +304; most churn indents existing bodies into the builders.

Decisions

  • Substrate decision 10: all harness communication uses stream transactions and follows. Agent-to-agent handoffs use atomic appends plus filesystem publication; clients submit appends/request files and follow the multiplexed Streams session. No actor WebSockets or virtual channels are used.

Keep native allocations on the original work ledger and retain lease/custody/error behavior. Preserve the expired-deadline gate before constructing execution. Preserve the existing deadline clock semantics; clock and actor scheduling are outside this stack fix. Ship independently of #495. Under substrate decision 6, these funded execution boundaries are shared by the actor package and local in-process runtime; no service, gateway or wire surface is added. LocalHarness composes that runtime and GraphCoder/Pi will use the shared client API.

Latest review fix

Signed commits a9299d68c and 7ad7330aa construct reconciliation progress before entering the observation future and select it directly against the timer. This removes the outer and observation heap frames, retaining one funded progress allocation. A real allocator-count regression checks valid construction and rejection polling, with owned diagnostics counted separately. Both size/allocation tests passed in 0.04 s at 7ad7330aa, and all six model recovery cases passed in 0.27 s with RUST_MIN_STACK unset. Reconciliation is 1136 B, progress 488 B; all reviewed futures remain below 4096 B. Signed merge 498739d24 resolves the dependency conflict with main without changing these functions. The final merged-head build is queued through bs.ps1.

Tests run

All runs used the built standard-profile binary on bb1 through bs.ps1, with RUST_MIN_STACK unset and the default test-thread stack. No observation allowances or stack limits changed.

  • Task-runtime: 26 passed, 0 failed, 1.63 s, including native original-lost-ack recovery and settlement.
  • Full size probe: deadline 592 B; execution 3816 B; execution progress 3160 B; model step 696 B; run task 3976 B; worker dispatch 488 B; run task observed 1880 B; resume 2440 B; execution reconciliation/progress 488 B; native open/reopen 904 B, resume 3848 B, reconciliation 3904 B. Every reviewed path is bounded by 4096 B.
  • Command future regressions: 2 passed, 0.00 s (model command 2256 B; dispatcher 14352 B).
  • Filesystem publication/grants: 4 passed, 0.05 s.
  • GDB profiling sorted actual poll-frame sizes and identified command-path unions, publication phases and retained hashing scratch as root causes.
  • git diff --check passed.

Live steps

The actor lane must verify platform outbound HTTPS, bash compute and secret bindings. Local execution continues through the in-process runtime; these hosted capabilities do not block this stack fix.

Additional consumer checks found two native content regressions (hash-denial shape and retained allocations) and a 4696 B run_operation future in the LocalHarness overlay. These remain under investigation; this PR is draft until the relevant checks are resolved.