fix(docs): stop leaking backend reason codes to the open-file toast

The previous toast pasted result.error.message straight into the UI,
so a failed open rendered
  "Couldn't open CEO-WEEK2-DAY1-SUMMARY.md: workspace_id=null
  task_id=null run_id=61669170-180b-4cb3-99d2-eb925ca9717c — none led
  to a workspace with a local_path"
to the operator. That text is a developer log line, not user feedback.

Drop the passthrough — the toast now simply reads
  "Couldn't open <filename>"
and the diagnostic details live only in the IPC return payload (which
a devtools or automated caller can still read). The resolver's five
reason codes and their detail strings remain intact in the main
process; they just no longer surface to the UI.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-21 14:58:39 -04:00
1 parent 9fba8dd6c3
commit aba2dac3c5
1 file changed
+4 -4
@@ -78,14 +78,14 @@ function WorkProductRow({ product, companyId }: { product: WorkProductRecord; co
// the main process can join it against the work product's workspace
// root before handing off to the OS shell. Direct `openPath(externalId)`
// used to flash a failure when the renderer tried to treat the relative
// path as absolute. Surface shell failures (no associated app, path
// outside managed root, workspace moved) as a toast so the click
// doesn't look like a dead button when the OS can't complete the open.
// path as absolute. On failure show a single user-facing line — never
// leak the backend reason code or the resolver's null-chain detail to
// the operator, those belong in a main-process log, not the UI.
const primaryAction = product.url || (product.provider === "filesystem" && product.externalId)
? async () => {
const result = await window.agentCompany.openWorkProduct({ companyId, id: product.id });
if (!result.ok) {
addToast(`Couldn't open ${product.title}: ${result.error.message}`, "danger");
addToast(`Couldn't open ${product.title}`, "danger");
}
}
: undefined;