fix(agentctl): forwardAttachment journey uses explicit attachmentIds

Update runAttachmentForwardJourney to call platform.forwardAttachment with
attachmentIds so headless forward works without source message lookup.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-06-02 19:50:52 -04:00
co-authored by Cursor
parent a7826e1760
commit f255adec65
2 changed files with 21 additions and 10 deletions
+2
View File
@@ -4,6 +4,8 @@ Agent control plane for Pearcord — send the same IPC messages the UI sends, re
**Phase 659 (v0.8.638):** Added `runDmPollVoteJourney` to verify DM single-choice idempotent vote apply, multi-select, anonymous poll creation, pre-vote edit guard behavior, close-state vote blocking, DM poll deletion, thread-scoped poll voting in `dm_thread`, and no synthetic unread/mention bump from poll updates; smoke `test:agentctl-dm-poll-phase659`.
**Phase 665 batch 2 (v0.8.640):** `runAttachmentForwardJourney` uses `platform.forwardAttachment` with explicit `attachmentIds`; bundle `test:phase665-media-batch2`.
**Phase 665 (v0.8.640):** `runAttachmentLightboxJourney`, `runAttachmentMeshFetchJourney`, `runAttachmentForwardJourney`, `runGroupDmAttachmentQuotaJourney`, `runAttachmentSlowmodeBlockedJourney`; bundle `test:agentctl-phase665-attachments`.
**Phase 664 (v0.8.639):** `runVoiceNoteDmJourney`, `runVoiceNoteLockCancelJourney`, `runVoiceNoteSlowmodeBlockedJourney`, `runVoiceNoteMeshReplayJourney`, `runVoiceNoteGroupDmQuotaJourney`; bundle `test:agentctl-phase664-voice-notes`.
+19 -10
View File
@@ -2402,22 +2402,31 @@ class HeadlessSession {
mimeType: 'image/png'
})
const sent = await this.sendGuildMessageWithAttachments('origin', [row.id])
const buf = await this.platform.readAttachmentBytes(row.id)
const chB = await this.createGuildChannel('forward-target')
if (!chB?.id || chB.id === chA) throw new Error('expected distinct target channel')
const restaged = await this.stageGuildAttachment({
data: buf,
filename: 'forwarded.png',
mimeType: 'image/png'
})
const forwarded = await this.sendGuildMessageWithAttachments('forwarded copy', [restaged.id])
if (!forwarded?.id) throw new Error('expected forwarded message')
let forwarded
if (this.platform.forwardAttachment) {
forwarded = await this.platform.forwardAttachment({
messageId: sent.id,
targetChannelId: chB.id,
attachmentIds: [row.id]
})
} else {
const buf = await this.platform.readAttachmentBytes(row.id)
const restaged = await this.stageGuildAttachment({
data: buf,
filename: 'forwarded.png',
mimeType: 'image/png'
})
forwarded = { message: await this.sendGuildMessageWithAttachments('forwarded copy', [restaged.id]) }
}
if (!forwarded?.message?.id) throw new Error('expected forwarded message')
const v = await this.refreshView()
const atts = v.attachmentsByMessage?.[forwarded.id] || []
const atts = v.attachmentsByMessage?.[forwarded.message.id] || []
if (!atts.length) throw new Error('expected attachment on forwarded message')
return {
sourceMessageId: sent.id,
forwardedMessageId: forwarded.id,
forwardedMessageId: forwarded.message.id,
targetChannelId: chB.id
}
}