You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tui: /export reports failure and drops editor edits when the external editor exits non-zero #44299
/export writes the transcript file first and then opens it in $EDITOR. If the editor exits non-zero, the promise rejects into the outer catch and the TUI shows "Failed to export session" - even though the export file was already created successfully on disk. Any edits saved in the editor before the non-zero exit are also silently discarded, because the post-editor rewrite (if (result !== undefined) await writeExport(filepath, result)) never runs.
Relevant path in packages/tui/src/routes/session/index.tsx (session.export handler):
await writeExport(filepath, transcript) - file is written
const result = await openEditor({...}) - openEditor rejects on any non-zero editor exit (packages/tui/src/editor.ts: rejects with Editor exited with ... instead of returning)
rejection skips both the rewrite and the success toast, landing in catch -> "Failed to export session"
So the reported outcome is wrong (the export exists), and the user cannot tell whether their file was written or whether their editor edits survived.
Steps to reproduce
Set EDITOR to a command that exits non-zero, e.g. a script containing just exit 1 (or use vim and quit with :cq).
In a TUI session with messages, run /export and confirm the default filename.
Observe the "Failed to export session" error toast.
Check the working directory: session-<id>.md exists and contains the full transcript - the export actually succeeded.
With an editor like vim: make an edit, save, quit via :cq - the exported file still has the pre-edit content; the edit is gone without any warning.
This is fixed in v2: /export writes the transcript and shows a result dialog instead of opening $EDITOR. An editor exit can no longer cause a false export failure or discard edits in that flow. Upgrade with npm i -g @opencode/cli@latest. If you still see this on v2, please open a new issue with the details.
Activity
fix(tui): return undefined when external editor exits non-zero
neriousy commentedon Oct 19, 2026
This is fixed in v2:
/exportwrites the transcript and shows a result dialog instead of opening$EDITOR. An editor exit can no longer cause a false export failure or discard edits in that flow. Upgrade withnpm i -g @opencode/cli@latest. If you still see this on v2, please open a new issue with the details.