The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui): editing a queued prompt's text keeps its attachments and destination
Teknium4cc99542a775
diff --git a/ui-tui/src/__tests__/queueEditKeepsFields.test.ts b/ui-tui/src/__tests__/queueEditKeepsFields.test.tsnew file mode 100644index 00000000000..228bb678554--- /dev/null+++ b/ui-tui/src/__tests__/queueEditKeepsFields.test.ts@@ -0,0 +1,37 @@+import { describe, expect, it } from 'vitest'++import { takeQueueItem } from '../hooks/useQueue.js'++const destination = { sid: 'chat-a', storedSid: 'chat-a' } as any+const attachments = [{ mime: 'image/png', path: '/w/shot.png' }]++describe('editing the text of a local queued item', () => {+ it('keeps its attachments, destination and control intent, and starts a new submission', () => {+ const queue = [+ {+ attachments,+ controlMethod: 'session.steer' as const,+ destination,+ display: 'look at this',+ executionGeneration: 4,+ failed: true,+ ownerDestination: destination,+ preparedText: 'look at this [image]',+ submissionId: 'sub-1',+ text: 'look at this'+ }+ ]++ const edited = takeQueueItem(queue, 0, 'look at this closely')++ expect(edited).toEqual({+ attachments,+ controlMethod: 'session.steer',+ destination,+ display: 'look at this closely',+ executionGeneration: 4,+ ownerDestination: destination,+ text: 'look at this closely'+ })+ })+})diff --git a/ui-tui/src/hooks/useQueue.ts b/ui-tui/src/hooks/useQueue.tsindex 3232f98851f..50f85d9ac1c 100644--- a/ui-tui/src/hooks/useQueue.ts+++ b/ui-tui/src/hooks/useQueue.ts@@ -53,7 +53,23 @@ export function takeQueueItem(queue: QueueItem[], index: number, editedDisplay?:const text = editedDisplay.includes(item.display) ? editedDisplay.replace(item.display, item.text) : editedDisplay- return text === item.text ? { ...item, display: editedDisplay } : { display: editedDisplay, text }+ if (text === item.text) {+ return { ...item, display: editedDisplay }+ }++ // New text is a new submission (fresh id, no prior attempt), but the edit keeps what the+ // user queued it with: attachments, destination and the busy-control intent.+ const {+ failed: _f,+ inFlight: _i,+ legacyAttempted: _l,+ preparedText: _p,+ settle: _s,+ submissionId: _id,+ ...kept+ } = item++ return { ...kept, display: editedDisplay, text }}// Mutates `arr` in place; returned reference is the same input array, kept