Commit Graph
5 Commits
Author SHA1 Message Date
Willie 539f1d0f03 fix(pi): recover Windows stale locks and protect private registrations (#361)
* test(pi): reproduce Windows private registration access failures

Use NTFS DACL assertions instead of POSIX mode bits and verify that broadly accessible existing records cannot be read or silently reused. Keep the Unix mode assertion unchanged.

* fix(pi): reclaim Windows locks and protect private registration state

Anchor stale directories with delete sharing and delete the verified empty Windows directory by handle, keeping inode, lease and racing-owner guards. Create new registration directories with protected owner/SYSTEM DACLs and validate existing owner/access rules without changing their ACLs. Leave Unix permissions and directory-only removal unchanged.

* test(pi): capture Windows lock identity before path replacement

Windows Lstat lazily fetches file IDs by pathname. Snapshot the stale fixture through its anchored handle and add a matching-mtime replacement regression before first verification or release.

* fix(pi): snapshot Windows lock IDs and accept privileged default owners

Capture acquired lock identity through a handle before Windows can lazily resolve a replaced pathname. Elevated tokens can default file ownership to Administrators; permit privileged owners only alongside a verified current-user-only DACL. Refuse unsafe existing registration directories without modifying their ACLs or writing records.

* docs(pi): record Windows acceptance and isolated regression workflow

Document private Windows ACL requirements and refusal without permission rewrites. Add pinned devcontainer kit packaging, token-isolated full/basic acceptance, preserved UTF-8 logs and a reproducible UTM runbook. Preserve the original Unix permission assertion.

* test(backup): isolate explicit agent backup from sync snapshots

Sync automatically backs up target-local agents. Creating the fixture before sync makes the exact-one-backup assertion depend on both commands sharing a timestamp second. Create it after successful sync so the explicit backup is the only operation that snapshots it, without weakening the assertion.
2026-10-03 23:19:34 +08:00
Willie 7043ca3ad2 fix(windows): stop foreground children when skillshare is terminated (#343)
Windows does not stop the processes a terminated process started, so killing
skillshare mid-pull left git, its ssh command and hooks running. This covers
plain runs and the hidden-console relaunch from #341.

skillshare now puts itself in a kill-on-close job at startup. Processes that
must outlive it (the `ui start` server, the restart helper, browser, file
manager, editor) start through childproc.StartDetached, which allows breakaway
only for that one start. The job otherwise forbids breakaway, because the MSYS
runtime behind Git for Windows' sh.exe breaks every child away from a job that
allows it. The relaunched copy shares the job and ends it if the launcher is
terminated.

Inside a job that forbids breakaway (Task Scheduler) skillshare does not bind
its children, since detached processes could not leave; the task's own job
stops them when the task ends. The e2e script gains -Cancel/-SkipWindows
checks, and the runbook records the expected results for both contexts.
2026-10-03 01:25:44 +08:00
Willie 84bbd40785 fix(windows): run in a hidden console when started without one (#341)
* chore(scripts): install UI deps from the store in utm.sh build

pnpm 12 refuses a symlinked node_modules ("workspace hoist directory is
not a real directory"), so the pinned UTM build stopped at the UI step.
An offline, frozen install from the shared store keeps the build pinned
to the archived lockfile and takes a few seconds.

* fix(windows): run in a hidden console when started without one

Started without a console (a scheduled task wrapper, pythonw), every
console program skillshare spawns gets its own console, so a single
`pull` flashed about ten Windows Terminal windows. skillshare now reruns
itself once with CREATE_NO_WINDOW in that case; all children inherit the
windowless console. Doing it at the entry point covers the 130+ exec
sites instead of patching each one. Runs with a console never relaunch,
and stdio and the exit code pass through.

The UTM runbook and probe script record descendants and new windows for
each console state, so the behavior can be rechecked on a real guest.

Closes #339

* chore(scripts): ask pnpm for the UI store and derive the guest profile

utm.sh build hard-coded /workspace/.pnpm-store, which only matches
pnpm's per-filesystem default by coincidence; it now asks pnpm which
store the workspace UI uses. The console e2e script checked a fixed
user's AppData, so another GUEST_USER could pass while its own profile
changed; it now records the real APPDATA before isolating.

* docs(tests): make the console runbook build step runnable as written

The push step read $OUT, which only exists inside utm.sh, so a fresh
shell pushed /ss.exe; the example also hard-coded arm64 next to a note
about x64 guests. Export utm.sh's default OUT and take the arch from the
probe instead.

* fix(windows): stop the relaunched run when its launcher is killed

A caller that terminates the PID it started (a wrapper timing out) only
killed the waiting wrapper; the relaunched skillshare kept running and
could keep mutating state. The relaunched process now sits in a
kill-on-close job. Its own children break away silently, so git, the
background UI server, browsers and editors behave as they did without
the relaunch. A wait failure after a successful start now exits 1
instead of running the command a second time in the wrapper.

The console e2e script gains a cancel check and a `ui start` survival
check; on the UTM guest the baseline left the inner process serving
after the kill, the fix stops it, and the background server still
outlives its launcher.
2026-10-03 00:14:28 +08:00
Willie 8063a6f424 chore(windows): add UTM verification helper and skill
Windows acceptance on the local UTM guest was a pile of one-off
commands: finding utmctl, polling async exec, running as the desktop
user with a basic token, pinning builds, and pre-seeding the UI cache.
utm.sh wraps those steps, manual-setup.ps1 gives a one-line hands-on
setup in an isolated home, and the skill records the workflow and the
pitfalls hit along the way (S4U tokens, ARM64 emulation, zsh echo).

Refs #299
2026-09-28 16:05:16 +08:00
Willie c7eb59a78f fix(sync): stop linking single files with junctions on Windows
createLink always tried `mklink /J` first. mklink does not check the
source type, so agents, single-file extras such as a shared AGENTS.md, and
per-file extras links became directory junctions that point at a file:
Explorer shows a folder and tools cannot read it. Sync then compared only
the link destination and kept the broken junction forever.

Files now get real symlinks only. When the OS cannot create them (Windows
without Developer Mode, non-elevated), file-based link modes fall back to
copies at the mode level, so status, doctor, the API and later syncs all
see an effective `copy` mode. Fallback copies are tracked by hash so they
keep updating and pruning without touching the user's own files, and turn
back into links once links work. Single-file extras remember what they last
wrote, so an unedited copy is replaced silently instead of producing a
drift backup on every source edit, and switching a target back to import
restores the user's attach-time content plus the import block.

Includes a Windows runbook and script, verified on a Windows 11 ARM64 VM
with and without symlink rights.

Refs #299
2026-09-28 13:54:52 +08:00