Support native Apple build profiles and persistent warm caches
Native Apple development needs stable compiler state and separate preparation, code-check, and app-build operations. This adds native macOS execution to glaeda-hot-run and a trusted Apple build front door for SwiftPM, Xcode, and project helpers, using the canonical checkout without Linux OverlayFS or duplicate task checkouts.
The helper routes project/toolchain cache paths, serializes project work, records child groups and interrupted generations, and keeps preparation, check, and app-build receipts separate through recovery. Read-only plan/explain commands expose reuse decisions. Normal builds always execute native validation. Optional dependency readiness checks declared input and required-file fingerprints under the same lock; it does not certify every downloaded byte.
An opt-in native cache policy now retains the existing cache across helper and profile changes. The first executed operation binds the project/profile/engine/toolchain/generation lineage, including when dependency preparation is reused. The exact current invocation is still revalidated under the lock. Toolchain changes and explicit generation resets retain a cold path; quarantine still refuses reuse. No cross-project writable sharing or automatic cache deletion is introduced.
SwiftPM profiles can explicitly trial incremental file hashing and driver diagnostics. Xcode profiles accept native compilation-cache settings. Completed receipts retain bounded advisory task timings and cache-hit totals when native logs provide them, excluding source paths and raw text. Telemetry failure cannot strand a completed build or authorize reuse. A local benchmark creates and removes its own Swift fixture, exercises real Git and dependency updates, and validates every executable result.
Integrations: teamleaderleo/cmux#57 and teamleaderleo/idlesse#101. cmux has matching tagged check/full-build compiler trials; Idlesse retains its existing app builder. Terminal Kit continues routing its native warm/build front door through Glaeda.
Validation at a1cb8a2689b7c8d0bd1739e9e585128495139dd9:
- 27 portable policy tests and independent exact-head review passed, covering ownership, locking, recipe races, lineage binding, quarantine, readiness, telemetry bounds, and failure settlement.
- Bootstrap, formatting, all-target/all-feature Clippy and full Cargo tests passed with the documented Mac temporary-directory/test-concurrency accommodation. The later generic Linux-host doctor is inapplicable to native Mac execution; subsequent generic stages did not run.
- All 18 Swift fixture cases at adc192c (before the final singular/plural telemetry grammar fix) passed with validated executable outputs: hashing off/on across unchanged/timestamp edits, implementation edits, reverts, branch return, public API change, real fast-forward pull, and a real local dependency-version update. The timestamp-only hash-enabled run skipped compilation. Fixture timing runs overlapped app warming and are correctness evidence only.
- The owned Xcode fixture validated native compilation-result reuse and correct executable outputs; revert and return each reported 2 hits / 2 cacheable tasks. Its caches stayed under its DerivedData and were removed with the fixture.
- Actual cmux hashing trial: timestamp-only check 45.664s with zero SwiftCompile tasks, versus 57.683s in the earlier baseline. The object bytes and modification time stayed unchanged. Module emission (12.853s) and driver work (9.956s) remained. Single active-Mac observations, not a controlled percentage speedup; initial compiler-option warming is separate.
Actual cmux compilation-result caching produced 3/3 hits on reverts and branch returns, reducing module emission to 0.562 s in one replay, but checks took 65–76 s versus 51–55 s for hashing-only edit/revert observations. It remains opt-in and is disabled in the everyday profile. These active-Mac trials establish reuse, not a controlled speedup.
This remains cooperative trusted native development. Helpers must join their children; detached sessions remain outside the contract. Upstream ideas remain local notes. Related to #750.
Final validation: the full tagged build at clean cmux commit d44bc1b4bbc477349dd5d004a9827587ad4fd29c succeeded, retaining the existing cache key. Restoring the default compiler configuration took 1,623.002 s (27.05 minutes), a compiler-setting rebuild rather than a normal incremental update. A subsequent comment-only helper edit changed invocation identity but retained the cache, reported zero SwiftCompile tasks, and preserved the full-build receipt; wall time was 30.737 s. The helper was restored byte-for-byte with its original modification time. Strict deep signature verification passed, the exact tagged app was relaunched, and the Tact sidebar validated and was selected.
Agent build coordination at ddc4f37be910f400c7ce272671eb85ba8781a8fd: native execution accepts --wait-seconds 0..3600 after initialized-state ownership validation. Default zero preserves immediate contention refusal. Waiters revalidate the current recipe/toolchain and recovery state after acquiring the lock, then run native validation. Existing dependency-readiness reuse can share already completed preparation after its checks pass. This is bounded admission, not FIFO scheduling, source-edit locking, native-result coalescing or background warming. Timeout/cancellation does not interrupt the active owner; SIGINT returns bounded JSON/status130.
32 policy tests passed, including contention, timeout, cancellation and changed-recipe admission. Independent review accepted the final head. A physical initialized-project fixture ran three simultaneous request processes as three non-overlapping native executions, all successful in 1.348 s. This is a serialization check, not an app-build speed benchmark. Full required verification at bc6a7b1 (same executable/test bytes; final change is documentation only) passed bootstrap, format, Clippy and Cargo tests, then stopped at the inapplicable Linux doctor on Mac. The installed snapshot was updated and successfully exercised cmux dependency readiness.
On-demand native request workers at 8bc8e564e43230a7c66a3cfa0d7d01851f8db040:
- Agents submit
check,dependencies, orbuildrequests and receive an id without waiting for native execution. A detached worker starts on demand, owns a separate project worker lock, and exits when idle. No launch service, timer, network endpoint or always-running daemon is installed. - Equivalent pending requests share one latest-source native execution after a short batching delay. Requests arriving during execution stay pending for a later batch. Runtime/recipe drift fails closed; normal native lock/recovery validation remains in force.
- Atomic bounded request records support read-only listing/status and explicit terminal collection/removal. A replacement worker marks abandoned running requests interrupted, including crashes after native completion; it never infers success or automatically replays those requests. Normal idle exit releases worker ownership under the enqueue lock to avoid lost wakes.
- 45 policy tests passed, including idle-exit enqueue, crash-after-native-completion, configuration drift, spawn failure, ledger bounds and installed-file exception handling. Independent exact-head review accepted the change. Bootstrap, formatting, Clippy and Cargo tests passed; the generic required script then stopped at its inapplicable Linux-only doctor on Mac, and later generic stages did not run.
- Installed Mac trial: three simultaneous full CLI cmux submissions returned in 0.163/0.224/0.223 s and shared exactly one native check. All request results completed in 15.091 s with clean unchanged source observations. These are active-Mac observations, not a compiler speedup claim. The test request records were collected/forgotten; native receipts and caches remain intact.
Scope: initialized trusted checkouts; latest source at execution, not pinned revisions. Source edits remain cooperative. Clients collect results by id; push notifications to agent tasks, editor watchers and scheduling priorities are not implemented. The ledger is bounded to 32 requests/64 KiB; explicit terminal collection frees capacity. wake resumes pending work after an interrupted/missed wake, while native interrupted work still requires exact-run recovery.
Native refresh and event-based completion
Adds plan-refresh/refresh to batch dependency-readiness validation and an incremental check, plus bounded wait-request collection using native filesystem events for active agent runners. Fixes the atomic ledger replacement race exposed by the event test. Explicit required-file presence matching avoids optional resolver churn from mutable workspace metadata; native build validation remains enabled.
Validation: 57 policy tests and independent exact-head review pass. Required formatting, Clippy and Cargo tests pass; the Linux host doctor remains unsupported on macOS. A real cmux trial submitted three refreshes in 0.425–0.487s and completed one shared check through event waits in 18.831s, with resolver readiness reused. This does not reopen or message closed Codex tasks, install Git hooks, or reuse historical compilation success.