Skip to content

fix(desktop): 升级/重装刷新 ~/.freeos/portable - #89

Merged
XYAIStudio merged 1 commit into
mainfrom
cursor/refresh-portable-on-upgrade-15b7
Sep 20, 2026
Merged

XYAIStudio merged 1 commit into
mainfrom
cursor/refresh-portable-on-upgrade-15b7

Conversation

@XYAIStudio

Copy link
Copy Markdown
Owner

Summary

Windows 桌面安装/覆盖安装/同版本重装不再因为 ~/.freeos/portable 已存在而跳过解压。下次启动会刷新 packages/ 和内嵌 Dashboard,#88local-session / 无登录墙)及后续宿主修复不必再手工热补。

用户数据(octop.db、设置、对话)留在 ~/.freeos,产品路径不变:打开 → 可选模型(可跳过)→ 第一个智能体对话。

未发布 GitHub Release,也未挂到 v0.0.4。

Why the #88 verification build still served the old UI

The host only re-extracted when FREEOS_STAMP inside the bundled zip differed, or the semver was newer. Two other paths kept the old tree:

  1. Same zip stamp (same-version rebuild / reused portable zip) → shouldReplacePortable returned false while launchReady was already true.
  2. Running FreeOS during Setup → NSIS could not overwrite FreeOS.exe; the finish-page launch handed off to the old instance, which never extracted.

Result: local_session.py stayed at 7227 bytes, Dashboard kept index.DfMCjOvx.js, POST /api/auth/local-session still 403, register/login still showed despite /?desktop=1.

How upgrade refreshes portable now

  1. NSIS Setup stops a running FreeOS (asks first; silent installs stop without asking).
  2. Setup writes $INSTDIR\FREEOS_INSTALL_STAMP (product version + tick count, unique per Setup run).
  3. Setup deletes %USERPROFILE%\.freeos\portable\FREEOS_STAMP (also FREEOS_HOME / OCTOP_HOME / leftover ~/.octop/portable). It does not delete octop.db.
  4. Next launch: if the install stamp or zip FREEOS_STAMP differs, the shell re-extracts the bundled zip into ~/.freeos/portable, then copies the install stamp into that tree.
  5. Later opens skip extract until the next Setup run.
  6. A pending in-app zip under {home}/updates/ is applied even when the bundled stamp still matches.

Test plan

  • cd desktop/src && go test -count=1 -timeout 180s . (PASS)
  • python3 -m pytest --noconftest tests/unit/desktop/test_nsis_uninstall.py tests/unit/desktop/test_auth_brand_surfaces.py -q (20 passed)
  • make all (full Python suite; this change is desktop host + NSIS source, no Python runtime)

New coverage

  • Reinstall stamp forces extract even when zip FREEOS_STAMP matches
  • Cleared FREEOS_STAMP forces same-version refresh (what Setup now does)
  • Pending zip is applied even when bundled stamp matches
  • NSIS install section: stop processes → copy files → write install stamp → clear extracted stamp

Manual verify (Windows)

  1. Install an older desktop build so ~/.freeos/portable/packages/octop/.../local_session.py is the pre-fix(desktop): local-session 403 no longer forces register/login #88 size and Dashboard hashes look like index.DfMCjOvx.js.
  2. Run this PR’s NSIS installer over it (app may be running; confirm the stop dialog).
  3. Finish-page 运行 FreeOS (or Start Menu). First launch should show “正在更新内置运行环境…”.
  4. Confirm FREEOS_STAMP and FREEOS_INSTALL_STAMP exist under ~/.freeos/portable, local_session.py is the new size, Dashboard assets changed, POST /api/auth/local-session is not 403, UI goes optional model → first chat (no register/login).
  5. Quit and reopen: should not re-extract (install stamp already applied).
  6. Re-run the same installer: next launch must extract again.

Target branch

Open in Web Open in Cursor 

NSIS install/reinstall now stops a running FreeOS, writes a per-setup
FREEOS_INSTALL_STAMP, and clears the extracted FREEOS_STAMP so the next
launch re-unpacks packages and the embedded dashboard. Same-version
rebuilds no longer keep a stale runtime just because portable already
exists.

Co-authored-by: XYAI Labs <haoboy8@gmail.com>
@XYAIStudio
XYAIStudio merged commit 04d1f81 into main Sep 20, 2026
11 checks passed
@XYAIStudio
XYAIStudio deleted the cursor/refresh-portable-on-upgrade-15b7 branch September 20, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants