The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): report a failed hand-off from its own function
Tekniume8e3b783de02
diff --git a/apps/desktop/electron/update-handoff-report.ts b/apps/desktop/electron/update-handoff-report.tsindex b20b3c6f355..c7ed27212e6 100644--- a/apps/desktop/electron/update-handoff-report.ts+++ b/apps/desktop/electron/update-handoff-report.ts@@ -4,7 +4,7 @@ import path from 'node:path'import type { Dialog, Shell } from 'electron'-import { readAndConsumeHandoffResult, type ReleaseHolder } from './handoff-result'+import { type HandoffResult, readAndConsumeHandoffResult, type ReleaseHolder } from './handoff-result'import { closableReleaseHolders } from './release-holder-consent'import { explainUpdateStop, readStoppedRun } from './update-stop-remedy'@@ -89,50 +89,56 @@ export function reportHandoffResult(host: HandoffReportHost): void {} else if (result && result.ok) {host.log(`[updates] detached update finished OK (branch ${result.branch})`)} else if (result) {- // The run's own receipt names the stop the updater took (it is written- // before this dialog renders). Matched by correlation id, so an older- // run's stop can never explain this one.- const stop: ReturnType<typeof readStoppedRun> = readStoppedRun(host.hermesHome, result.runId)- const explained: ReturnType<typeof explainUpdateStop> = explainUpdateStop(stop?.stopClass ?? null)- const handoffLogPath = path.join(host.hermesHome, 'logs', 'desktop-update-handoff.log')-- host.log(- `[updates] detached update FAILED (exit ${result.exitCode}): ${result.message}` +- (stop === null ? '' : ` (stop_class ${stop.stopClass})`)- )-- // Async so boot is not blocked behind the dialog; the response handlers- // reuse the menu's open-updates path (queued until the renderer is ready)- // and the same reveal primitive as 'hermes:logs:reveal'.- void host.dialog- .showMessageBox({- type: 'error',- title: 'Hermes update',- message: explained?.message ?? "Hermes couldn't finish updating",- detail: explained === null- ? "You're still on the previous version and can keep using it. Try the update again, or open the update log to report the problem.\n\n" +- `Details: ${result.message}`- : `${explained.detail}\n\nDetails: ${result.message}`,- // A refusal is not retried: the same offer fails the same way. Its way- // out is the channel the update settings own, so lead with that.- buttons: explained === null ? ['Try again', 'Open log', 'Close'] : ['Update settings', 'Open log', 'Close'],- defaultId: 0,- cancelId: 2,- noLink: true- })- .then(({ response }) => {- if (response === 0) {- host.openUpdates()- } else if (response === 1) {- host.shell.showItemInFolder(handoffLogPath)- }- })+ reportFailedHandoff(host, result)}} catch (err) {host.log(`[updates] could not read hand-off result: ${(err as Error).message}`)}}+/** A failed run: name the stop its own receipt recorded, and offer the way out that stop has. */+function reportFailedHandoff(host: HandoffReportHost, result: HandoffResult): void {+ // The run's own receipt names the stop the updater took (it is written+ // before this dialog renders). Matched by correlation id, so an older+ // run's stop can never explain this one.+ const stop: ReturnType<typeof readStoppedRun> = readStoppedRun(host.hermesHome, result.runId)+ const explained: ReturnType<typeof explainUpdateStop> = explainUpdateStop(stop?.stopClass ?? null)+ const handoffLogPath = path.join(host.hermesHome, 'logs', 'desktop-update-handoff.log')++ host.log(+ `[updates] detached update FAILED (exit ${result.exitCode}): ${result.message}` ++ (stop === null ? '' : ` (stop_class ${stop.stopClass})`)+ )++ // Async so boot is not blocked behind the dialog; the response handlers+ // reuse the menu's open-updates path (queued until the renderer is ready)+ // and the same reveal primitive as 'hermes:logs:reveal'.+ void host.dialog+ .showMessageBox({+ type: 'error',+ title: 'Hermes update',+ message: explained?.message ?? "Hermes couldn't finish updating",+ detail:+ explained === null+ ? "You're still on the previous version and can keep using it. Try the update again, or open the update log to report the problem.\n\n" ++ `Details: ${result.message}`+ : `${explained.detail}\n\nDetails: ${result.message}`,+ // A refusal is not retried: the same offer fails the same way. Its way+ // out is the channel the update settings own, so lead with that.+ buttons: explained === null ? ['Try again', 'Open log', 'Close'] : ['Update settings', 'Open log', 'Close'],+ defaultId: 0,+ cancelId: 2,+ noLink: true+ })+ .then(({ response }) => {+ if (response === 0) {+ host.openUpdates()+ } else if (response === 1) {+ host.shell.showItemInFolder(handoffLogPath)+ }+ })+}+/*** #101789: the update landed, but a program outside Hermes holds the Desktop app's folder. Name it* and offer to close it, only on an explicit click; dismissing leaves it running. A holder whose