Repository navigation
fix(wsl): run WSL git with Windows Git line-ending settings on checkouts Windows Git wrote - #27778
Conversation
a8d8d5b to
52146d4
Compare
…commit CRLF on an unproven checkout - worktree add / clone write a new checkout whose .git points at /mnt/..., which Windows Git cannot open; injecting autocrlf=true there produced CRLF files later read unflagged. - Writes on a host-autocrlf=true checkout whose sample is unproven run with autocrlf=input, so staging normalizes CRLF without ever writing CRLF to disk. - Writes wait for a stale host answer and re-check checkout identity after joining a sample.
52146d4 to
3a42e4d
Compare
|
Adversarial review pass (self + Codex), rebased on main. Fixes pushed:
Accepted residuals: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No actionable issue remains from this review; the change is ready for normal merge checks. Pre-merge checks ·
|
* Update README downloads badge * fix(i18n): drop chat-mode keys removed from en.json in stablyai#28113 (stablyai#28131) * Speed up Mobile Checks by overlapping typechecks and tests (stablyai#28127) Overlap mobile typechecks with tests and avoid repeated filesystem probes and unused device substitutes in recording replays. Keep state isolated between loaders, give exhaustive snapshot cases an explicit execution deadline, and retire obsolete locale keys that blocked repository validation. * fix(orcad): identify instances by kernel start ticks, not drifting wall-clock start time (stablyai#28125) * fix(orcad): identify instances by kernel start ticks, not drifting wall-clock start time On Linux the start time is derived from /proc/stat btime, which drifts (WSL2, NTP), so a live orcad was read as a reused PID and its managed stop reported exited without ever writing the request. The lock and stop request now carry optional linuxStartTicks + bootId; readers prefer them, and a wall-clock mismatch on Linux for records without them is unverifiable, never proof of exit. Co-Authored-By: Claude <[email protected]> * fix(orcad): match stop receipts without the incarnation an older client drops A request recovered by an older client loses linuxStartTicks/bootId, which made the newer host reject its own receipts and decision records as mismatched. Also exercise the incarnation reader against a real Linux /proc. --------- Co-authored-by: Claude <[email protected]> * docs(readme): point the Android APK links at 0.0.55 (stablyai#28134) Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * perf(runtime): stop re-sending the worktree list to mobile pollers on every terminal chunk (stablyai#28062) * perf(runtime): let worktree.ps pollers opt out of per-chunk activity churn worktree.ps carries `preview` and an exact `lastOutputAt` on every row, both of which move on each PTY chunk, so the content-addressed snapshot id changed on every poll while any agent printed and the whole catalog was resent. Add an optional `coarseActivity: true` param. When set, the host drops `preview` and floors `lastOutputAt` to 30 s before hashing, so the id holds while only chunk-level activity moves. Callers without the param get the byte-identical response they get today; older hosts strip the unknown key. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * perf(mobile): stop re-sending the worktree list on every terminal chunk The host-screen snapshot poll now asks worktree.ps for `coarseActivity`, so the catalog's snapshot id survives terminal output and the 3 s poll gets a tiny `unchanged` reply instead of the whole catalog. `preview` is optional on mobile rows because a coarse host leaves it out; old hosts ignore the param and keep sending it. Re-records the three worktree.catalog-snapshot goldens; the only semantic change is the new request param. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * perf(runtime): coarsen worktree.ps activity for every snapshot poller Drop the `coarseActivity` param: the only caller that sends `afterSnapshotId` is the mobile snapshot poll, which never renders `preview` and uses `lastOutputAt` only to rank rows. Snapshot polls now always get a blank `preview` and a 30 s-floored `lastOutputAt`, so already-shipped apps stop re-downloading the catalog on every terminal chunk with only a desktop update. Callers without `afterSnapshotId` still get the byte-identical response. Reverts the mobile param, its scenario steps and the three re-recorded goldens, and removes the unread `preview` field from mobile row types. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(runtime): rank coarsened worktree.ps rows so in-bucket swaps keep the snapshot id Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test: drop preview from row fixtures and keep the runtime cast on one line Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): load markdown tabs from any desktop split group; center load-error Retry (stablyai#28132) * fix(mobile): load markdown tabs from any desktop split group and center load-error Retry The desktop answered markdown.readTab only for tabs in its focused split group, so a phone opening a markdown tab from another group got tab_not_found and showed "Couldn't load markdown". Resolve the tab across all of the worktree's groups. Load-error states now share one component that centers the message and its Retry button; the markdown reader's button was pinned to the left. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(renderer): mobile markdown read picks the requested tab across groups Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(renderer): resolve mobile markdown tab to one file id Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(wsl): run WSL git with Windows Git line-ending settings on checkouts Windows Git wrote (stablyai#27778) * fix(wsl): run WSL git with Windows Git settings on Windows-authored drive checkouts * fix(wsl): detect Windows Git checkouts from host autocrlf plus a whole-tree sample * fix(wsl): keep WSL-created worktrees on Linux Git defaults and never commit CRLF on an unproven checkout - worktree add / clone write a new checkout whose .git points at /mnt/..., which Windows Git cannot open; injecting autocrlf=true there produced CRLF files later read unflagged. - Writes on a host-autocrlf=true checkout whose sample is unproven run with autocrlf=input, so staging normalizes CRLF without ever writing CRLF to disk. - Writes wait for a stale host answer and re-check checkout identity after joining a sample. * fix(wsl): compare a joined sample with the checkout identity read after it settles * fix(runtime): stop a project's terminals before the host forgets the project (stablyai#28024) * fix(runtime): stop a project's terminals before the host forgets the project Removing a project on a runtime host (an SSH-managed or paired server) sent repo.rm first; the host resolves terminal.stop through the project's workspace rows, which repo.rm deletes, so the stop failed and the shells kept running on the host. Terminals stop first now. The removal toast also drops the IPC wrapper from its message. * fix(runtime): only stop host terminals when the host will accept the project removal Probe with repo.show (same resolver as repo.rm) so a removal the host rejects, such as an ambiguous project id, no longer kills the shells first. Also poll through terminal_not_writable in the paired-client e2e. * test(e2e): read the host shell pid through sh so non-POSIX login shells work * fix: preserve relay pane claims across managed tab mirrors * fix(mobile): cancel bridge-post retries when a terminal document stops Mobile Checks verify failed on an unhandled ReferenceError: window is not defined inside postToReactNativeWebView's scheduled send() retry while viewport-frame.test.ts ran. Retries lived outside the document lifecycle, so a stop left timers that later read a torn-down window. Bind the default postToHost per scope, clear its timers on stop, no-op posts after stop, and guard window before reading ReactNativeWebView. Preserve bounded retry and deliver-when-bridge-appears behavior. * fix(mobile): use supported own-property check for host overrides * fix(mobile): align bridge retry teardown with document lifecycle contract * style(mobile): format bridge retry lifecycle regression test --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Neil <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Jinwoo Hong <[email protected]>
…ches The WSL-on-Windows-drive line-ending sample piped ls-files --eol through grep then head, so when no entry was eligible (* text=auto) head never closed the pipe and every file was read over drvfs until the 15 s timeout, which stage, discard and commit waited on after each backoff. Cap the raw ls-files output before the grep. Follow-up to #27778.
…ches The WSL-on-Windows-drive line-ending sample piped ls-files --eol through grep then head, so when no entry was eligible (* text=auto) head never closed the pipe and every file was read over drvfs until the 15 s timeout, which stage, discard and commit waited on after each backoff. Cap the raw ls-files output before the grep. Follow-up to #27778.
…ches (#29552) * fix(wsl): bound the line-ending sample's index scan, not just its matches The WSL-on-Windows-drive line-ending sample piped ls-files --eol through grep then head, so when no entry was eligible (* text=auto) head never closed the pipe and every file was read over drvfs until the 15 s timeout, which stage, discard and commit waited on after each backoff. Cap the raw ls-files output before the grep. Follow-up to #27778. * docs(wsl): describe the line-ending sample as the first index entries
ELI5
When a repo on
C:was checked out by Windows Git, its text files have Windows line endings (CRLF). If the project's runtime is WSL, Orca runs Linux Git on those files, and Linux Git thinks nearly every file was edited. It also re-reads every file on each check, so status takes over a minute. Orca now checks whether Windows Git would have written CRLF for that checkout. When it would, Orca runs its own WSL Git with the same settings Windows Git uses. Source Control then shows the real changes, in seconds.What Changed
Before: a project on a Windows drive, cloned with Windows Git (
core.autocrlf=trueis Git for Windows' default), with the WSL runtime selected:After: only the files that really changed are listed, status takes about 5.5 s, and staging writes LF the same way Windows Git does. Orca's write paths (checkout, reset, stash, restore, apply, merge, cherry-pick, commit) produced byte-identical results to Windows Git in an independent check on the same host.
Mechanism. Orca's WSL Git gets
-c core.autocrlf=true -c core.checkStat=minimalfor checkouts that Windows Git wrote. It never writes the user's repo config. Detection runs in two stages, and each stage runs once per checkout:git config --show-origin --get-regexp '^core\.(autocrlf|eol)$'and reads the effectivecore.autocrlf(system, global, local or worktree; the last one wins). If that value isn'ttrue, Windows Git would not write CRLF and nothing is flagged. This is also how an explicit repo-localcore.autocrlf=falseorinputis honored.core.eolis deliberately ignored, because Windows Git ignores it when autocrlf is true. With a localcore.eol=lf, Windows Git reports 0 changes and the flagged WSL Git reports 0, while unflagged WSL Git reports 44.ls-files --eolacross the whole tree, keeps LF blobs that have no eol attribute, and stops after a deliberate cap of 200 lines.Reads and writes are flagged differently:
true. Flagged reads are never less correct, even on an LF checkout. That means the first status after launch doesn't flash every file as modified while the distro is still starting..git. A re-clone at the same path, or a stale answer, triggers a new sample before the write runs. An unknown answer runs the write unflagged, which is the old behaviour.Probing limits:
Scope: host-routed commands, Windows-authored linked worktrees, paths inside the distro, SSH, and non-Windows hosts are untouched. The bulk-pathspec chunker now assumes the flags may be added, so its command-line budget stays safe.
Why
Measurements
Measured on Windows 11 + WSL 2 (Ubuntu, Git 2.53) with Windows Git 2.55 and system
autocrlf=true. WSL runs usedGIT_OPTIONAL_LOCKS=0, which is how Orca polls.Speed and correctness on an 11,666-file clone on
C:autocrlf=trueonly (same as writing it into the repo config)checkStatcheckStat=minimal(this PR)trustctime=false(previous revision)Detection scenarios (each repo has 40 nested files plus root files; the probe's captured output is used as test fixtures)
autocrlf=falseautocrlf=falsecore.eol=lfon a CRLF cloneSame-size replacement that keeps the old mtime
This scenario was raised in review. One file is replaced with same-size content and its old mtime is kept, done three ways:
cp -p, rename-over withtouch -r, and a Windows rewrite that restores LastWriteTime. "Index author" is the Git that last wrote.git/index.cp -pcp -ptrustctimehas no effect undercheckStat=minimal: Git skips the ctime comparison entirely in that mode. It was dropped.checkStat, which costs about 72 s per poll whenever Windows Git last wrote the index.Alternatives considered
git statusgoes back to about 70 s after each Windows write.core.autocrlf=trueinto the repo config. It fixes correctness but not speed (70 s), and it writes to the user's repo.-cgated on evidence (this PR). It fixes Orca's Git and writes nothing. Both options predate the Git 2.25 baseline, and Git 2.25.1 supportsls-files --eolwith:(top,glob), so no capability probe is needed.Linked Issue
No existing issue found (searched CRLF / autocrlf / WSL modified / WSL slow status / WSL source control).
Visual Proof
N/A. Nothing in the UI changes, only which files Source Control lists and how fast. The numbers above come from a real Windows + WSL host.
Testing
Real host: every row above was measured on Windows 11 + WSL 2, with temp repos under a uniquely named temp directory that was removed afterwards.
The cold-distro first-status check was not run as a terminate-and-restart, because other WSL sessions were active on the shared host. It is covered by the 0.09 s host-only stage plus a unit test showing reads are flagged before the distro answers.
Unit tests:
wsl-windows-checkout-git-config.test.ts: classification against captured real-host samples for every scenario above, host config parsing, and the read/write/stale rules.wsl-windows-checkout-git-probe.test.ts: host-first ordering, a write waiting for a fresh sample, re-clone identity, a stale re-sample, the "not a git repository" check versus backoff on other fatal errors, clipped output, admission, single-flight, and abort.git-command-resolution-windows-checkout.test.ts: argv injection, host-routed commands left alone, and bulk chunks staying under the command-line cap.src/main/git+ source-control + providers + wsl suites: 390 files passed.Gates passing locally:
pnpm tc, oxlint, anti-slop, code-quality native / type-aware / changed, react-doctor changed, the max-lines / ts-nocheck / runtime-electron / focus-read / layout-writer ratchets, compat-boundary imports, process-host imports, and reliability gates.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
runWslProcess, and the host stage runs through process-host.\\wsl$\...\mnt\cpath isn't covered.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)