Skip to content

Make Ctrl+P toggle sent agent messages too - #1281

Open
snimu wants to merge 1 commit into
mainfrom
fix/ctrl-p-sent-message-expansion
Open

Make Ctrl+P toggle sent agent messages too#1281
snimu wants to merge 1 commit into
mainfrom
fix/ctrl-p-sent-message-expansion

Conversation

@snimu

@snimu snimu commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What this does

Ctrl+P toggles agent-to-agent messages open and closed. Until now it only worked on messages the agent received — messages it sent stayed collapsed (they only opened together with the whole tool output via Ctrl+O). Now Ctrl+P expands and collapses both sent and received messages together.

Why

Sent and received messages are two halves of the same conversation. Having one key expand one half, and a different key (meant for tool output) expand the other, was confusing and inconsistent.

How it works

There was already a single "are agent messages expanded" switch behind Ctrl+P. The sent-message display just wasn't connected to it — it was wired to the tool-output switch instead. The fix connects the sent-message display to the same switch the received messages use, and disconnects it from the tool-output one. So:

  • Ctrl+P opens and closes all agent messages, sent and received.
  • Ctrl+O goes back to meaning tool output only.
  • No new keybinding, no second switch to keep in sync.

Changes

  • The sent-message part of the code cell display now reads the shared message-expansion switch (+32/−1 across four files).
  • Tests covering the new toggle behavior (+47/−1).
  • One changelog entry.

Lines changed: source +32/−1, tests +47/−1, changelog +1/−0.

Checks

  • npm run check clean.
  • 184 tests across the touched areas pass.

Note

Low Risk
UI-only expansion toggle fix with no auth, data, or protocol changes. Covered by updated unit and regression tests.

Overview
Ctrl+P now expands and collapses sent agent messages along with received ones. Previously, sent messages in IPython cells only opened with tool output via Ctrl+O.

Sent-message rendering in IPythonCellComponent is switched from the tool-output expanded flag to a separate agentMessagesExpanded state, and that state is threaded through ToolExecutionComponent and chat expansion so both message directions share the same toggle.

Reviewed by Cursor Bugbot for commit 6046984. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Make Ctrl+P toggle expansion of sent agent messages independently of tool output

  • Adds agentMessagesExpanded as an independent state flag in IPythonCellComponent so sent agent messages can expand/collapse separately from tool output expansion.
  • ToolExecutionComponent gains setAgentMessagesExpanded() to propagate the global agent message expansion state down to nested IPython cells.
  • InteractiveMode.applyChatExpansion now calls setAgentMessagesExpanded() on all supporting children when Ctrl+P is pressed, using a new hasAgentMessagesExpansion type guard.
  • Newly created tool components inherit the current agentMessagesExpanded setting at construction time.

Macroscope summarized 6046984.

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