Skip to content

intake(lote-A): import upstream PR #1843#7

Open
nsalvacao wants to merge 8 commits intobaseline/develop-sync-2026-02-17from
intake/lote-A-pr-1843
Open

intake(lote-A): import upstream PR #1843#7
nsalvacao wants to merge 8 commits intobaseline/develop-sync-2026-02-17from
intake/lote-A-pr-1843

Conversation

@nsalvacao
Copy link
Owner

@nsalvacao nsalvacao commented Feb 17, 2026

Upstream intake PR for isolated review.

Checklist:

  • Automated checks green
  • Bot review comments triaged
  • Manual review complete
  • Safe for baseline merge

AndyMik90 and others added 8 commits February 15, 2026 17:35
…e cap, and cwd (AndyMik90#1661)

Three root causes addressed:

1. PATH overwrite: pythonEnv.PATH was overwriting the augmented PATH (with npm
   globals) in spawn env. Now merges PATH entries instead, prepending
   python-specific paths (pywin32_system32) while preserving all augmented entries.

2. System prompt size: On Windows, SDK passes system_prompt as --system-prompt
   CLI arg. Large CLAUDE.md files exceed CreateProcessW's 32,768 char limit,
   causing misleading "Claude Code not found" error. Now caps CLAUDE.md content
   on Windows to stay under the limit.

3. Cross-drive cwd: Agent processes were spawned with autoBuildSource as cwd.
   On Windows with cross-drive setups, this caused file access issues. Now uses
   projectPath as cwd since all script paths are absolute.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ik90#1661)

- Extract magic number 24000 into WINDOWS_MAX_SYSTEM_PROMPT_CHARS constant
  (set to 20000 for more conservative ~12KB CLI headroom)
- Extract truncation suffix into WINDOWS_TRUNCATION_MESSAGE constant
- Fix double-print when truncation occurs: only print "included in system
  prompt" when CLAUDE.md was NOT truncated (was_truncated flag)
- Fix CI test failures: update subprocess-spawn tests to expect projectPath
  as cwd instead of autoBuildSource (matches the AndyMik90#1661 CWD change)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Normalize env objects to a single uppercase 'PATH' key before merging
  to prevent duplicate PATH keys on Windows where process.env has 'Path'
  and getAugmentedEnv() writes 'PATH'. Without this, Object.keys().find()
  returns 'Path' first (insertion order), discarding augmented entries,
  and the final spread produces both 'Path' and 'PATH' keys.
  Follows the same pattern used in python-env-manager.ts. (AndyMik90#1661)

- Subtract WINDOWS_TRUNCATION_MESSAGE length from the truncation budget
  so the final system prompt stays within WINDOWS_MAX_SYSTEM_PROMPT_CHARS.

Addresses PR AndyMik90#1843 review findings NEW-001, NEW-002, NEW-003.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation budget

- Finding 1 (MEDIUM): Prefer 'PATH' key directly when present in env to avoid
  insertion-order bug where Object.keys().find() returned 'Path' first on Windows
- Finding 2 (MEDIUM): Normalization block (delete stale cased key, write 'PATH')
  already in place from previous commit; Finding 1 fix ensures envPathKey resolves
  correctly so normalization fires only when truly needed
- Finding 3 (LOW): Subtract header template overhead from max_claude_md_chars to
  prevent ~44-char overshoot in Windows command-line truncation budget (AndyMik90#1661)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When getAugmentedEnv() spreads process.env on Windows, the resulting object
contains both 'Path' (from process.env spread) and 'PATH' (explicitly written
by getAugmentedEnv). The prior normalization block only removed non-'PATH' keys
when 'PATH' was absent, leaving the stale 'Path' key when both coexisted.

Add a cleanup loop to delete all case-variant PATH keys that differ from
'PATH' after the main normalization, ensuring the child process inherits a
single canonical 'PATH' entry with the fully-augmented value. (AndyMik90#1661)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract normalizeEnvPathKey() and mergePythonEnvPath() into env-utils.ts
  as shared, exported helpers to eliminate duplicated PATH key case-normalization
  logic across agent-process.ts and python-env-manager.ts (Finding 3)
- Add PATH normalization call in agent-queue.ts spawnIdeationProcess and
  spawnRoadmapProcess to fix the same Windows PATH duplicate-key issue that
  was fixed in agent-process.ts (AndyMik90#1661) (Finding 1)
- Add comprehensive unit tests for normalizeEnvPathKey() and mergePythonEnvPath()
  covering Windows-style 'Path' key renaming, duplicate key removal, PATH
  deduplication across merge, and Unix separator support (Finding 2)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

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

Comments