refactor(file-upload): scope prompt binding rollback

This commit is contained in:
creatixchu
2026-09-03 20:15:18 +08:00
parent b2c4483c9d
commit 3eb9736eb6
12 changed files with 60 additions and 30 deletions
@@ -341,14 +341,10 @@ export class SessionCommandController {
{ sessionId: agent.id },
)
}
const rollback = this.ctx.fileUploads.bindPrompt(agent, durable.receiptIds, request.requestId)
try {
if (request.mode === 'steer') agent.steer(message)
else agent.followup(message)
} catch (error) {
rollback()
throw error
}
using binding = this.ctx.fileUploads.bindPrompt(agent, durable.receiptIds, request.requestId)
if (request.mode === 'steer') agent.steer(message)
else agent.followup(message)
binding.commit()
} catch (error) {
if (remoteErrorOf(error) !== undefined) throw error
if (error instanceof AttachmentError) {