Repository navigation
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
Open
agent tests: Zed's folder on Windows is %APPDATA%\Zed, and two Codex fixtures quote a literal path#1080TryWorld2026 wants to merge 2 commits into
TryWorld2026 wants to merge 2 commits into
Conversation
…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
force-pushed
the
fix/agent-windows-test-fixtures
branch
from
October 7, 2026 01:00
4a97976 to
f16877f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
syncHomeisolatedHOMEandUSERPROFILEbut not%APPDATA%or%LOCALAPPDATA%. An agent on Windows takes those folders from theenvironment, so the package's tests read — and in places wrote — the developer's
real Roaming directory instead of the sandbox home.
syncHomeis the package'sshared sandbox, so this one fix covers every test that uses it.
2.
TestZedRelativeConfigDirUsesDefaultexpected one path on every platform.On Windows
zed()takes its folder from%APPDATA%whatevercfgit 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,\001and\mare not escapes:edit.SetTOMLTopanswersline 3, column 26: invalid escaped character U+0031 '1', magpie's Codex model list is never written, and the Codex half ofTestSuffixModesReachAgentFilesfails withon, codex: map[]. The package'sother TOML fixtures (
sync_test.go,modelprefs_test.go,legacy_test.go)already quote the path as a literal.
What changed
syncHomealso setsAPPDATAandLOCALAPPDATAunder the sandbox home.TestZedRelativeConfigDirUsesDefaultexpects Zed's own folder under theAPPDATAthe test sets on Windows, and thecfgargument everywhere else;it sets
APPDATAitself, as the package's other sandboxes do, so theexpectation names its own home.
Semantic change
No app change. What changes is what
go test ./internal/agentexercises on aWindows box: the Codex half of
TestSuffixModesReachAgentFileshad never oncebeen exercised there, and the package's sandbox no longer reaches the real
%APPDATA%.Verification
On the Windows box:
TestZedRelativeConfigDirUsesDefaultandTestSuffixModesReachAgentFilesfailbefore and pass after.
invalid escaped character U+0031 '1'fromedit.SetTOMLTopand the literal form does not.go vetandGOOS=windows/darwin/linuxgo build -tags nogui ./internal/agent/pass; gofmt is clean on the changed files after LFnormalisation, 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.
TestCodexStaleOnlyForMagpiesChangestill fails on Windows withmagpie'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 readsps's etime, which Windows has no way to give), so the assertion can never holdthere 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.gois also changed by the Windows platformguards PR, which adds a skip to
TestCodexStaleOnlyForMagpiesChangewhere thisone 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 Windowsabsolute 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 theStale()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, fromreopening it.