Repository navigation
gbrain-refresh no longer deletes a healthy brain-aware render when python3 is the Windows Store alias (#1967) - #4752
Conversation
… Windows Store alias gstack-config gbrain-refresh took the first python3 or python on PATH without checking that it runs. On Windows python3 is often the Microsoft Store alias, which exits 49, so every parse read as unknown, the grep fallback stayed unreachable, and the not detected branch removed the brain-aware render, including in the refresh gstack-session-update runs after each pull. The parse now uses the first of python3 and python whose two reads succeed, then grep. Both greps end with || true: under set -euo pipefail a field missing from the detection file, such as the version in the no-cli record, ended the run with exit 1 and no output.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thanks for this, and for the four failing-first tests and the Windows run. The bug is real and worth fixing: We're picking it up. Because |
|
Thanks for the careful root cause and the failing tests. Because this runs on every update, we've rebuilt the fix on current main in #4793, with your commit credited as co-author and your tests adapted. It also keeps the existing render whenever gbrain's state can't be read at all. The owner thread is GSTA-842; we'll post here when it lands. |
… and long test commands fail clearly (#4793) On Windows, an update no longer deletes your brain-aware skills when `python3` is the Microsoft Store alias, and a pre-ship test command too long for Git Bash is split to fit or refused clearly instead of running cut off. Why: keeps install and upgrade working on Windows, where gstack promises minimal support (#4752 by @Barack-zero-to-one, #4773 by @targetpark). Nothing to do. Co-authored-by: Barack-zero-to-one <121355791+Barack-zero-to-one@users.noreply.github.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: bin/gstack-config:1335:completeness reader=core Review-Finding: lib/pregate/checks/lanes.ts:457:completeness reader=core Review-Finding: lib/pregate/checks/lanes.ts:442:completeness reader=core Review-Finding: lib/pregate/checks/lanes.ts:456:completeness reader=core
gstack-config gbrain-refreshnow reads the gbrain detection file with the first ofpython3andpythonthat runs, then grep, so a healthy gbrain is no longer reported as not detected and its brain-aware render is no longer deleted.Why: on Windows
python3is often the Microsoft Store alias, which exits 49 and stays on PATH next to a python.org install, including during the refresh run after each auto-update.Nothing to do; where
python3works, nothing changes.Root cause
In
bin/gstack-config,gbrain-refreshchose its interpreter withcommand -v python3 || command -v pythonand never checked that it runs. The Store alias prints its hint on stderr and exits 49, so both parses fell to|| echo unknown, and the grep fallback stayed unreachable becausePYTHON_CMDwas set. The*)branch then printed "gbrain not detected (local-status: unknown)" and, with a global install present, removed$RENDER_DIRthroughgstack_claude_render_action "$RENDER_DIR" absent, althoughgbrain-detection.jsonsaidok.bin/gstack-session-updateruns this refresh silently after every pull, so a Windows team-mode install loses its brain-aware skills on each update. #3025 fixed the MSYS path half of #1967 by passing the file on stdin. The reporter of #1967 also hadpython3underWindowsApps, and this cause survives that fix.Fix
The parse now tries
python3, thenpython, keeps a result only when both reads exit 0, and otherwise uses the existing grep fallback. Before this change that fallback ran only on a machine with no Python at all, and underset -euo pipefaila field grep could not find ended the run with exit 1 and no output. Theno-clirecord written when detection fails has nogbrain_version, so that case is common once the fallback is reachable; both greps now end with|| true. Production change: 29 lines inbin/gstack-config.Tests
test/gstack-config-gbrain-refresh.test.tsgains a stub that behaves like the Store alias (hint on stderr, exit 49) and four cases. With the alias under both names, the grep fallback reportsDetected gbrain v0.35.8.0 (local-status: ok).With the alias only aspython3,pythonparses the file, and the stub records that it ran twice before grep. With a fake global install and an existing render, a failed render step leaves the render file intact instead of printing "Removed the brain-aware render". A failed detection is reported aslocal-status: no-cliwith exit 0. All four fail on main; the existing two cases still pass unchanged.Run on Windows 11 with Git Bash and bun 1.4.5: the file passes 6 of 6, and
test/gbrain-refresh-install-render.test.tsandtest/plan-mode-preamble-render.test.tspass.test/claude-overlay-setup-lifecycle.test.tsandtest/claude-overlay-setup-recovery.test.tsskip on win32, so these integration tests rely on the Linuxfree-tests.ymlrun of this PR.Reproduction
On a Windows machine where
command -v python3prints.../Microsoft/WindowsApps/python3, copybin/to a temp root, stubgstack-gbrain-detectto print{"gbrain_on_path":true,"gbrain_version":"0.9.1","gbrain_local_status":"ok"}, create$HOME/.claude/skills/gstackwithVERSIONandpackage.jsonand a file under$GSTACK_STATE_ROOT/render/claude, then rungstack-config gbrain-refresh. main prints "gbrain not detected (local-status: unknown)" and deletes the render. This branch prints "Detected gbrain v0.9.1 (local-status: ok)" and keeps it.