Skip to content

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

Rust

declutter feature hints (#526)

kt3317b8b1d10d
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md
index 5885a89527..c5f6ca12d0 100644
--- a/packages/coding-agent/CHANGELOG.md
+++ b/packages/coding-agent/CHANGELOG.md
@@ -2,6 +2,7 @@
## [Unreleased]
+- Fixed feature hints crowding queued messages and side questions by placing them below the recap and hiding them while messages are queued ([ENG-4741](https://linear.app/primeintellect/issue/ENG-4741/recap-queuefollow-upmessage-hint-looks-cluttered)).
- Fixed `/btw` truncating long answers by rendering side questions in the scrollable transcript.
- Changed selection cursors from `→` to `›` across model selectors, scoped-models, and the theme default for consistency with tree and user-message selectors.
- Changed the queued follow-up hint connector from `↳` to `╰─` to match the tool-execution continuation connector.
diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
index 47e9b48361..5e467fb54b 100644
--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts
+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
@@ -842,6 +842,7 @@ export class InteractiveMode {
private featureHintAnimationTimer: NodeJS.Timeout | undefined;
private featureHintComponent: FeatureHintComponent | undefined;
private featureHintRunPending = false;
+ private featureHintSuppressedByQueue = false;
private pulseTimer: NodeJS.Timeout | undefined = undefined;
private pulseFrame = 0;
private readonly activityTracker = new AgentActivityTracker();
@@ -1344,19 +1345,17 @@ export class InteractiveMode {
this.renderWidgets(); // Initialize with default spacer
this.mainContainer.addChild(this.widgetContainerAbove);
this.renderRecap();
- this.mainContainer.addChild(this.recapContainer);
- this.mainContainer.addChild(this.queuedMessagesContainer);
- this.mainContainer.addChild(this.sideQuestionContainer);
- this.mainContainer.addChild(this.featureHintContainer);
+ for (const container of this.getPromptContextContainers()) {
+ this.mainContainer.addChild(container);
+ }
this.mainContainer.addChild(this.editorContainer);
this.mainContainer.addChild(this.childAgentSummary);
this.mainContainer.addChild(this.widgetContainerBelow);
this.footerSlot.addChild(this.footer);
this.mainContainer.addChild(this.footerSlot);
- this.promptDock.addChild(this.featureHintContainer);
- this.promptDock.addChild(this.editorContainer);
- this.promptDock.addChild(this.childAgentSummary);
- this.promptDock.addChild(this.footerSlot);
+ for (const component of this.getPromptDockComponents()) {
+ this.promptDock.addChild(component);
+ }
this.ui.addChild(this.mainContainer);
this.ui.setFocus(this.editor);
@@ -2687,6 +2686,7 @@ export class InteractiveMode {
this.queuedMessagesContainer.clear();
this.compactionQueuedMessages = [];
this.connectionQueue = { steering: [], followUp: [] };
+ this.featureHintSuppressedByQueue = false;
if (options?.clearPromptStash) {
this.promptStash = undefined;
}
@@ -3042,7 +3042,7 @@ export class InteractiveMode {
private startFeatureHintPresentation(): void {
this.clearFeatureHintPresentation();
- if (this.childAgentPanelMode) {
+ if (this.shouldSuppressFeatureHint()) {
return;
}
if (this.featureHintEligibleAt === 0) {
@@ -3062,6 +3062,7 @@ export class InteractiveMode {
private showFeatureHint(): void {
if (
+ this.shouldSuppressFeatureHint() ||
!this.loadingAnimation ||
!this.shouldShowWorkingLoader() ||
!this.statusContainer.children.includes(this.loadingAnimation)
@@ -3108,6 +3109,7 @@ export class InteractiveMode {
private resumeFeatureHintPresentation(): void {
if (
+ !this.shouldSuppressFeatureHint() &&
this.loadingAnimation &&
this.shouldShowWorkingLoader() &&
this.statusContainer.children.includes(this.loadingAnimation)
@@ -3116,6 +3118,14 @@ export class InteractiveMode {
}
}
+ private shouldSuppressFeatureHint(): boolean {
+ if (this.childAgentPanelMode) {
+ return true;
+ }
+ const { steering, followUp } = this.getAllQueuedMessages();
+ return steering.length > 0 || followUp.length > 0;
+ }
+
private endFeatureHintRun(): void {
this.clearFeatureHintPresentation();
this.currentFeatureHint = undefined;
@@ -6602,6 +6612,14 @@ export class InteractiveMode {
this.ui.requestRender();
}
+ private getPromptContextContainers(): Container[] {
+ return [this.recapContainer, this.featureHintContainer, this.queuedMessagesContainer, this.sideQuestionContainer];
+ }
+
+ private getPromptDockComponents(): Component[] {
+ return [this.editorContainer, this.childAgentSummary, this.footerSlot];
+ }
+
/** Enter or leave fullscreen rendering without touching the persisted setting. */
private applyFullscreen(enabled: boolean): void {
if (enabled) {
@@ -6611,9 +6629,7 @@ export class InteractiveMode {
this.headerContainer,
this.mainViewContainer,
this.widgetContainerAbove,
- this.recapContainer,
- this.queuedMessagesContainer,
- this.sideQuestionContainer,
+ ...this.getPromptContextContainers(),
this.widgetContainerBelow,
],
dock: this.promptDock,
@@ -6837,7 +6853,8 @@ export class InteractiveMode {
// their own container below the execution indicator and recap.
this.queuedMessagesContainer.clear();
const { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();
- if (steeringMessages.length > 0 || followUpMessages.length > 0) {
+ const hasQueuedMessages = steeringMessages.length > 0 || followUpMessages.length > 0;
+ if (hasQueuedMessages) {
this.queuedMessagesContainer.addChild(new Spacer(1));
for (const message of steeringMessages) {
const text = theme.fg("dim", formatQueuedMessagePreview(message, "Steering"));
@@ -6851,6 +6868,13 @@ export class InteractiveMode {
const hintText = theme.fg("dim", `╰─ ${dequeueHint} to edit all queued messages`);
this.queuedMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));
}
+ if (hasQueuedMessages && !this.featureHintSuppressedByQueue) {
+ this.featureHintSuppressedByQueue = true;
+ this.clearFeatureHintPresentation();
+ } else if (!hasQueuedMessages && this.featureHintSuppressedByQueue) {
+ this.featureHintSuppressedByQueue = false;
+ this.resumeFeatureHintPresentation();
+ }
}
/** Move pending bash components from pending area to chat */
diff --git a/packages/coding-agent/test/interactive-mode-feature-hints.test.ts b/packages/coding-agent/test/interactive-mode-feature-hints.test.ts
index 4a671b75f5..3f6bddcbf2 100644
--- a/packages/coding-agent/test/interactive-mode-feature-hints.test.ts
+++ b/packages/coding-agent/test/interactive-mode-feature-hints.test.ts
@@ -44,6 +44,8 @@ function createMode() {
featureHintComponent: undefined,
featureHintRunPending: false,
childAgentPanelMode: undefined,
+ connectionQueue: { steering: [], followUp: [] },
+ compactionQueuedMessages: [],
options: { returnToAgentsView: true },
ui: { requestRender },
};
diff --git a/packages/coding-agent/test/interactive-mode-status.test.ts b/packages/coding-agent/test/interactive-mode-status.test.ts
index 5874ddbdca..2da3dacf26 100644
--- a/packages/coding-agent/test/interactive-mode-status.test.ts
+++ b/packages/coding-agent/test/interactive-mode-status.test.ts
@@ -764,6 +764,7 @@ describe("InteractiveMode pending bash components", () => {
queuedMessagesContainer: new Container(),
pendingBashComponents: [component],
getAllQueuedMessages: () => ({ steering: [], followUp: [] }),
+ featureHintSuppressedByQueue: false,
} as unknown as InteractiveMode;
(
@@ -784,6 +785,8 @@ describe("InteractiveMode pending bash components", () => {
followUp: ["Heartbeat prompt: check status", "Goal context: continue goal", "plain follow-up"],
}),
getAppKeyDisplay: () => "Ctrl+Q",
+ featureHintSuppressedByQueue: false,
+ clearFeatureHintPresentation: vi.fn(),
} as unknown as InteractiveMode;
(
diff --git a/packages/coding-agent/test/suite/regressions/4741-hint-placement.test.ts b/packages/coding-agent/test/suite/regressions/4741-hint-placement.test.ts
new file mode 100644
index 0000000000..6401264d13
--- /dev/null
+++ b/packages/coding-agent/test/suite/regressions/4741-hint-placement.test.ts
@@ -0,0 +1,164 @@
+import { type Component, Container } from "@earendil-works/pi-tui";
+import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+import { InteractiveMode } from "../../../src/modes/interactive/interactive-mode.js";
+import { initTheme } from "../../../src/modes/interactive/theme/theme.js";
+
+class FakeLoader implements Component {
+ invalidate(): void {}
+
+ render(width: number): string[] {
+ return ["loader".padEnd(width)];
+ }
+}
+
+function callPrivate(mode: object, name: string, ...args: unknown[]): unknown {
+ return Reflect.get(InteractiveMode.prototype, name).call(mode, ...args);
+}
+
+function createFeatureHintMode() {
+ const loader = new FakeLoader();
+ const statusContainer = new Container();
+ statusContainer.addChild(loader);
+ const featureHintContainer = new Container();
+ const mode = Object.assign(Object.create(InteractiveMode.prototype), {
+ statusContainer,
+ featureHintContainer,
+ pendingMessagesContainer: new Container(),
+ pendingBashComponents: [],
+ queuedMessagesContainer: new Container(),
+ connectionQueue: { steering: [] as string[], followUp: [] as string[] },
+ compactionQueuedMessages: [],
+ loadingAnimation: loader,
+ workingVisible: true,
+ connectionState: { isStreaming: true },
+ featureHintDeck: { next: vi.fn(() => ({ id: "test", text: "A useful feature hint." })) },
+ currentFeatureHint: undefined,
+ featureHintEligibleAt: 0,
+ featureHintTimer: undefined,
+ featureHintAnimationTimer: undefined,
+ featureHintComponent: undefined,
+ featureHintRunPending: false,
+ featureHintSuppressedByQueue: false,
+ childAgentPanelMode: undefined,
+ options: { returnToAgentsView: true },
+ getAppKeyDisplay: () => "Ctrl+Q",
+ ui: { requestRender: vi.fn() },
+ });
+ return { mode, featureHintContainer };
+}
+
+describe("ENG-4741 hint placement", () => {
+ beforeAll(() => {
+ initTheme("dark");
+ });
+
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(0);
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ it("orders hints below the recap and above queued messages and side questions", () => {
+ const recapContainer = new Container();
+ const featureHintContainer = new Container();
+ const queuedMessagesContainer = new Container();
+ const sideQuestionContainer = new Container();
+ const editorContainer = new Container();
+ const childAgentSummary = new Container();
+ const footerSlot = new Container();
+ const mode = Object.assign(Object.create(InteractiveMode.prototype), {
+ recapContainer,
+ featureHintContainer,
+ queuedMessagesContainer,
+ sideQuestionContainer,
+ editorContainer,
+ childAgentSummary,
+ footerSlot,
+ });
+
+ expect(callPrivate(mode, "getPromptContextContainers")).toEqual([
+ recapContainer,
+ featureHintContainer,
+ queuedMessagesContainer,
+ sideQuestionContainer,
+ ]);
+ expect(callPrivate(mode, "getPromptDockComponents")).toEqual([editorContainer, childAgentSummary, footerSlot]);
+ });
+
+ it("keeps hints in the fullscreen transcript instead of the prompt dock", () => {
+ const previousIsTTY = Object.getOwnPropertyDescriptor(process.stdout, "isTTY");
+ Object.defineProperty(process.stdout, "isTTY", { configurable: true, value: true });
+ try {
+ const headerContainer = new Container();
+ const mainViewContainer = new Container();
+ const widgetContainerAbove = new Container();
+ const recapContainer = new Container();
+ const featureHintContainer = new Container();
+ const queuedMessagesContainer = new Container();
+ const sideQuestionContainer = new Container();
+ const widgetContainerBelow = new Container();
+ const promptDock = new Container();
+ const enterFullscreen = vi.fn();
+ const mode = Object.assign(Object.create(InteractiveMode.prototype), {
+ headerContainer,
+ mainViewContainer,
+ widgetContainerAbove,
+ recapContainer,
+ featureHintContainer,
+ queuedMessagesContainer,
+ sideQuestionContainer,
+ widgetContainerBelow,
+ promptDock,
+ ui: { enterFullscreen },
+ uiServices: { settingsManager: { getFullscreenMouse: () => true } },
+ });
+
+ callPrivate(mode, "applyFullscreen", true);
+
+ expect(enterFullscreen).toHaveBeenCalledWith({
+ scroll: [
+ headerContainer,
+ mainViewContainer,
+ widgetContainerAbove,
+ recapContainer,
+ featureHintContainer,
+ queuedMessagesContainer,
+ sideQuestionContainer,
+ widgetContainerBelow,
+ ],
+ dock: promptDock,
+ mouse: true,
+ });
+ expect(promptDock.children).not.toContain(featureHintContainer);
+ } finally {
+ if (previousIsTTY) {
+ Object.defineProperty(process.stdout, "isTTY", previousIsTTY);
+ } else {
+ Reflect.deleteProperty(process.stdout, "isTTY");
+ }
+ }
+ });
+
+ it("hides a visible hint while messages are queued and restores it when the queue clears", () => {
+ const { mode, featureHintContainer } = createFeatureHintMode();
+
+ callPrivate(mode, "startFeatureHintPresentation");
+ vi.advanceTimersByTime(5_000);
+ expect(featureHintContainer.children).toHaveLength(1);
+
+ mode.connectionQueue.followUp = ["Continue after this turn"];
+ callPrivate(mode, "updatePendingMessagesDisplay");
+ expect(featureHintContainer.children).toHaveLength(0);
+
+ mode.connectionQueue.followUp = [];
+ callPrivate(mode, "updatePendingMessagesDisplay");
+ expect(featureHintContainer.children).toHaveLength(1);
+
+ const restoredHint = featureHintContainer.children[0];
+ callPrivate(mode, "updatePendingMessagesDisplay");
+ expect(featureHintContainer.children).toEqual([restoredHint]);
+ });
+});