Commit Graph
5 Commits
Author SHA1 Message Date
yetone 55213c1b4d agent: the Windows Codex app's version comes from its main Store package only, and agent tests never read the machine's AppX registry (#1334)
Review follow-up to 46e4107 (AwadYoo).

What:
- storeAppVersion counts only the main package (empty resource id). The
  Windows box's AppX registry key keeps a resource package that Get-AppxPackage
  no longer lists (Clipchamp.Clipchamp_4.6.10420.0_neutral_split.scale-125_…
  beside the installed 4.7.10020.0_x64__…). A stale entry like that is no sign
  the app is installed, and a newer-numbered one would win "newest".
- internal/agent's TestMain stubs windowsStorePackages, as it already does
  for nodeModulesOf and the other machine readers (#1823's rule): on a
  Windows box with the Codex app installed, tests read nothing of it.
- the doc comment for storeAppVersion had a blank line in the middle of it.
  It is joined, and windowsStorePackages has its own comment.

Run (go1.26.8, sandbox HOME, private GOCACHE):
- Windows box (Win 11 x64): installed the real Store app (winget
  9PLM9XGG6VKS, "ChatGPT", OpenAI.Codex_26.1007.2314.0_x64__2p2nqsd0c76g0).
  A probe built from origin/main printed AppVersion="" HasApp=false; built
  from this series: AppVersion="26.1007.2314.0" HasApp=true, and CLI()
  ok=true App="26.1007.2314.0" with no codex CLI on PATH.
- break checks: the resource-id filter put back to len(fields) < 3 ->
  TestCodexWindowsStoreAppVersion FAIL `Codex Store app: "27.0.0.0"`;
  AppVersion without the Store read -> FAIL `Codex Store app: ""`.
  Restored: pass on darwin and on the Windows box (test binary built with
  GOOS=windows GOARCH=amd64, run there with the real app installed).
2026-10-13 05:48:39 +08:00
尤贺雨 4697ff2324 agent: the Agents page shows the Windows Codex app's version, read from the Microsoft Store package registered for the user (#1334, laacmilan)
On Windows the Codex app is the Store package OpenAI.Codex
(C:\Program Files\WindowsApps\OpenAI.Codex_26.1002.7124.0_x64__2p2nqsd0c76g0
in the report), which magpie didn't read: only %LOCALAPPDATA%\Programs was
looked in. The version now comes from the package full names under the
current user's AppX repository key (HKCU\...\AppModel\Repository\Packages),
which needs no access to the protected WindowsApps folder and starts no
PowerShell. The newest OpenAI.Codex package with publisher id 2p2nqsd0c76g0
wins.

Test: TestCodexWindowsStoreAppVersion (picks the newest, skips a bad
version and another publisher, and a WSL twin shows none).

[Message rewritten at review to say what and why; the code is AwadYoo's. The
conflict with 2221b63f9 (macAppFolders) was resolved by keeping both.]
2026-10-13 05:48:39 +08:00
yetone 2221b63f93 agent, provider: tests no longer read the machine's /Applications or Program Files, so a Mac with DeepSeek Harness.app installed keeps TestAsideOfflineDisconnectRestoresWithoutDaemon green (#1823)
What: every place magpie looks for installed apps outside the home folder
now goes through proc.SystemDirs, which in a test binary testenv isolated
puts the path under the test's home (as it already does for Homebrew's
bin, #1525):
- agent: a new macAppFolders(home) (/Applications via SystemDirs, plus
  ~/Applications) is used by appFolders (desktop apps: Codex, dsh),
  pencilApp, t3App and reasonixDetected;
- cursorLocalRoots: macOS through macAppFolders, Windows' ProgramFiles and
  Linux's /opt, /usr/share, /usr/lib through SystemDirs;
- zedAppPath's /Applications/Zed*.app, npmGlobalPrefix's ProgramFiles npm
  fallback, and provider's /Applications/ZCode.app builtin config.
Production behaviour is unchanged: SystemDirs returns paths as they are
outside a sandboxed test.

Why: HasApp/AppVersion read the real /Applications, so on a Mac with
DeepSeek Harness.app the dsh fixture's CLI was never "missing" and the test
failed every time; CI has no such app, so nobody else saw it. The same
shape was in five other readers.

Test: TestAppFoldersStayInTheTestHome checks every app folder lies under
testenv's home (all OSes), and on macOS that an app installed in the
sandbox's /Applications is the one found.

Run (go1.26.8, sandbox HOME, private GOCACHE):
- repro on old code: appFolders pointed at a temp folder holding a fake
  "DeepSeek Harness.app/Contents/Info.plist" (com.deepseek.dsh) ->
  TestAsideOfflineDisconnectRestoresWithoutDaemon FAIL "native fixture must
  report missing CLI".
- break check: macAppFolders put back to the literal /Applications ->
  TestAppFoldersStayInTheTestHome FAIL (appFolders, macAppFolders,
  cursorLocalRoots look in /Applications; sandbox app not found). Restored:
  pass.
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./...: clean.
- go test -tags nogui ./internal/agent ./internal/proc ./internal/provider: ok.
- -race -count=5 on the touched agent tests: ok.
Not run: the full go test ./...; Windows and Linux test runs (vet only);
reasonix's Windows registry lookup and Zed's mdfind fallback still ask
the machine (not folder paths) and are left as they are.

Reported-by: mdwsk88
2026-10-12 23:56:20 +08:00
yetone ee3f83b59d agents: DeepSeek Harness Desktop installed is no missing dsh CLI — its version shows instead of 未找到 CLI (star on Discord)
star on Discord: "DeepSeek Harness 就是现在已经有桌面版了,但是他还是非要找CLI".
With DeepSeek Harness Desktop in use and no dsh on PATH, the Agents page
said 未找到 CLI and Install another agent offered npm's dsh: CLIMissing
(#843) took ~/.dsh without a CLI for an uninstall. The desktop app
(DeepSeek Harness.app, com.deepseek.dsh, 0.2.0-rc.2 from
download.deepseek.com) keeps the same ~/.dsh — its own profile,
profiles/desktop/cordis.patch.yml, and .credentials.yaml — and needs no
CLI; its terminal command (Manage dsh Command…) is optional.

- desktopapp.go: dsh's app is known by its bundle id on macOS and by
  %LOCALAPPDATA%\Programs\DeepSeek Harness\DeepSeek Harness.exe on
  Windows (electron-builder per-user NSIS, productName DeepSeek Harness,
  getWindowsInstallationDirName); HasApp says either is installed.
- install.go: CLIMissing is false with the agent's desktop app installed,
  so the GUI row, Install another agent and /api all follow; the app's
  version shows through the existing CLI().App path.
- dsh.go: the restart notice also sees DeepSeek Harness.app running.

The red "已不经过 magpie" line in the report is a separate dshCheck
finding, not caused by the missing CLI: a desktop-only ~/.dsh shaped
from the app's real new-profile template wires cleanly (Check "", no
Drift; TestDshDesktopOnlyWired). The reporter's exact detail is cut off
in the screenshot and is not reproduced.

Run: TestDshDesktopAppIsNoMissingCLI fails on the old code ("with the
desktop app: missing true, offered true"; with the Windows path removed,
"with the Windows app: missing true, offered true"), passes with the
fix. go test -tags nogui ./internal/agent ./internal/gui under a temp
HOME with pinned caches: ok. gofmt -l clean; go vet darwin, GOOS=linux
-tags nogui, GOOS=windows on both packages; go build darwin,
GOOS=linux -tags nogui, GOOS=windows: ok. Not tried: the real desktop
app running live (not installed here; its userData isn't redirected by
a sandbox HOME), a real Windows install.
2026-10-09 12:56:08 +08:00
yetone ae24bcfcfb agent, gui: Codex's row on the Agents page shows its desktop app's version beside its CLI's ("CLI 0.130.0", "App 26.930.31730"), and the app's alone where no CLI is on PATH (#1334, laacmilan)
The app's version is read from /Applications or ~/Applications
ChatGPT.app (or Codex.app) Contents/Info.plist, taken only when its bundle
id is com.openai.codex, so the ChatGPT chat app (com.openai.chat) isn't
taken for it. macOS only: the Windows Store package isn't read yet. The
app chip's tooltip says it reads the same settings as the CLI, so
connecting Codex connects both. At narrow widths the chip ellipsizes, and
below 250px it gives way so the name keeps its room.

Verified: TestCodexAppVersion fails without the CLI() change ("the app
alone, no CLI"); agent-app-version.test.cjs fails 12/16 without the app.js
change and passes 16/16 with it, Chromium and WebKit, en/zh/ja/de, at 980,
560 and 440px. agent-cli-missing, agent-connect, agent-field-names,
agent-layout, agent-update-all, cli-update, click-scroll, gui-ja, gui-de,
i18n-keys pass in both engines. internal/agent passes in Linux Docker
(non-root); full ./... on macOS; vet darwin/linux/windows. Read
26.930.51102 from the real /Applications/ChatGPT.app on this Mac. Not
tried on the reporter's machine.
2026-10-09 00:02:40 +08:00