← Back to PRs

#5950: Improvement/windows shell enhancement

by zzjj7000 open 2026-02-01 04:25 View on GitHub →
agents
Summary Improves PowerShell execution reliability on Windows environments. Changes - ExecutionPolicy Bypass: Adds `-ExecutionPolicy Bypass` to the PowerShell arguments in `shell-utils.ts`. - Reason: This ensures that local scripts (including npm/pnpm spawns or user scripts) run smoothly even on Windows systems with restrictive default execution policies, preventing common `PSSecurityException` errors during tool execution. - Safety: Retains the existing `resolvePowerShellPath()` logic to ensure the correct executable is used. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR’s stated goal is to improve PowerShell execution reliability on Windows by adding `-ExecutionPolicy Bypass` in `src/agents/shell-utils.ts`. However, the changeset also introduces several new behavioral features unrelated to shell execution: - A SmartRouter system that dynamically selects models and writes daily usage stats (`src/agents/smart-router.ts`, `src/agents/model-experience.ts`, plus integration in `src/agents/pi-embedded-runner/run.ts`). - New “smart rate limit” retry behavior that waits before failing over (`src/agents/pi-embedded-runner/run.ts`). - A new context-optimizer that calls Gemini’s cachedContents REST API and injects `cachedContent` into model calls (`src/features/context-optimizer/index.ts`, hooked in `src/agents/pi-embedded-runner/run/attempt.ts`). - Repo/workflow changes like adding `package-lock.json` and altering `.gitattributes`. Main issues are around unexpected behavior changes (automatic model switching), retry/compaction flag coupling, and new network+cache behavior without explicit feature gating. There are also a few Windows/dev-experience concerns (hard-coded paths in .bat scripts, pnpm→npx build change). <h3>Confidence Score: 2/5</h3> - This PR is not safe to merge as-is due to multiple unrelated behavioral changes and new ungated runtime side effects. - While the PowerShell `-ExecutionPolicy Bypass` change is reasonable, the PR also adds automatic model routing, rate-limit wait logic, and a Gemini context caching feature that performs additional network requests and global caching. These changes can affect correctness, security/compliance expectations, and operational behavior, and they are not clearly gated or scoped to the PR’s stated purpose. - src/agents/pi-embedded-runner/run.ts, src/agents/pi-embedded-runner/run/attempt.ts, src/features/context-optimizer/index.ts, src/agents/smart-router.ts, scripts/run-node.mjs, run_openclaw.bat, .gitattributes, package-lock.json <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs