Skip to content

agent tests: Zed's folder on Windows is %APPDATA%\Zed, and two Codex fixtures quote a literal path - #1080

Open
TryWorld2026 wants to merge 2 commits into
yetone:mainfrom
TryWorld2026:fix/agent-windows-test-fixtures
Open

TryWorld2026 wants to merge 2 commits into
yetone:mainfrom
TryWorld2026:fix/agent-windows-test-fixtures

Conversation

@TryWorld2026

@TryWorld2026 TryWorld2026 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

agent tests: Zed's folder on Windows is %APPDATA%\Zed, and two Codex fixtures quote a literal path

What is wrong

Three Windows-only test failures in internal/agent, each with its own cause.
None of them is a product bug.

1. syncHome isolated HOME and USERPROFILE but not %APPDATA% or
%LOCALAPPDATA%.
An agent on Windows takes those folders from the
environment, so the package's tests read — and in places wrote — the developer's
real Roaming directory instead of the sandbox home. syncHome is the package's
shared sandbox, so this one fix covers every test that uses it.

2. TestZedRelativeConfigDirUsesDefault expected one path on every platform.
On Windows zed() takes its folder from %APPDATA% whatever cfg it is given,
so the test failed with relative config directory escaped default: <package sandbox>\AppData\Roaming\Zed\settings.json, want <home>\.config\zed\settings.json
— it was asserting magpie's behaviour was wrong on the one platform where it is
right.

3. Two Codex fixtures wrote a Windows absolute path into a TOML basic
string.
In "C:\Users\…" the \T, \001 and \m are not escapes:
edit.SetTOMLTop answers line 3, column 26: invalid escaped character U+0031 '1', magpie's Codex model list is never written, and the Codex half of
TestSuffixModesReachAgentFiles fails with on, codex: map[]. The package's
other TOML fixtures (sync_test.go, modelprefs_test.go, legacy_test.go)
already quote the path as a literal.

What changed

  • syncHome also sets APPDATA and LOCALAPPDATA under the sandbox home.
  • TestZedRelativeConfigDirUsesDefault expects Zed's own folder under the
    APPDATA the test sets on Windows, and the cfg argument everywhere else;
    it sets APPDATA itself, as the package's other sandboxes do, so the
    expectation names its own home.
  • The two Codex fixtures quote the path as a TOML literal.

Semantic change

No app change. What changes is what go test ./internal/agent exercises on a
Windows box: the Codex half of TestSuffixModesReachAgentFiles had never once
been exercised there, and the package's sandbox no longer reaches the real
%APPDATA%.

Verification

On the Windows box:

  • TestZedRelativeConfigDirUsesDefault and TestSuffixModesReachAgentFiles fail
    before and pass after.
  • The fixture's old form reproduces invalid escaped character U+0031 '1' from
    edit.SetTOMLTop and the literal form does not.
  • go vet and GOOS=windows/darwin/linux go build -tags nogui ./internal/agent/ pass; gofmt is clean on the changed files after LF
    normalisation, since the working tree is CRLF under core.autocrlf.

Not this PR's impact

Windows CI does not run this package (the Windows job only compiles the suite),
so this does not turn a red CI job green. What it fixes is a local
go test ./internal/agent/ on Windows and the sandbox reaching the real
%APPDATA%.

A third Windows-red test in this package is not fixed here, by design.
TestCodexStaleOnlyForMagpiesChange still fails on Windows with
magpie's list changed: 0 stale, want 1, exactly as it does on main: Agent.Stale()
returns 0 on Windows unconditionally (internal/agent/connectinfo.go — it reads
ps's etime, which Windows has no way to give), so the assertion can never hold
there and the test has no platform guard. That is the neighbouring PR's change;
this one leaves it precisely as red as it already was.

Note on a neighbour

internal/agent/connect_stale_test.go is also changed by the Windows platform
guards PR, which adds a skip to TestCodexStaleOnlyForMagpiesChange where this
one only changes its TOML quoting. The two are different classes and will
conflict in the one file; whichever merges second resolves it.

Both Codex fixtures are quoted as literals because they are both the same bug,
not just the one that is reachable today: a t.TempDir() path is a Windows
absolute path on a Windows box, and in a TOML basic string its backslashes are
escapes. connect_stale_test.go's copy is currently masked by the Stale()
failure above, which reaches its assertion first; quoting it as a literal keeps
the day Stale() can answer on Windows, or the day that guard comes out, from
reopening it.

…LOCALAPPDATA%

syncHome set only HOME, USERPROFILE and the XDG folders, while testenv's
package home already holds APPDATA and LOCALAPPDATA. vscodeOf and zed read
the real %APPDATA% and fall back to the home they are given only when it is
empty, so a test that found VS Code or Zed through syncHome was pointed at
the package's folder rather than its own temp home: TestVSCodeInsiders
failed with "insiders dir <package sandbox>\AppData\Roaming\Code - Insiders\User
outside <t.TempDir()>". syncHome is the one shared helper that left them
out; claude_caps_test.go, codex_route_test.go, effort_test.go, unset_test.go
and the rest set both.

syncHome now points APPDATA and LOCALAPPDATA at the home it makes, as those
helpers do. No app change.

Verified on the Windows box: TestVSCodeInsiders fails without the two lines
("insiders dir ... outside ...") and passes with them. go test -tags nogui
./internal/agent/ keeps the failures it has either way (the aside offline
tests, TestOmpDetectedWithPiDir, TestWSLProbeScriptSaysWhere, and
TestCodexStaleOnlyForMagpiesChange, which Stale()'s Windows guard leaves
red), so no other test leaned on the old value. go vet and
GOOS=windows/darwin/linux go build -tags nogui ./internal/agent/ pass; gofmt
is clean on the changed file after LF normalisation, since the working tree
is CRLF under core.autocrlf.
…fixtures quote a literal path

TestZedRelativeConfigDirUsesDefault expected <home>/.config/zed on every
platform, but on Windows zed() takes the folder from %APPDATA% whatever cfg
it is given: the test failed with "relative config directory escaped
default: <package sandbox>\AppData\Roaming\Zed\settings.json, want
<home>\.config\zed\settings.json". The expectation is now per GOOS: Windows
gets Zed's own folder under the APPDATA the test sets, as the product reads
it, and the cfg argument is what it always was on the other platforms. The
test sets APPDATA itself, as the package's other sandboxes do, so the
expectation names its own home.

TestSuffixModesReachAgentFiles and TestCodexStaleOnlyForMagpiesChange wrote
a Windows absolute path into a TOML basic string, where the path's \T, \001
and \m are not escapes: SetTOMLTop answers "line 3, column 26: invalid
escaped character U+0031 '1'", magpie's Codex list is never written, and the
codex half of the first fails with "on, codex: map[]". Both fixtures now
quote the path as a TOML literal, as sync_test.go, modelprefs_test.go and
legacy_test.go already do, so the codex half is really checked on Windows.

TestCodexStaleOnlyForMagpiesChange stays red on Windows at "magpie's list
changed: 0 stale, want 1": Stale() returns 0 where it can't be told
(Windows), a platform guard another change adds. This commit is only the
fixture beside it, and the two are not the same class. The impact of the
fixture is not Windows CI, which does not run this package: it is a local
go test ./internal/agent/ on Windows, and a codex half that had never been
exercised there.

No app change. Verified on the Windows box: TestZedRelativeConfigDirUsesDefault
and TestSuffixModesReachAgentFiles fail before and pass after; the fixture's
old form reproduces "invalid escaped character U+0031 '1'" from
edit.SetTOMLTop and the literal form does not. go vet and
GOOS=windows/darwin/linux go build -tags nogui ./internal/agent/ pass; gofmt
is clean on the changed files after LF normalisation, since the working tree
is CRLF under core.autocrlf.
@TryWorld2026
TryWorld2026 force-pushed the fix/agent-windows-test-fixtures branch from 4a97976 to f16877f Compare October 7, 2026 01:00
@TryWorld2026 TryWorld2026 changed the title Fix/agent windows test fixtures agent tests: Zed's folder on Windows is %APPDATA%\Zed, and two Codex fixtures quote a literal path Oct 7, 2026

This branch has not been deployed

No deployments
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.

1 participant