Skip to content

fix(cli): clear delivered image-only queue entries - #59

Merged
Raghav1428 merged 1 commit into
mainfrom
fix/image-only-queue-entries
Sep 1, 2026
Merged

Raghav1428 merged 1 commit into
mainfrom
fix/image-only-queue-entries

Conversation

@Raghav1428

@Raghav1428 Raghav1428 commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

When a queued user message starts, _handleAgentEvent removes it from the steering / follow-up queue so the UI sees the right pending count. That whole block was wrapped in if (messageText), so a message carrying only images — a pasted screenshot steered mid-turn — never got removed after delivery. pendingMessageCount stayed stuck above zero and the entry sat in the queue.

The queues already store "" for such messages, so indexOf("") matches correctly; the text guard was the only thing in the way. Removed it.

Testing

  • New case in test/suite/agent-session-queue.test.ts steers an image-only message mid-tool-call and asserts the image reaches the model, the agent queue drains, and pendingMessageCount returns to 0.
  • Verified the test fails on main (expected 1 to be +0) and passes with the fix.
  • packages/cli: vitest --run test/suite/agent-session-queue.test.ts — 15 passed.
  • bun run check-types clean.

@vercel

vercel Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
knightcode Ready Ready Preview Sep 1, 2026 5:35pm UTC

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Confidence score: 5/5

  • packages/cli/test/suite/agent-session-queue.test.ts adds an issue-specific regression test outside the test/suite/regressions/<issue-number>-<short-slug>.test.ts convention, which may reduce test discoverability and suite organization; move it to the documented regressions location.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/cli/test/suite/agent-session-queue.test.ts">

<violation number="1" location="packages/cli/test/suite/agent-session-queue.test.ts:387">
P3: This is a regression test for a specific bug (pi#8581), but the suite README directs issue-specific regression tests to `test/suite/regressions/<issue-number>-<short-slug>.test.ts`. Adding the image-only case to the characterization file instead diverges from that documented convention; consider moving it to a regression test file.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

expect(harness.session.pendingMessageCount).toBe(0);
});

it("removes an image-only steering message after delivery", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This is a regression test for a specific bug (pi#8581), but the suite README directs issue-specific regression tests to test/suite/regressions/<issue-number>-<short-slug>.test.ts. Adding the image-only case to the characterization file instead diverges from that documented convention; consider moving it to a regression test file.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/test/suite/agent-session-queue.test.ts, line 387:

<comment>This is a regression test for a specific bug (pi#8581), but the suite README directs issue-specific regression tests to `test/suite/regressions/<issue-number>-<short-slug>.test.ts`. Adding the image-only case to the characterization file instead diverges from that documented convention; consider moving it to a regression test file.</comment>

<file context>
@@ -384,6 +384,35 @@ describe("AgentSession queue characterization", () => {
 		expect(harness.session.pendingMessageCount).toBe(0);
 	});
 
+	it("removes an image-only steering message after delivery", async () => {
+		const waiting = await createWaitingHarness();
+		const { harness, waitForToolStart, promptPromise, releaseToolExecution } = waiting;
</file context>

The queue-removal branch in _handleAgentEvent was gated on the user message
having text, so an image-only steer or follow-up — a pasted screenshot sent
mid-turn — was never spliced out after delivery: pendingMessageCount stayed
above zero and the entry lingered in the queue.

The queues already store "" for such messages, so matching on the empty text
like any other message is enough.

Ported from upstream pi.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

@Raghav1428

Copy link
Copy Markdown
Collaborator Author

Addressed in bd6d149 — moved to test/suite/regressions/8581-image-only-queue-entry.test.ts per the suite README convention.

@Raghav1428
Raghav1428 merged commit 1f6480a into main Sep 1, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — ec0f1502 Deployed Sep 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant