Repository navigation
fix(scripts): hide the console window for team scripts on Windows - #1845
Conversation
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
The change is right. Both spawnScript helpers (src/post-pull.ts and src/team-scripts.ts) now pass windowsHide: true and leave stdio alone, so a prompted script still gets the caller's terminal. The new assertions cover the prompted, interactive and in-process shapes.
[P1 blocking] No real-CLI record. This changes runtime behaviour, and the description has only unit tests. The repo asks for one representative real-CLI run of the changed behaviour in a verify world (npm run verify:world; npm run -s verify -- help). Ideally that's on Windows: a pull started the way #1805 describes, from post-merge or session start, with a postPull script that sleeps a few seconds, and no console window opening. If you have no Windows machine, a run on macOS or Linux still covers the other half of the claim, and you should say Windows wasn't run. The run would show:
teamai pullfrom a terminal with a promptedpostPullscript that reads input and prints, behaving exactly as before;- a hook-started pull running the script.
[P3 nit] The two comments mostly restate the fix. If you keep one, it only needs the Windows quirk, for example "Windows opens a console for a child of a process without one."
No other confident findings in the specified diff. No earlier findings were supplied. |
No other confident findings in the specified diff. |
|
Real-CLI record added to the description, and the P3 nit is applied in 65805f8.
One thing the record corrected for me: the interactive shape spawns with Ledger: |
prePull, postPull, postInit and postDeploy are started through one of two spawnScript helpers, and neither passed windowsHide. A pull started by a git hook has no terminal, so Windows created a console window for each script and kept it open for the whole run (Tencent#1805). Both helpers now set windowsHide: true. The child still inherits whatever stdio the caller passed, so a prompted run shows its output where it did before; only the extra window goes. Tests assert the option on both shapes (prompted and in-process); each fails with the option removed. Refs Tencent#1805
Review nit: the two comments restated the fix. One line each now says only what a reader cannot derive from `windowsHide: true` (Tencent#1805).
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Thanks, that covers it. The record shows:
- a terminal-driven pull: the script is launched with the terminal attached and its output reaches it;
- a hook-shaped pull (
TEAMAI_GIT_HOOK=post-merge,--silent): the script is awaited and exits 0 within the budget.
The verify world ends CLEAN, and you say plainly that the Windows window itself wasn't observed. The comment is down to the Windows quirk. Approving at 65805f8e.
65805f8 to
f1d0141
Compare
|
No confident findings in the specified diff. The earlier [P1 blocking] missing real-CLI verification record finding is resolved: the current PR description records representative terminal-driven and hook-shaped pulls in a verify world, with a clean ledger. The Windows console behavior remains explicitly unverified, but that disclosed platform limitation does not block merge under the review rules. No PR code was run, built, or installed. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Re-approving at f1d0141a. It is the same change rebased onto main.
Summary
prePull,postPull,postInitandpostDeployall run through one of twospawnScripthelpers, and neither passedwindowsHide. When the pull is started by a git hook (post-merge→git-pull, orsession start) there is no terminal, so Windows opens a console window for every team script and keeps it open for the script's whole runtime — the 4–13 s empty window reported in #1805.Both helpers now set
windowsHide: true. Nothing about stdio changes: a prompted script still inherits the caller's stdio, so a member who launchedteamai pullfrom a terminal sees exactly what they saw before; only the extra window is gone.Type of Change
Real-CLI record
Build:
Build 65805f8e66ff, teamai 0.22.0, sha256 beba71b8159d(verify world20261112T083814-e18d6b, macOS arm64, Node v24.13.0).The team repo declares
scripts.postPull.path: scripts/postpull.mjs; the script prints one line to stdout and writes a marker file.Verdicts, named with the entry point:
teamai pull, terminal-driven: the script is launched withstdio: inheritand prints on the terminal, as before.TEAMAI_GIT_HOOK=post-merge,--silent, which is howhook-handlers.tsstarts a pull): the script is awaited and exits 0 inside the existing budget.One correction to expectations: the interactive shape spawns with
['ignore', 'inherit', 'inherit'], so apostPullscript does not receive stdin at all —stdin=""above is that design, unchanged by this PR. The script still prints to the terminal, which is what "behaves as before" means here.The ledger needed one cleanup of mine: a self-mode init attempt had left a manual
originremote in the world's project, which showed up as 2project/.git/configleaks. Removed, re-ran the ledger:CLEAN(the remainingknown:lines are #1808, not new).Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest run src/__tests__/team-scripts.test.ts src/__tests__/post-pull.test.ts(20 tests)The three new assertions (prompted script, interactive
postPull, in-processpostPull) fail when the option is removed — deletingwindowsHide: truefrom both helpers made 3 tests fail; restored, they pass.Related Issues
Fixes #1805
Notes for Reviewers
teamai/windows-hideas an error, and its diff does not touch these two helpers; this change is what keeps that rule green once both land.stdio: inherit, so hiding the window does not take the terminal away from a prompted script — the child reads and writes the handles it already had. It only stops a hook-launched pull from creating a console.Unreleased→🐛 Bug Fixes.Disclosure
This PR was written with AI assistance: DeepSeek Harness (deepseek-v4.1-flash) drafted the change, the tests and this description.
I am wangchongfei. I reviewed every line of this diff and ran the checks above myself before opening it. I take full responsibility for the change.
I am stating this here, and on my profile, because a maintainer should know who — and what — they are reviewing.