fix(coding-agent): restore compaction-queued messages on Alt-Up

This commit is contained in:
Aliou Diallo 2026-01-23 17:47:30 +01:00
parent 73734a23a1
commit 80e6c4cf57
2 changed files with 39 additions and 9 deletions

View file

@ -25,6 +25,7 @@
- Auto-retry now handles "terminated" errors from Codex API mid-stream failures
- Follow-up queue (Alt+Enter) now sends full paste content instead of `[paste #N ...]` markers ([#912](https://github.com/badlogic/pi-mono/issues/912))
- Fixed Alt-Up not restoring messages queued during compaction ([#923](https://github.com/badlogic/pi-mono/pull/923) by [@aliou](https://github.com/aliou))
## [0.49.3] - 2026-01-22

View file

@ -2437,16 +2437,45 @@ export class InteractiveMode {
this.ui.requestRender();
}
/**
* Get all queued messages (read-only).
* Combines session queue and compaction queue.
*/
private getAllQueuedMessages(): { steering: string[]; followUp: string[] } {
return {
steering: [
...this.session.getSteeringMessages(),
...this.compactionQueuedMessages.filter((msg) => msg.mode === "steer").map((msg) => msg.text),
],
followUp: [
...this.session.getFollowUpMessages(),
...this.compactionQueuedMessages.filter((msg) => msg.mode === "followUp").map((msg) => msg.text),
],
};
}
/**
* Clear all queued messages and return their contents.
* Clears both session queue and compaction queue.
*/
private clearAllQueues(): { steering: string[]; followUp: string[] } {
const { steering, followUp } = this.session.clearQueue();
const compactionSteering = this.compactionQueuedMessages
.filter((msg) => msg.mode === "steer")
.map((msg) => msg.text);
const compactionFollowUp = this.compactionQueuedMessages
.filter((msg) => msg.mode === "followUp")
.map((msg) => msg.text);
this.compactionQueuedMessages = [];
return {
steering: [...steering, ...compactionSteering],
followUp: [...followUp, ...compactionFollowUp],
};
}
private updatePendingMessagesDisplay(): void {
this.pendingMessagesContainer.clear();
const steeringMessages = [
...this.session.getSteeringMessages(),
...this.compactionQueuedMessages.filter((msg) => msg.mode === "steer").map((msg) => msg.text),
];
const followUpMessages = [
...this.session.getFollowUpMessages(),
...this.compactionQueuedMessages.filter((msg) => msg.mode === "followUp").map((msg) => msg.text),
];
const { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();
if (steeringMessages.length > 0 || followUpMessages.length > 0) {
this.pendingMessagesContainer.addChild(new Spacer(1));
for (const message of steeringMessages) {
@ -2464,7 +2493,7 @@ export class InteractiveMode {
}
private restoreQueuedMessagesToEditor(options?: { abort?: boolean; currentText?: string }): number {
const { steering, followUp } = this.session.clearQueue();
const { steering, followUp } = this.clearAllQueues();
const allQueued = [...steering, ...followUp];
if (allQueued.length === 0) {
this.updatePendingMessagesDisplay();