Skip to content

Queue one-hop delegations while target agents are busy #449

Description

@lightcloud00

Problem

When an agent is busy, a delegated turn needs a durable, inspectable queue instead of being lost, recursively delegated, or ambiguously accepted. Retry identity must be scoped to the source turn: retries from one turn should deduplicate, while a later identical request should remain distinct.

Required behavior

  • Persist queue state as openmaus.delegations.v2 with bounded attempts and age.
  • Enforce one-hop delegation and strictly validate optional depth as a safe integer in range.
  • Generate and validate a sourceRunId for every source turn, propagate it through the agents proxy, and include it in the stable task hash.
  • Keep the response contract { state, taskId, duplicate, reason? } and terminal states completed | queued | failed.
  • Contain every drain failure, terminalize the exact task with a fixed machine reason, continue the batch, and avoid unhandled promise rejection.
  • Resolve dispatch only after provider submission and ownership marking succeed via a distinct onDispatchAccepted callback, without weakening onDispatchError.
  • Emit delegation.status lifecycle events and expose redacted state in the inspector.

Acceptance

Cover malformed depth, same-turn deduplication, later-turn identity, busy wakeup, restart recovery, retry/age expiry, late dispatch failure, thrown-drain containment, approvals, one-hop behavior, metadata redaction, and existing direct/webhook/peer flows.

Run focused delegation/proxy/index tests, typecheck, build, and the repository test floor before publication.

Boundaries

This is source behavior only. It does not activate unattended work, restart a live runtime, change provider defaults, expose credentials, or bypass approval policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions