fix: restore packaged Nexu home and welcome redirect#885
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7107e7769b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
审了一下,方向 OK,但有 1 个必须修的 bug 和 1 个建议改的点。考虑到范围只是 1.0.10 → 当前未发版窗口(仅影响装过 buggy 内部包的 QA),我把过度估计的部分都收回了。 🔴 必须修:welcome.tsx 违反 Rules of Hooks
if (setupComplete && authPending) {
return <div className=\"min-h-screen bg-[#0b0b0d]\" />;
}
if (setupComplete && session?.user) {
return <Navigate to=\"/workspace\" replace />;
}
useEffect(() => { ... }, [navigate]); // ← 有时被跳过
useEffect(() => { ... }, [...]); // ← 有时被跳过当 `authPending` 从 true 变 false 时,渲染的 hook 数量会从 N 变成 N+2,React 会抛 "Rendered more hooks than during the previous render." 直接白屏。 这是 `react-hooks/rules-of-hooks` 必检的模式,PR 描述里说 `pnpm lint` 通过比较反常,建议本地再跑一次或检查 ESLint 配置是否启用了该规则。 修法:把跳转逻辑挪到一个 `useEffect` 里调 `navigate("/workspace", { replace: true })`,loading 态和 session 态用普通 state/JSX 表达,保证所有 hook 调用顺序稳定。 🟠 建议改:目录级 `existsSync` 太粗,会丢新文件`nexu-home-migration.ts` 的 `copyDirIfMissing`: ```ts 只要测试同学的 `~/.nexu/runtime/`(或 `artifacts/`、`logs/`、`skillhub-cache/`)已存在——哪怕里面是几个月前的旧文件——buggy 版本期间在 `userData/.nexu/runtime/` 里产生的新文件一个都不会迁移过去。 `runtime/` 这个目录尤其要紧,里面是 openclaw 的 state(agents/sessions/extensions/identity/canvas/devices 等),这些是 buggy 版本期间用户实际操作积累出来的。如果 QA 已经在 buggy 包里跑过 openclaw,这部分状态会被静默丢弃。 建议:至少对 `runtime/` 改成递归文件级 merge(对每个 source 文件做 `copyFileIfMissing`),其他几个目录看实际写入频次决定要不要一并改。配套补一个测试:source 和 target 都有 `runtime/` 目录但内容不同的场景。 ✅ 其他看过没问题的点
⏸ 可以暂缓的点
总结:hook bug 阻塞合并必须修;runtime/ 的目录级合并强烈建议改,避免 QA 数据丢失;其他可以这个 PR 不动。 |
What
Restore packaged desktop
NEXU_HOMEback to~/.nexu, add a one-time migration for configs previously written underuserData/.nexu, and keep the welcome page redirect gated on a ready auth session.Why
Recent packaged builds started binding
NEXU_HOMEtouserData/.nexuinstead of the persistent~/.nexuhome. After upgrading, the controller could read a fresh empty config root and all channels appeared missing until users recreated them manually.How
NEXU_HOMEfromuserData~/.nexuuserData/.nexuconfig and metadata into the stable homeAffected areas
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpassespnpm generate-typesrun (if API routes/schemas changed)anytypes introduced (useunknownwith narrowing)Notes for reviewers
I also built a local unsigned Apple Silicon package to verify the packaged desktop flow after the path fix.