Skip to content

fix(windows): preserve nested node_modules during upgrade to avoid lo…#11

Merged
duguwanglong merged 1 commit into
mainfrom
fix_windows_update
Mar 31, 2026
Merged

fix(windows): preserve nested node_modules during upgrade to avoid lo…#11
duguwanglong merged 1 commit into
mainfrom
fix_windows_update

Conversation

@duguwanglong

Copy link
Copy Markdown
Contributor

On Windows, shutil.rmtree(webui) fails with [WinError 5] because esbuild.exe inside webui/node_modules/ is locked by a running process. The _PRESERVE_NAMES check only applied at the top level of install_root, so webui/node_modules was not protected.

  • Make _replace_install_dir recursively merge directories that contain preserved entries (e.g. node_modules) instead of rmtree + copytree
  • Add _safe_rmtree with an onerror handler on Windows that retries after clearing read-only flags, and skips truly locked files gracefully

…cked-file errors

On Windows, `shutil.rmtree(webui)` fails with [WinError 5] because
`esbuild.exe` inside `webui/node_modules/` is locked by a running
process. The `_PRESERVE_NAMES` check only applied at the top level of
install_root, so `webui/node_modules` was not protected.

- Make `_replace_install_dir` recursively merge directories that contain
  preserved entries (e.g. `node_modules`) instead of rmtree + copytree
- Add `_safe_rmtree` with an `onerror` handler on Windows that retries
  after clearing read-only flags, and skips truly locked files gracefully

Made-with: Cursor
@duguwanglong duguwanglong requested a review from xiami762 March 31, 2026 03:18
@duguwanglong duguwanglong merged commit 79f7066 into main Mar 31, 2026
2 checks passed
@duguwanglong duguwanglong deleted the fix_windows_update branch March 31, 2026 03:20
duguwanglong added a commit that referenced this pull request Jun 8, 2026
Tests (issue #5)
- Update all FakeProvider mocks from chat() to chat_stream() async
  generators; all 4 tests now pass (were 3/4 failing)

_strip_think_blocks (issue #6)
- Apply as a safety net on visible_content so think-tagged text
  that leaks through text deltas is stripped before the final result
- Use visible_content (stripped) for final_content too

System prompt alignment (issue #3)
- memory_delegate: build tools before constructing the system prompt
- Call SessionPrompt.build_system_prompts() with a synthetic session_id
  so the sub-agent gets PROMPT_DEFAULT (SecOps identity + guardrails),
  tool_protocol, and agent_identity — identical foundation to main loop

Parallel TOCTOU guard (issue #4)
- delegate_task is now serial against any non-delegation tool: prevents
  TOCTOU races where a sub-agent writes files while the parent loop
  concurrently reads (glob/grep); multiple delegations can still run
  concurrently against each other

gateway.chat_stream tool_calls robustness (issue #11)
- Emit any accumulated tool_calls after the stream loop ends, so they
  are not silently dropped when a gateway omits finish_reason on the
  final tool-call chunk

loop_engine fallback warning (issue #12)
- _resolve_loop_engine() now logs a warning when the requested engine
  id (session-level or agent-default) is not registered, making
  silent "UI shows Raptor, runs native" situations observable in logs

loop_engine persistence deduplication (issue #13)
- Extract repeated loop_engine persistence blocks into
  _persist_loop_engine_if_changed(); both message routes call it

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants