Skip to content

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

Rust

fix(coding-agent): show the expand hint on sent agent-message summary lines (#1948)

Sebastian Müller85ac06e9bdde
diff --git a/packages/coding-agent/.changes/sent-agent-message-expand-hint.md b/packages/coding-agent/.changes/sent-agent-message-expand-hint.md
new file mode 100644
index 0000000000..b078929ae0
--- /dev/null
+++ b/packages/coding-agent/.changes/sent-agent-message-expand-hint.md
@@ -0,0 +1 @@
+- Fixed sent agent messages under Python cells not showing the expand/collapse keybinding hint that received agent messages show.
diff --git a/packages/coding-agent/src/modes/interactive/components/ipython-cell.ts b/packages/coding-agent/src/modes/interactive/components/ipython-cell.ts
index aed22eba42..97be0c4c11 100644
--- a/packages/coding-agent/src/modes/interactive/components/ipython-cell.ts
+++ b/packages/coding-agent/src/modes/interactive/components/ipython-cell.ts
@@ -653,11 +653,12 @@ export class IPythonCellComponent implements Component {
for (const message of messages) {
const label = message.deliveryStatus === "delivered" ? "Agent message sent" : "Agent message queued";
const recipient = formatAgentMessageParticipant("sent", message.receiverRole, message.target);
+ const hint = expandCollapseHint("app.messages.expand", this.state.agentMessagesExpanded === true);
if (this.state.agentMessagesExpanded) {
this.addBlank(lines, width);
this.addPlain(
lines,
- truncateToWidth(agentMessageSummaryLine(label, recipient), Math.max(1, width - 1), "…"),
+ truncateToWidth(`${agentMessageSummaryLine(label, recipient)} ${hint}`, Math.max(1, width - 1), "…"),
);
for (const bodyLine of agentMessageBodyLines(message.message, width)) {
lines.push(bodyLine);
@@ -668,7 +669,11 @@ export class IPythonCellComponent implements Component {
const preview = agentMessagePreview(prefixWidth, message.message);
this.addPlain(
lines,
- truncateToWidth(agentMessageSummaryLine(label, recipient, preview), Math.max(1, width - 1), "…"),
+ truncateToWidth(
+ `${agentMessageSummaryLine(label, recipient, preview)} ${hint}`,
+ Math.max(1, width - 1),
+ "…",
+ ),
);
}
}
diff --git a/packages/coding-agent/test/suite/regressions/4531-agent-message-ui.test.ts b/packages/coding-agent/test/suite/regressions/4531-agent-message-ui.test.ts
index 189f5cf803..2dd553165c 100644
--- a/packages/coding-agent/test/suite/regressions/4531-agent-message-ui.test.ts
+++ b/packages/coding-agent/test/suite/regressions/4531-agent-message-ui.test.ts
@@ -493,49 +493,6 @@ describe("ENG-4531 agent message UI", () => {
expect(expanded).not.toContain("Message id:");
});
- it("renders sent messages beneath collapsed Python cells", () => {
- const component = new IPythonCellComponent({
- code: 'await agent_message.send("worker-active", "Review shard seven.")',
- executionStarted: true,
- details: {
- status: "ok",
- sentAgentMessages: [
- {
- id: "agentmsg_4531",
- message: "Review shard seven.",
- deliveryStatus: "queued",
- receiverRole: "child",
- target: {
- activeSessionId: "worker-active",
- sessionId: "worker-session",
- sessionName: "Worker",
- },
- },
- {
- id: "agentmsg_4531_delivered",
- message: "Continue with shard eight.",
- deliveryStatus: "delivered",
- receiverRole: "parent",
- target: {
- activeSessionId: "worker-active",
- sessionId: "worker-session",
- sessionName: "Worker",
- },
- },
- ],
- },
- });
-
- const rendered = stripAnsi(component.render(120).join("\n"));
- const lines = rendered.split("\n");
- expect(lines).toEqual([
- expect.stringContaining("python"),
- " ◆ Agent message queued · to child Worker · Review shard seven.",
- " ◆ Agent message sent · to parent Worker · Continue with shard eight.",
- ]);
- expect(rendered).not.toContain("Agent message received");
- });
-
it("expands sent messages to the message text without the receipt metadata", () => {
const receipt =
"{'id': 'agentmsg_4531_delivered',\n" +
@@ -574,7 +531,7 @@ describe("ENG-4531 agent message UI", () => {
expect(lines).toEqual([
expect.stringContaining("python"),
expect.stringContaining("await agent_message.send"),
- " ◆ Agent message sent · to parent Worker",
+ expect.stringMatching(/^ ◆ Agent message sent · to parent Worker \(.*to collapse\)$/),
" ╰─ Continue with shard eight.",
" Then report back.",
]);