mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-22 00:05:15 +00:00
* fix(server): deliver an agent's messages in the order they were queued An agent's interrupt was dispatched alone, ahead of the steers queued before it. Those steers stayed queued and started a turn of their own after the interrupt's turn ended, so a stale instruction ran after the newer message that countermanded it. The queue now keeps one ordered list per recipient and only ever dispatches its front. An interrupt releases at admission and takes the older messages along in the same replacing prompt. A person's prompt takes the queue along the same way. Stop holds the queue for the recipient's next prompt instead of releasing it into a new turn, and does not drop it: the queue also carries finish notifications. A quiet window now closes after ten seconds at most, so steady arrivals cannot delay a waiting message without bound. * fix(server): keep a prompt's place in line until the provider admits it The queue removed a message when it handed the prompt to the agent manager, before the provider had admitted it. In that gap the order was no longer the queue's to decide: - a person's prompt or a later interrupt sent while the provider was still starting a turn could pass a prompt that was admitted first; - Stop during that start no longer saw the interrupt waiting to replace the turn, so the interrupt started a turn after the Stop; - queued messages that rode a person's prompt were settled when the prompt was handed over, so a turn the provider rejected dropped them. A message now stays in its recipient's list until the provider admits the prompt that carries it, fails it, or the message is withdrawn. Every prompt takes its place at admission, one operation acts on a recipient at a time, and each operation covers only what was admitted before it got in line. Stop holds every message still in the list and clears the interrupt's urgency, so a held interrupt waits like a steer. A prompt is a command only when it starts with a slash and a name with no second slash, matching how providers read it. A prompt that begins with a path now carries the queue like any other text. An interrupt the provider runs as a command beside the turn takes no queued message along, because it replaces nothing. Test wiring that builds the MCP catalog or stubs the agent manager now supplies the delivery module and the stop signal the server requires. * fix(server): keep queue decisions made before a Stop or shutdown from going stale Three races in the window where the provider is still starting or stopping a turn: - An interrupt admitted while a polling queue step was already in line got no step of its own. A person's steer sent next took the interrupt along and steered the turn the interrupt should have replaced. An interrupt now always reserves its place at admission. - A dispatch in flight when Stop arrived checked the queue's phase to learn it was void. A message admitted before the provider answered moved the queue out of `held`, so the old dispatch became valid again: an interrupt from before the Stop started a turn alone, and a batch whose starting turn Stop canceled was rejected instead of kept. Each dispatch now records the Stops its recipient had seen when it was decided and is void once that count changes. - Shutdown drained only what was queued when it began, so messages a rejected person's turn returned afterwards were left to the retry timer. The drain now runs after the operation in flight and reads the queue then. * fix(server): void queue steps that were reserved before a Stop A queue step that was already in line when Stop arrived checked for a Stop only from the moment it ran. When an interrupt arrived while the provider was still stopping, the queue left `held`, and the old step started a turn with the held messages. The new interrupt then replaced that turn in a second one. A step now watches for a Stop from the moment it reserves its place and does nothing once one has arrived. The held messages go with the next prompt admitted after the Stop, in one turn. The interleaving test gains a variant with a provider that is slow to answer. It checks, for every five-step sequence, that no queue dispatch after a Stop carries only messages from before it. * fix(server): hold the queue again when the message that reopened it is withdrawn After a Stop, a message admitted later reopens the queue and takes the held messages along. When that message was withdrawn before its quiet window closed, for example a change-request update whose watch was cancelled, the window still fired and the held messages started a turn on their own. A Stop now marks the messages it finds. When a withdrawal leaves only marked messages, the queue is held again and waits for the next prompt. * docs(server): state that cancel_agent with no turn to stop holds nothing Stop holds the queue only when it stops a running or starting turn. On an idle recipient cancel_agent reports that it canceled no run, and a queued steer keeps its quiet window. The lifecycle doc says so and a daemon-level test pins it. * docs(server): state when a queued message counts as delivered A message leaves the queue when the agent manager acknowledges the start of the turn that carries it. A turn that fails after that point is not delivered again, and a start that is not acknowledged within 60 seconds returns the messages a person's prompt carried.