67 lines
4.7 KiB
Markdown
67 lines
4.7 KiB
Markdown
# 06 — Native execution, scheduling and process lifecycle
|
|
|
|
Implementation status: IMPLEMENTED & VERIFIED (2026-11-26). See
|
|
[STATE](../agent-workflow/STATE.md) and [VERIFICATION](../agent-workflow/VERIFICATION.md)
|
|
for implemented files and observed checks.
|
|
|
|
## Requirements and ownership
|
|
|
|
- Requirements: R-007, R-014, R-019.
|
|
- Delivery phase: Core native engine.
|
|
- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance.
|
|
- Dependencies: 03 validated actions; 04 driver commands; 05 immutable inputs; 07 success/publication protocol.
|
|
- Proposed exclusive implementation scope: src/execution/, src/platform/, include/vbs/execution/, tests/execution/; root coordinates shared platform APIs.
|
|
|
|
Before dispatch, reconcile these paths with the real HEAD, write a full task spec,
|
|
lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist
|
|
are NEW. Source-disjoint work still coordinates shared state, ports and build directories.
|
|
|
|
## Design and interfaces
|
|
|
|
- Schedule ready action nodes under a configurable global job budget and per-profile ownership. Dependents run only after all required producer artifacts are validated and published.
|
|
- Invoke executables through typed argv/cwd/environment, never implicit shell concatenation. Resolve absolute executables before launch and include the resolution in identity.
|
|
- Use explicit Void process APIs for spawn/communicate so exec failure, signal exit, timeout, cancellation and output overflow remain distinguishable. Drain both streams without deadlock and keep logs bounded without losing diagnostic state.
|
|
- Add a Linux lifecycle boundary that retains ownership of ordinary descendants through TERM, grace, KILL and reap. The pinned Child::terminate can return after leader exit; a supervisor/ownership implementation must prove the early-leader case before acceptance.
|
|
- Stage complete output sets. Validate files and dependency outputs before promoting artifacts or success records. Newly discovered unordered producer dependencies require replan/error; failed output is not usable merely because it exists.
|
|
- Do not hold global SQLite/cache transactions over child execution. Coordinate per-key claims and detect reentrant dependency/build cycles instead of deadlocking on nested tools.
|
|
|
|
## Implementation sequence
|
|
|
|
1. Implement process result/error mapping, streaming, argument fidelity and isolated temporary/output paths.
|
|
2. Implement profile/action ownership and ready-queue scheduling with bounded concurrency.
|
|
3. Implement cancellation/supervision and verify descendants cannot write after cancelled work returns.
|
|
4. Integrate output/dependency validation, publication ordering, failures and diagnostic event streams.
|
|
|
|
## Failure behavior and boundaries
|
|
|
|
- On fail-fast stop new work, cancel only owned processes according to policy and preserve useful logs.
|
|
- No destructive cleanup outside managed directories; interrupted work stays uncommitted.
|
|
- Crash, timeout, capture overflow, invalid dependency metadata and missing outputs have different diagnostics.
|
|
- Deliberately detached or undeclared external writers are outside the ordinary-child guarantee and cannot be represented as hermetic actions.
|
|
|
|
## Acceptance scenarios
|
|
|
|
1. argv/environment/cwd quoting; large concurrent stdout/stderr; exec failure versus program exit127.
|
|
2. Leader exits while grandchild ignores TERM; cancellation waits through escalation and prevents later output writes.
|
|
3. Parallel DAG ordering, missing outputs, signal failure, timeouts and two invocations competing for one profile.
|
|
4. Crash between output staging/publication/state commit and successful conservative recovery.
|
|
5. Generated dependencies first build and late-discovered unordered producer rejection.
|
|
|
|
## Verification and integration gate
|
|
|
|
NEW subprocess helper fixtures run with isolated temp roots and bounded deadlines. Execute real compiler DAG fixtures after lifecycle tests; collect child termination evidence, not merely the parent exit code.
|
|
|
|
Acceptance requires observed results for these scenarios, the affected regression
|
|
suite, reviewed cross-component contracts, and a fresh independent review. Record
|
|
unrun checks and environment limitations; tests passing alone do not waive an invariant.
|
|
No merge, push or deployment is authorized by a review verdict.
|
|
|
|
## VoidLibrary reuse and upstream candidates
|
|
|
|
Void::Process explicit spawn/communicate, optional async services only after source/runtime validation. Robust descendant lifecycle and bounded independent stream handling are potential upstream work.
|
|
|
|
Shared invariants and input/publication policies are defined in
|
|
[ARCHITECTURE](ARCHITECTURE.md); requirement authority is
|
|
[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to
|
|
[VERIFICATION](../agent-workflow/VERIFICATION.md).
|