Skip to content

fix(openclaw): catch write errors in deviceAuthStore (ELECTRON-6F)#1835

Merged
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-6F
Mar 29, 2026
Merged

fix(openclaw): catch write errors in deviceAuthStore (ELECTRON-6F)#1835
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-6F

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

Summary

  • Wrap writeStore() in deviceAuthStore.ts with try-catch to handle filesystem errors (EROFS, EACCES, ENOSPC) gracefully
  • Auth token persistence is non-critical — user re-authenticates next session if write fails
  • Add unit tests for deviceAuthStore including read-only filesystem scenario

Sentry Issue

ELECTRON-6F — 4 occurrences, unhandled promise rejection on read-only filesystem (WSL2/Ubuntu)

Closes #1834

Verification

  • Unit tests pass (5/5) including EROFS simulation test
  • bunx tsc --noEmit — no type errors
  • bun run lint:fix — 0 errors
  • bun run format — clean

Test Plan

  • Verify storeDeviceAuthToken does not throw on read-only filesystem
  • Verify clearDeviceAuthToken does not throw on read-only filesystem
  • Verify normal read/write/clear flow still works

…dled rejection

Wrap writeStore() in try-catch so filesystem errors (EROFS, EACCES, ENOSPC)
do not propagate as unhandled promise rejections. The user will simply need
to re-authenticate next session if the write fails.

Fixes ELECTRON-6F
@kaizhou-lab kaizhou-lab marked this pull request as ready for review March 28, 2026 04:53
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 29, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 29, 2026

Code Review:fix(openclaw): catch write errors in deviceAuthStore (ELECTRON-6F) (#1835)

变更概述

本 PR 修复 Sentry 问题 ELECTRON-6F:将 writeStore() 中的 mkdirSyncwriteFileSync 包入 try-catch,使文件系统写入失败(EROFS/EACCES/ENOSPC,常见于 WSL2/Ubuntu 只读挂载)时静默处理,避免未捕获的 Promise rejection。同时新增 5 个单元测试覆盖正常读写、令牌清除及只读文件系统场景。


方案评估

结论:✅ 方案合理

重构后的 writeStore 外层 try-catch 包裹关键的 mkdirSync + writeFileSync,内层 try-catch 保留 chmodSync 的尽力而为语义,结构清晰合理。认证令牌持久化为非关键操作,写入失败仅导致用户下次会话重新登录,静默处理是恰当的降级策略。方案与项目现有文件系统操作模式一致,未引入额外复杂度。


问题清单

✅ 未发现明显问题,代码质量良好,建议批准合并。


汇总

# 严重级别 文件 问题
无问题

结论

批准合并 — 无阻塞性问题。变更聚焦、正确,测试覆盖完整,lint 零警告。


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1835

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 29, 2026

✅ 已自动 review,无阻塞性问题,正在触发自动合并。

@piorpua piorpua merged commit 8b13bc5 into main Mar 29, 2026
17 checks passed
@piorpua piorpua deleted the fix/sentry-ELECTRON-6F branch March 29, 2026 08:49
@piorpua piorpua added bot:done Auto-merged by bot and removed bot:reviewing Review in progress (mutex) labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(openclaw): unhandled EROFS in deviceAuthStore writeStore (ELECTRON-6F)

2 participants