diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 3ef9415c..626c61c7 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -24,6 +24,7 @@ ### Fixed +- Fixed first user messages rendering without spacing after existing notices such as compaction summaries or status messages ([#3613](https://github.com/badlogic/pi-mono/issues/3613)) - Fixed the handoff extension example to use the replacement-session context after creating a new session, avoiding stale `ctx` errors when it installs the generated prompt ([#3606](https://github.com/badlogic/pi-mono/issues/3606)) - Fixed session replacement and `/quit` teardown ordering to run host-owned extension UI cleanup synchronously after `session_shutdown` handlers complete but before invalidating the old extension context, preventing stale extension UI from rendering against a disposed session. - Fixed crash on `/quit` when an extension registers a custom footer whose `render()` accesses `ctx`, by tearing down extension-provided UI before invalidating the extension runner during shutdown ([#3595](https://github.com/badlogic/pi-mono/issues/3595)) diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts index 57c21e33..9cd858ed 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts @@ -279,9 +279,6 @@ export class InteractiveMode { // Tool execution tracking: toolCallId -> component private pendingTools = new Map(); - // Track first user message to avoid leading spacer at top of chat - private isFirstUserMessage = true; - // Tool output expansion state private toolOutputExpanded = false; @@ -3035,7 +3032,7 @@ export class InteractiveMode { case "user": { const textContent = this.getUserMessageText(message); if (textContent) { - if (!this.isFirstUserMessage) { + if (this.chatContainer.children.length > 0) { this.chatContainer.addChild(new Spacer(1)); } const skillBlock = parseSkillBlock(textContent); @@ -3059,7 +3056,6 @@ export class InteractiveMode { const userComponent = new UserMessageComponent(textContent, this.getMarkdownThemeWithSettings()); this.chatContainer.addChild(userComponent); } - this.isFirstUserMessage = false; if (options?.populateHistory) { this.editor.addToHistory?.(textContent); } @@ -3097,7 +3093,6 @@ export class InteractiveMode { options: { updateFooter?: boolean; populateHistory?: boolean } = {}, ): void { this.pendingTools.clear(); - this.isFirstUserMessage = true; if (options.updateFooter) { this.footer.invalidate();