Skip to content

orchestration: replace concurrency-limit string matching with typed SubAgentError variant #1515

@bug-ops

Description

@bug-ops

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions