fix: an answer to a blocked agent goes ahead of the queue

Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
FactorandOvis Fast committed 2026-11-19 12:19:54 +01:00
1 parent f3250e594e
commit e6afb3ebf9
3 files changed
+50 -5

No files matched your search

+9 -4
View File
@@ -48,7 +48,6 @@ import {
decide,
shouldDrain,
shouldStartCountdown,
queueBlocksDirectSend,
parseSendArgs,
sendNow as sendToTerminal,
} from "./delivery.js";
@@ -94,6 +93,7 @@ import {
queueLabel,
shortPath,
stillSameAgent,
directSendBlocked,
statusText,
targetAgent,
} from "./view.js";
@@ -1066,9 +1066,14 @@ export default class Composer extends View {
const allowed = mode === "now" || canAutoSend(this.draftReady, key);
// A message that is on the wire, waits in the queue or counts down goes first: the
// new one waits behind it in the queue instead of vanishing or jumping
// the line (Ctrl+Enter is the person's own order and does jump).
const busy =
this.draining.has(key) || (mode !== "now" && queueBlocksDirectSend(this.state.queue[key]));
// the line. Ctrl+Enter is the person's own order and does jump, and so is
// an answer to a blocked agent (see `directSendBlocked`).
const busy = directSendBlocked({
draining: this.draining.has(key),
mode,
status: this.statusOf(agent),
queue: this.state.queue[key],
});
if (decision.kind === "send" && allowed && !busy) {
// The person's own Enter answers an agent that waits for them: it goes
// through even though the agent is blocked (`hc send --force`). Never