[codex] Preserve desktop backend log failures#3375
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR adds structured error handling to desktop backend logging, replacing silent error swallowing with proper error classes and logging. The changes are self-contained observability improvements with comprehensive tests added. You can customize Macroscope's approvability policy. Learn more. |
Keep the backend child log best-effort without discarding why it failed. Setup, record encoding/writes, console mirroring, and size-resynchronization now carry structured operation/path data and exact underlying causes. Only missing log files are treated as an empty initial size; other filesystem failures reach the structured boundary logger.
The rotating writer now propagates failures to that boundary while preserving its size-recovery behavior, including both the original and recovery causes when resynchronization also fails.
Validation:
Note
Low Risk
Observability-only changes in desktop logging; public service API still returns void and falls back to noop on setup failure.
Overview
Desktop backend child output logging stays best-effort (noop on setup failure), but failures are no longer silently dropped. Setup, encode/write, dev console mirroring, and post-write size recovery now emit structured tagged errors with log path, operation, and the exact underlying cause attached for the boundary logger—user-facing messages stay generic and omit low-level diagnostics.
The rotating file writer stops swallowing filesystem errors via
ignore/orElseSucceed; only a missing log file is treated as size0. After a write failure it still resyncs tracked size, then re-fails with the original error, or surfaces a recovery error that carries both causes.New Vitest coverage asserts setup and
write-recordfailures logDesktopBackendOutputLogSetupError/DesktopBackendOutputLogWriteErrorwith the expected path and cause identity.Reviewed by Cursor Bugbot for commit e87c2f4. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve and log desktop backend output log failures instead of silently ignoring them
DesktopBackendOutputLogare now caught and logged as structured errors (DesktopBackendOutputLogSetupError,DesktopBackendOutputLogWriteError) instead of being silently ignored.refreshFileSizenow propagates non-NotFoundPlatformErrorinstead of defaulting to 0; failed writes attempt a size refresh and may emitDesktopLogFileWriterRecoveryError.writeDevelopmentConsoleOutput) are captured and logged asDesktopBackendConsoleWriteErrorinstead of being ignored.PlatformErrorrather than being swallowed.Option.noneand log a structured error rather than silently falling back to noop.Macroscope summarized e87c2f4.