3.1 KiB
10 — Scheduling, cancellation and resource budgets
Status: PLANNED; no implementation claim Requirements: R-011,R-021 Dependencies: 03,05,09; coordinates11,15 and18 without sharing mutable compiler state.
Ownership and boundaries
Proposed Astra for admission/revision logic; Sol for bounded queue/metrics helpers. NEW include/vls/scheduler/, src/scheduler/, tests/scheduler/; root owns shared priorities/limits. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository.
Contracts and data flow
Foreground requests outrank background indexing and artifact preparation. Every task has a revision, cancellation token, resource estimate and publication predicate. Debug admission is separate from semantic worker capacity. User-configurable budgets are validated, observable and never interpreted as permission to exhaust the host.
Implementation sequence
- Reuse verified Void Async/Time primitives for queues, cancellation and monotonic clocks; inspect actual backpressure/join behavior rather than infer it from class names.
- Coalesce superseded document work, reserve foreground capacity, avoid priority inversion on module dependencies and limit concurrent compiler states. Make queued cancellation cheap and running cancellation bounded.
- Track worker lifetime, memory, CPU, wall time and aggregate admission. Include deliberate pauses in memory accounting while excluding them from running watchdogs. Monitor and reap all owned descendants.
- Expose local metrics for cold/warm latency, queue delay, cancellation, cache misses and resource failures. Record the benchmark host and workload; do not turn measurements into unverified guarantees.
Failure behavior and constraints
Failed admission returns a useful resource/readiness status without blocking protocol handling. Watchdogs distinguish an intentional debug stop from a stuck running process. Failed/cancelled task results cannot satisfy cache/publication promises. Cleanup must handle a process-group leader exiting before descendants.
Acceptance scenarios
- Saturate background indexing and module builds while issuing foreground queries; measure p95 with and without an admitted paused debug session.
- Race edit/context cancellation with completion/publication and assert exactly one terminal result per request.
- Inject a zero-CPU stall, memory excess, lost child and disconnect; verify deadline enforcement, process reaping and bounded queue/memory growth.
Verification and integration
Proposed NEW CTest label: scheduler. Once implemented, register a nonzero suite and run:
dev cpp-gcc -c ctest --test-dir build/bootstrap -L scheduler --output-on-failure
This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Restore prior scheduling policy behind the same revision contract; drain/cancel obsolete queues. Keep resource-limit diagnostics/evidence instead of silently increasing limits after failures.