Skip to content

An agent's message to a stopped agent runs ahead of the messages held in its queue #580

Closed

Description

@Jacksondr5

Split from #504 (Jackson, 2026-10-12).

What happens

Upstream queues a new message only when a turn is running on the thread. A held queue does not count as running. So after an agent is stopped with messages A and B held in its queue:

  1. Message C arrives from an agent and starts at once, ahead of A and B.
  2. When C's turn ends, A and B are still held. Nothing releases them.
  3. A message that arrives while C is running joins the held queue and is held too.

For a person this is upstream's design: they see the held messages above the composer, and choose between Resume and sending something new. An agent sender sees none of that and did not choose to jump.

Not seen in live data yet (two held turns ever, both removed before another message arrived). Found by reading the code at Orchestrator.ts (shouldQueue requires an active run).

Decided

Jackson, 2026-10-12: everything goes in order. "Receiving messages out of order is confusing for agents, I've seen that be the case."

When a message sent by an agent arrives at an idle receiver with a held queue, J5 resumes the queue and the new message goes to the back. This is a rule on J5's own delivery path:

  • No change to upstream's code, and none to what a person's message does.
  • The agent that did the stopping gets no exception: its new direction also waits behind the held messages.
  • An agent message therefore releases a hold that upstream leaves in place. Record it in D4 of the register, and update the j5_stop_agent and j5_stop_crew descriptions, which say today that a later message runs ahead.

Start with a test that proves the jump.

Activity

  1. Jacksondr5 commented on Oct 13, 2026

    @Jacksondr5
    OwnerAuthor

    Scope settled with Jackson, 2026-10-12, while building:

    • Any hold is released, not only a Stop. Upstream holds a queue after a Stop, a restart and a provider failure, and does not record which. A delivery to an idle agent resumes the queue in all three. Accepted.
    • Every J5 delivery follows the rule, platform notices and a person's reply through the ledger included, not only messages agents send.
    • A receiver on a usage limit is the exception. Upstream refuses to resume its queue, so the delivery waits unsent, rechecked like any held delivery with no alarm, and joins the back once the thread continues. The check is upstream's own usageLimitBlockedRun.

    Confirmation that the jump is upstream's design: the comment on runRanAfter in packages/shared names "a message sent while the queue is held" as a run that starts ahead of a held queue.

  2. added a commit that references this issue on Oct 13, 2026
    dae2507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions