fix-admission-deferrals

Fix admission deferrals tripping spawn breaker

Metadata

Statusdone
Assignedagent-889
Agent identityfbb2d89fe44d6b761bcb4b67748ab3d417f29df70a65f8d9403308f5bb2bab78
Created2026-07-26T10:15:00.296832886+00:00
Started2026-07-26T14:27:02.131802956+00:00
Completed2026-07-26T15:03:47.285470153+00:00
Tokens16429593 in / 22595 out

Description

Bug

A source task attempted to spawn while dispatcher.resource_management.max_build_agents=1 was occupied. The coordinator recorded build-heavy admission budget full (1/1) as five consecutive spawn failures within seconds, tripped the task circuit breaker, and marked the untouched task incomplete for evaluator review. Resource admission is expected backpressure, not an execution failure.

Scope and ordering

Implement against the authoritative lifecycle transition API after implement-authoritative-lifecycle; do not add a second status writer or a parallel coordinator state path. This task owns the admission-deferral classification and its status/metrics behavior before lazy evaluation changes consume candidate-completion events.

Fix

  • Classify build-heavy slot exhaustion and analogous transient admission-budget limits as admission deferrals, never spawn failures.
  • Leave the task open/ready with no retry-count, failure-charge, evaluator transition, provider-health charge, or circuit-breaker increment.
  • Retry on a bounded/backoff tick after capacity frees; coalesce/rate-limit logs.
  • Preserve genuine spawn failures (invalid route, process launch error, missing binary, worktree error) and their breaker behavior.
  • Surface deferred reason/count separately in service status/metrics.

Validation

  • Failing regression is written first: admission_deferral_never_becomes_spawn_failure_or_pending_eval occupies one build slot and proves a second build-heavy task stays open/deferred across more than five ticks; it fails before the fix.
  • Implementation makes the RED test pass, and when the slot frees the deferred task spawns exactly once without operator retry.
  • Never-attempted/deferred sources create no evaluator/FLIP record or satellite.
  • Provider circuit health is unchanged by resource backpressure; genuine launch failures still trip the breaker at the configured threshold.
  • A credential-free scripted terminal/daemon human flow displays the deferred reason, releases capacity, and observes the task run once; it does not call the transition helper directly.
  • The permanent live scenario is added under tests/smoke/scenarios/ and registered with this task in tests/smoke/manifest.toml owners.
  • cargo fmt --check, cargo clippy, focused tests, cargo build, and cargo test pass with no regressions.

Depends on

Required by

Log