fix(platform): add fallback for app.getPath('logs') failure#1967
Merged
fix(platform): add fallback for app.getPath('logs') failure#1967
Conversation
When Electron cannot determine the logs path (e.g. transient state at startup), getLogsDir now falls back to <userData>/logs instead of throwing an unhandled rejection. Fixes ELECTRON-GV
Contributor
Code Review:fix(platform): add fallback for app.getPath('logs') failure (#1967)变更概述本 PR 为 方案评估结论:✅ 方案合理 方案直接在异常发生点添加防护,回退路径使用 问题清单
汇总
结论
本报告由本地 CONCLUSION: APPROVED |
Contributor
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
kaizhou-lab
added a commit
that referenced
this pull request
Mar 31, 2026
The inline auto-registered platform services in index.ts were missing
the try-catch fallback for app.getPath('logs') that was added to
ElectronPlatformServices in PR #1967. When code runs before
registerPlatformServices() is called, the inline path throws on systems
where app.getPath('logs') fails, causing 'Failed to get logs path'
errors through the adapter bridge IPC.
piorpua
pushed a commit
that referenced
this pull request
Mar 31, 2026
…1980) The inline auto-registered platform services in index.ts were missing the try-catch fallback for app.getPath('logs') that was added to ElectronPlatformServices in PR #1967. When code runs before registerPlatformServices() is called, the inline path throws on systems where app.getPath('logs') fails, causing 'Failed to get logs path' errors through the adapter bridge IPC. Co-authored-by: kaizhou-lab <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
app.getPath('logs')inElectronPlatformServiceswith fallback to<userData>/logsSentry Issue
Error: Failed to get 'logs' path— 22+ events in ~14 minutes (escalating)createAcpAgent→buildWorkspaceWidthFiles→getSystemDir)Root Cause
app.getPath('logs')can throw when Electron cannot resolve the logs directory path. The call was unguarded, causing unhandled promise rejections.Verification
app.getPath('logs'), fallback path returns<userData>/logstsc --noEmit)Test Plan
getLogsDirreturns correct path whenapp.getPath('logs')succeedsgetLogsDirfalls back touserData/logswhenapp.getPath('logs')throwsCloses #1966