#23775: fix(build): stabilize Windows script execution and Telegram monitor typing
channel: telegram
size: XS
Cluster:
Build and Fix Enhancements
## Summary
- Use workspace-root pnpm -w exec for key package scripts to avoid Windows recursive exec lookup failures.
- Fix AbortSignal narrowing in Telegram monitor webhook wait path to satisfy strict TypeScript checks.
- Keep behavior unchanged while unblocking pnpm build on Windows.
## Test plan
- [x] pnpm build no longer fails on missing sdown command due to recursive exec behavior.
- [x] TypeScript error in src/telegram/monitor.ts (opts.abortSignal possibly undefined) is resolved.
- [ ] Optional: run full CI checks.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds `pnpm -w exec` wrapper to key build/test/format commands in `package.json` to prevent Windows recursive executable lookup failures, and fixes TypeScript strict null check error in `src/telegram/monitor.ts` by storing `opts.abortSignal` in a local variable to enable proper type narrowing.
- Modified 16 scripts in `package.json` (build, format, lint, test) to use `pnpm -w exec` prefix for commands like `tsdown`, `oxfmt`, `oxlint`, `tsc`, and `vitest`
- Fixed TypeScript error in webhook wait path by extracting `opts.abortSignal` into a const `signal` variable, allowing TypeScript to narrow the type after the null check
- No behavioral changes - all functionality remains identical
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Both changes are low-risk bug fixes with no behavioral modifications. The `package.json` changes add explicit `pnpm -w exec` prefixes to ensure commands are found via pnpm's workspace resolution on Windows, avoiding recursive PATH lookups. The `monitor.ts` change is a standard TypeScript type narrowing fix that stores a possibly-undefined value in a const variable before accessing its properties, satisfying strict null checks. The existing test suite at line 398-415 covers the abort signal behavior and will verify correctness.
- No files require special attention
<sub>Last reviewed commit: b351219</sub>
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#3006: fix(scripts): use local pnpm binary in run-node.mjs if global is mi...
by elliotsecops · 2026-01-27
77.6%
#18493: making pnpm build:ui and pnpm build to work on windows
by darkpowerxo · 2026-02-16
77.5%
#9250: Fix: Add shell:true for Windows .cmd files to prevent spawn EINVAL ...
by vishaltandale00 · 2026-02-05
76.4%
#11951: Prepending Windows Node to PATH didn’t help
by tranhoangtu-it · 2026-02-08
75.7%
#22425: chore: make prepare git hooks setup cross-platform
by OldFineDev · 2026-02-21
75.4%
#12804: fix(daemon): use wrapper script for pnpm global installs in service...
by odinho · 2026-02-09
75.2%
#21215: Windows PowerShell reliability fixes (exec shim + Discord numeric p...
by musosoft · 2026-02-19
75.2%
#16480: fix(build): replace bash A2UI bundle script with cross-platform Typ...
by colddonkey · 2026-02-14
75.1%
#23772: fix(ci): unblock repo-wide check gate type regressions
by SmithLabsLLC · 2026-02-22
74.7%
#11470: fix: prevent gateway:watch race by passing --no-clean to tsdown
by apetresc · 2026-02-07
74.1%