Documentation
¶
Overview ¶
Session write-failure protocol: the per-turn handler that records a failed atomic session write and the clean-shutdown final-flush retry. It lives outside internal/sessions because it appends events via internal/events (which already imports internal/sessions), so hosting this glue in sessions would create an import cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanShutdownFlush ¶
CleanShutdownFlush is the final session flush on a clean exit (/exit, /quit, bare exit/quit, CTRL-D on an empty buffer, double-CTRL-C on an empty buffer). It attempts the flush, and on failure attempts it exactly once more. On the second failure it writes the OP_FAIL "session-write-on-exit" line to stderr (with the OS error detail) and returns a non-nil error the caller maps to exit 1, replacing the usual resume hint.
It never appends a session_write_failed event: at clean shutdown there is no later flush boundary to carry such a record, so the OP_FAIL line on stderr is the only failure surface.
func HandleWriteFailure ¶
func HandleWriteFailure(reason sessions.WriteReason, errCat fserrors.Category, path string, detail error, store *sessions.Store, ui tui.NoticeRenderer) error
HandleWriteFailure runs the per-turn protocol for an atomic session write that failed after session start. It does not truncate the in-memory record stream, appends a session_write_failed event describing the failure, and renders the one-line TUI notice. It deliberately does not re-flush: the next flush boundary carries both the retained records and this failure event, so a synchronous retry here would be redundant.
reason must be one of the three write/rename/parent-dir failure reasons; sessions.ReasonNone (a successful or never-attempted flush, or a cancellation) cannot be encoded as session_write_failed and is rejected. It returns an error if reason is ReasonNone or the event payload is rejected by events.Append (for example an empty error_detail), in which case no notice is rendered.
Types ¶
This section is empty.