Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

Steer agent messages by default (#341)

Seth Karten8273e62c60eb
diff --git a/packages/coding-agent/skills/agent-message/SKILL.md b/packages/coding-agent/skills/agent-message/SKILL.md
index 6e7a42e687..e14d9c4119 100644
--- a/packages/coding-agent/skills/agent-message/SKILL.md
+++ b/packages/coding-agent/skills/agent-message/SKILL.md
@@ -26,11 +26,13 @@ receipt = await agent_message.send("worker", "Please inspect the latest result."
- `await agent_message.send(target, message, mode="auto")` — sends one direct
text message to an active session. `target` is resolved by the daemon like
other live-session selectors. `mode` is `"auto"`, `"follow_up"`, or
- `"steer"`. Returns a receipt with a `deliveryStatus` field: `"delivered"`
- means the message reached an idle target's context; `"queued"` means it was
- accepted and will deliver when the target's current work allows (`send`
- does not block waiting for that). Delivered receipts carry `deliveredAt`,
- queued receipts carry `queuedAt`.
+ `"steer"`. In `auto` mode, messages to busy sessions are queued as steering
+ messages so the target sees them during the active run; use `"follow_up"` for
+ intentionally delayed delivery. Returns a receipt with a `deliveryStatus`
+ field: `"delivered"` means the message reached an idle target's context;
+ `"queued"` means it was accepted and will deliver when the target's current
+ work allows (`send` does not block waiting for that). Delivered receipts
+ carry `deliveredAt`, queued receipts carry `queuedAt`.
## Safety
diff --git a/packages/coding-agent/skills/agent-message/src/agent_message/__init__.py b/packages/coding-agent/skills/agent-message/src/agent_message/__init__.py
index 6eb22f2c37..0c57dfc0e6 100644
--- a/packages/coding-agent/skills/agent-message/src/agent_message/__init__.py
+++ b/packages/coding-agent/skills/agent-message/src/agent_message/__init__.py
@@ -24,7 +24,7 @@ async def send(target: str, message: str, mode: MessageMode = "auto") -> dict[st
Args:
target: Active session id, session id/name, or unambiguous suffix.
message: Text payload to deliver.
- mode: "auto" queues as follow-up only if the target is streaming;
+ mode: "auto" steers into a busy/streaming target so the message is visible promptly;
"follow_up" always uses follow-up when the target is streaming;
"steer" interrupts a streaming target.
diff --git a/packages/coding-agent/src/core/agent-messages.ts b/packages/coding-agent/src/core/agent-messages.ts
index 85f6aa01ae..5e8ac18f97 100644
--- a/packages/coding-agent/src/core/agent-messages.ts
+++ b/packages/coding-agent/src/core/agent-messages.ts
@@ -138,7 +138,10 @@ export function resolveAgentSessionMessageStreamingBehavior(
if (mode === "steer") {
return "steer";
}
- return "followUp";
+ if (mode === "follow_up") {
+ return "followUp";
+ }
+ return "steer";
}
export function parseAgentSessionMessagePromptId(text: string): string | undefined {
diff --git a/packages/coding-agent/src/modes/daemon/daemon-mode.ts b/packages/coding-agent/src/modes/daemon/daemon-mode.ts
index 91fde593ed..e43aa9e9cf 100644
--- a/packages/coding-agent/src/modes/daemon/daemon-mode.ts
+++ b/packages/coding-agent/src/modes/daemon/daemon-mode.ts
@@ -2197,7 +2197,7 @@ export class AgentDaemon {
session.pendingMessageCount > 0;
const streamingBehavior =
resolveAgentSessionMessageStreamingBehavior(shouldQueue, payload.deliveryMode) ??
- (payload.deliveryMode === "steer" ? "steer" : "followUp");
+ (payload.deliveryMode === "follow_up" ? "followUp" : "steer");
const prompt = createAgentSessionMessagePrompt(payload);
if (shouldQueue) {
diff --git a/packages/coding-agent/test/agent-session-bus.test.ts b/packages/coding-agent/test/agent-session-bus.test.ts
index 1b7d79f455..e2b9cf5ff4 100644
--- a/packages/coding-agent/test/agent-session-bus.test.ts
+++ b/packages/coding-agent/test/agent-session-bus.test.ts
@@ -116,9 +116,9 @@ describe("agent session bus", () => {
expect(prompt).toContain("To: Worker active spoof, active worker, session session-worker");
});
- it("uses follow-up delivery by default only when the target is streaming", () => {
+ it("uses steering delivery by default only when the target is streaming", () => {
expect(resolveAgentSessionMessageStreamingBehavior(false, "auto")).toBeUndefined();
- expect(resolveAgentSessionMessageStreamingBehavior(true, "auto")).toBe("followUp");
+ expect(resolveAgentSessionMessageStreamingBehavior(true, "auto")).toBe("steer");
expect(resolveAgentSessionMessageStreamingBehavior(true, "follow_up")).toBe("followUp");
expect(resolveAgentSessionMessageStreamingBehavior(true, "steer")).toBe("steer");
});
diff --git a/packages/coding-agent/test/daemon-mode.test.ts b/packages/coding-agent/test/daemon-mode.test.ts
index b2746fc233..c5ce3ee31c 100644
--- a/packages/coding-agent/test/daemon-mode.test.ts
+++ b/packages/coding-agent/test/daemon-mode.test.ts
@@ -277,6 +277,7 @@ describe("daemon mode helpers", () => {
targetSelector: string;
message: string;
fromState?: ActiveSessionState;
+ deliveryMode?: "auto" | "steer" | "follow_up";
origin: "agent" | "cli";
}): Promise<unknown>;
};
@@ -294,6 +295,22 @@ describe("daemon mode helpers", () => {
deliveryStatus: "queued",
target: { activeSessionId: targetState.activeSessionId },
});
+ expect(acceptAgentMessagePrompt.mock.calls[0]?.[1]).toMatchObject({ streamingBehavior: "steer" });
+
+ acceptAgentMessagePrompt.mockClear();
+ await expect(
+ internals.sendAgentSessionMessage({
+ targetSelector: targetState.activeSessionId,
+ message: "please continue later",
+ fromState,
+ deliveryMode: "follow_up",
+ origin: "agent",
+ }),
+ ).resolves.toMatchObject({
+ deliveryStatus: "queued",
+ target: { activeSessionId: targetState.activeSessionId },
+ });
+ expect(acceptAgentMessagePrompt.mock.calls[0]?.[1]).toMatchObject({ streamingBehavior: "followUp" });
});
it("rate limits agent messages per sender and target pair", async () => {
@@ -1091,7 +1108,7 @@ describe("daemon mode helpers", () => {
).resolves.toMatchObject({ target: { activeSessionId: targetState.activeSessionId } });
expect(queueAgentMessagePrompt).toHaveBeenCalledOnce();
- expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("followUp");
+ expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("steer");
expect(followUp).not.toHaveBeenCalled();
expect(prompt).not.toHaveBeenCalled();
});
@@ -1147,7 +1164,7 @@ describe("daemon mode helpers", () => {
).resolves.toMatchObject({ target: { activeSessionId: targetState.activeSessionId } });
expect(queueAgentMessagePrompt).toHaveBeenCalledOnce();
- expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("followUp");
+ expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("steer");
expect(followUp).not.toHaveBeenCalled();
expect(prompt).not.toHaveBeenCalled();
});
@@ -1202,7 +1219,7 @@ describe("daemon mode helpers", () => {
).resolves.toMatchObject({ target: { activeSessionId: targetState.activeSessionId } });
expect(queueAgentMessagePrompt).toHaveBeenCalledOnce();
- expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("followUp");
+ expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("steer");
expect(prompt).not.toHaveBeenCalled();
});
@@ -1256,7 +1273,7 @@ describe("daemon mode helpers", () => {
).resolves.toMatchObject({ target: { activeSessionId: targetState.activeSessionId } });
expect(queueAgentMessagePrompt).toHaveBeenCalledOnce();
- expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("followUp");
+ expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("steer");
expect(acceptAgentMessagePrompt).not.toHaveBeenCalled();
});
@@ -1390,7 +1407,7 @@ describe("daemon mode helpers", () => {
expect(prompt).toHaveBeenCalledTimes(1);
expect(queueAgentMessagePrompt).toHaveBeenCalledOnce();
- expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("followUp");
+ expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("steer");
expect(followUp).not.toHaveBeenCalled();
await expect(second).resolves.toMatchObject({ message: "second" });
});
@@ -1558,7 +1575,7 @@ describe("daemon mode helpers", () => {
await send;
expect(acceptAgentMessagePrompt).not.toHaveBeenCalled();
expect(queueAgentMessagePrompt).toHaveBeenCalledOnce();
- expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("followUp");
+ expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("steer");
resolvePrompt();
});
@@ -1692,7 +1709,7 @@ describe("daemon mode helpers", () => {
expect(acceptAgentMessagePrompt).not.toHaveBeenCalled();
expect(queueAgentMessagePrompt).toHaveBeenCalledOnce();
- expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("followUp");
+ expect(queueAgentMessagePrompt.mock.calls[0]?.[1]).toBe("steer");
resolvePrompt();
await cronRun;
});