Context
PR #1514 fixed #1513 by detecting transient concurrency-limit rejections via error.contains("concurrency limit") in DagScheduler::record_spawn_failure().
This is functionally correct but fragile: if the error message changes or gets wrapped with additional anyhow context, the substring match may stop working silently.
Suggested improvement
Add a typed SubAgentError::ConcurrencyLimit variant (or a dedicated SpawnError enum) so the caller can match on the error type instead of string content:
match err {
SubAgentError::ConcurrencyLimit => { /* revert to Ready */ }
_ => { /* mark Failed */ }
}
This would be a non-breaking internal change. Both spawn() and spawn_for_task() should return the typed variant when the concurrency cap is hit.
Related