Repository navigation
Windows: a session can finish — stops that stop, state that survives, a first run that works - #2546
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ly once confirmed Co-Authored-By: Claude Opus 5.5 <[email protected]>
…opping servers Co-Authored-By: Claude Opus 5.5 <[email protected]>
…removal on Windows Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ire on Windows Co-Authored-By: Claude Opus 5.5 <[email protected]>
…every charge Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ng windows Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e deletion lock Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…chine readiness checks Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and line endings; the model sees LF output Co-Authored-By: Claude Opus 5.5 <[email protected]>
…paths Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the same contained open The contained open behind checkout.diff's untracked preview and checkout.locate was Unix-only, so on Windows every new file read as 'could not be opened safely' and no changed file could be opened or revealed. os.Root works on Windows; only the leaf's open flags differ (no O_NOFOLLOW or O_NONBLOCK there), and the same-file check after the open still refuses a leaf swapped for a link. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… POSIX-semantics rename Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ore rebinding its port Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (advisory) No engine test ran on Windows before; the engine only cross-built for it. The new job runs 306 named tests in 29 packages on windows-latest: process-tree stops, state replacement while held, reminders, spending, native paths, UTF-16 and line endings. It is not part of check yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er at launch A launch-time probe made a quiet engine send /key and /auth/key before anyone asked (TestC27NewChatByDefaultStaysQuiet), and the CLI started one on every command. Starting the engine now only enables key health; the first setup.get or health.check (or a key handover) starts one background check per key, and reads never wait for it. doctor still checks directly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
windows/stability
branch
from
November 9, 2026 21:21
bb2f511 to
a653bde
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
marked this pull request as ready for review
November 9, 2026 21:53
Conflict in cmd/codeaf/app.go: this branch starts the lazy key health check where app/v3 added the quit-time receipt hurry; both are kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… bytes and health checks The non-login foreground shell, CRLF-to-LF output, line-ending coercion on rewrites and pipefail health checks are Windows-only. On macOS and Linux a headless command loads the login profile again (bash -lc), captured output keeps its bytes, ordinary rewrites write what they are given, and a health check's status is its last command's, as before this PR. The PR's text and shell contract tests now state each OS's rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…order Proof that the whole tree is gone before a kill reports stopped, and locking the usage ledger through its read handle, are Windows-only leaves. Unix keeps the original signal receipt and writer flock order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s before Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…adiness probes on Windows only The lazy key check, the default model for a fresh setup and codeaf doctor's new checks run on every OS; their wire fields are optional, so older payloads still decode. The desk's setup and health reads run gh and git probes only on Windows: on macOS gh reads its token from the login Keychain. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
added a commit
that referenced
this pull request
Nov 10, 2026
AbirAbbas
added a commit
that referenced
this pull request
Nov 10, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
added a commit
that referenced
this pull request
Nov 13, 2026
Crew members with nothing in flight are answered from their files rather than held open, and a quiet member is let go after the idle time. Their task lists are remembered in a bounded memory and disk cache. Readers pin a conversation so that release never tears it down mid-read, and opening a settled conversation no longer rewrites unchanged files. The engine's GC percent now follows the live heap. The port keeps dev's later guarantees (#2313, #2014, #2016, #1971, #1991, #2041, #2556, #2090, #2546). It reshapes every new gate site for the lock-defer law, so lockRelease expects its caller to hold the gate already; close and delete take the gate before calling it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
pushed a commit
that referenced
this pull request
Nov 13, 2026
Crew members with nothing in flight are answered from their files rather than held open, and a quiet member is let go after the idle time like any other conversation. Their task lists are remembered while their files are unchanged, in memory (24 MiB) and in a rebuildable disk cache (96 MiB, 256 files). Readers pin a conversation so that idle release, close and delete never tear it down mid-read, and explicit close and quit stay bounded. Opening a settled conversation no longer rewrites unchanged tasks.json or meta.json, and the engine's GC percent follows the live heap. Ported from app/v3 onto dev. It keeps dev's later guarantees (#2313, #2014, #2016, #1971, #1991, #2041, #2556, #2090, #2546), and every new gate site follows the lock-defer law. Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Summary
CodeAF had never completed an end-to-end session on native Windows (not WSL), from the desktop app or the CLI. A native-Windows investigation found no single bug: shared code silently assumed POSIX in several places, and no test ever ran on Windows. This PR fixes the engine side so a Windows session can get from first launch to a stopped dev server and a reviewed change. A companion desk PR fixes the desk's path handling.
The rule throughout is one implementation with thin OS leaves. OS-specific code lives only behind existing function signatures in
_windows.go/_unix.gofiles or one smallruntime.GOOScheck. macOS and Linux behave as on app/v3, except for the additive changes listed under macOS and Linux.What changes
Stopping a process stops it (
processgroup, jobs, services, checks, delegates)cmd.exe /d /s /c node …chain, which used to detach and keep serving after Stop.stoppedonly once the job has no live process; an unverified ending staysrunningand sends no stopped note. macOS and Linux keep their existing signal-and-wait stop and receipts.python/pyinstead of thepython3Store stub, npm/npx are.cmdshims, and long-running servers should be started and stopped with the jobs tool, because Git Bash'skillcan't reach native processes.State files survive Windows file semantics (
fsreplaceand its callers)fsreplace.Open/OpenFileopen held state files with delete sharing.fsreplace.Remove/RemoveAllretry transient locks.fsreplace.Renamereplaces a file another handle holds open with a POSIX-semantics rename (FileRenameInfoEx). It falls back to the existing retrying rename elsewhere.fsreplace.The first session can succeed (setup, doctor, opener, installer)
setup.getorhealth.checkis first read or a key is handed over. It is never checked at launch, so a quiet engine stays quiet. The check has a short timeout and a cached result, and reads never wait for it.setup.get/health.checkexpose it as ok / invalid / unknown. A 401 on a real turn marks it invalid.codeaf doctorchecks it directly.codeaf doctoralso reports git identity,gh auth statusand, on Windows, whether Git Bash was found, each with a timeout and a fix hint (every OS). The desk'shealth.checkcarries those readiness checks only on Windows: on macOS gh reads its token from the login Keychain, and probing on every desk read could prompt.scripts/install.shrun from Git Bash adds the install folder to the user's PATH, or prints the exact command to do it.Text and paths (exec tools, folder picker, report references)
codeaf do/exec/runcommands runbash -cinstead of a login shell (a login shell cost ~300 ms per command there; chat already usedbash -c), and health checks use the shared Git Bash resolver with pipefail. macOS and Linux keepbash -lcfor headless commands and their original health checks, so a deployment that gets PATH from a login profile is unaffected.C:\…,C:/…and UNC paths; macOS and Linux path handling is unchanged.Desk checkout on Windows: the contained open behind diff previews of new files and behind Open/Reveal was Unix-only, so every new file read as "could not be opened safely". It now uses the same
os.Rootwalk on Windows; only the leaf's open flags differ.CI: a new advisory
windows native testsjob runs 306 named tests in 29 packages onwindows-latest. Every listed test passed natively. It is not part ofcheckyet.macOS and Linux
Before merging, every non-test change in this PR was audited (121 files) as Windows-only, unchanged on macOS/Linux, or shared, so existing macOS and Linux deployments keep working.
Windows-only, with the macOS/Linux behaviour pinned to app/v3 by
TestUnixParity*tests and per-OS contract tests:bash -c); unix keepsbash -lcseniordev/patchinterceptingbash -csetup.get/health.checkShared on every OS (additive; nothing that worked before changes):
codeaf doctor's new checksProposed follow-ups, each with its own cross-platform hand test:
yes | head -1exits 141 there. This is pre-existing and was found on the Mac run.Validation contract
.cmdshims. Their ports are free afterwards.fsreplace; the reader keeps its old generation. A due reminder fires on Windows.ghsign-in or Git Bash is told so, with the fix.TestUnixParity*).New tests are named after their contract item (
TestContractWindows*,TestPublishContract*,TestSetupContract*,TestTextContract*,TestIntFixContract*,TestUnixParity*).Evidence
The same Windows-relevant test selection was run natively on Windows 11 (Go 1.26.5, Git for Windows defaults, Defender on), at the base commit and with this branch:
Headless
codeaf execon Windows: 35–39 ms between model requests for no-op commands, down from 282–320 ms with the login shell.A scripted model then drove the real engine and the desk on Windows. Edit a CRLF file, write a new file, shell basics, a long command, cancel, quit and relaunch, path variants, UTF-16 read and edit, and a task with landing all behaved as on Linux. In the dev-server scenario (
npm start,curl,jobs kill), nothing was left on the port afterwards. Pressing the desk's Stop button onnpm startendednode src/server.jsand freed its port. Before, the server kept serving undercmd.exe /d /s /cwhile the desk said "stopped".Stability check before merge (head e38a7a6, base a687c92)
Windows 11, native (Go 1.26.5, Git for Windows defaults, Defender on):
windows native testsjob lists: 305 pass. The one failure isTestTakeLedgerRemoteIdentityCombinations, which is Windows: taking a chat back to a computer it was on fails with "Access is denied" in the handoff swap #2565 (below) and fails earlier at base.TestUnixParity*: 11 pass; the 3 unix-only cases skip on Windows.npm startfrees the port, quitting stops running jobs ("stopped by quit"), and the diff preview of a new file opens.macOS 15.6, Apple silicon (Go 1.26.5):
go build ./...andgo veton the 30 touched packages pass.TestUnixParity*16,TestTextContract*13,TestContract1/32,TestSetupContract*8,TestUnixDoorArgv1). Four more live in_windows_test.gofiles.cmd/codeafsharded), no failure is new. Every failure reproduces identically at the base:/private/tmpscratch;cmd/codeaffactory/memory fixtures that expectbashonPATH;TestRunSurface*;syncsetuptests hitwireauth: clock skewwhile the machine slept. They pass at head and base on a rerun with sleep prevented.codeaf --versionandcodeaf doctorexit 0 under a throwaway home with noghonPATH, and the doctor rows are as expected. Nothing touched the login Keychain and no Keychain prompt appeared.CI: all 10 checks green at e38a7a6, including the advisory
windows native testsjob.Not in this PR
internal/delegate/builtin/carried_windows.go). They still need the hold/report foundation (handle inheritance, descriptor-relative report reads, boot identity).internal/taskcopytests still fail on POSIX permission bits and portable full history.git worktree addfail with "Filename too long" on Windows, at base and with this branch alike.TestAServedFactoryStartsAGoAheadsJobWithNoAppAttachedcan fail withTempDir RemoveAll cleanup … directory not empty, on app/v3 too (about 3 in 20 runs). The cause: the served factory's GitHub poll was cancelled but never joined, so a pass could still write afterserveFactoryreturned. Fixed in the app/v3 → dev landing (land/app-v3 8e3411a).TestTakeLedgerRemoteIdentityCombinationsreproduces it there; it passes on GitHub's Windows runner. app/v3 fails the same test earlier, so it is tracked separately and does not block this PR.cmd/codeaftests compiling on Windows. tests: FIFO and Unix-helper cases build for Windows; make vet checks the Windows test build #2192 covers thesyscall.Mkfifo/Killfixtures, plus one newersyscall.Killinapp_one_engine_test.go.Test plan
go vet,GOOS=windows/GOOS=darwinvet and test compilation for every touched packagejobs kill, cancel, task and landing, quit and relaunch, UTF-16, per-command overhead); desk Stop, diff review and new-file preview against this enginemake test-quick,make test-tooling,make changelog-checklocally. Touched packages run in CI; locally only the tui3 frame law fails under load, and it fails on base too.TestUnixParity*, scenarios, desk Stop / quit / new-file preview)codeaf doctorwith no Keychain use🤖 Generated with Claude Code