fix(shell-env): strip prompt noise and normalize CLAUDE_CONFIG_DIR#1676
fix(shell-env): strip prompt noise and normalize CLAUDE_CONFIG_DIR#1676arnestrickmann merged 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdated shell environment handling: marker-wrapped and ANSI-cleaned extraction of shell variables, new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Harden shell-sourced environment detection: isolate
printenvoutput with explicit markers, strip ANSI/OSC noise (e.g. iTerm prompt sequences), and normalizeCLAUDE_CONFIG_DIRso only sensible absolute paths are used—including~/expansion and dropping relative values.Changes
getShellEnvVar: Wraps values with__EMDASH_SHELL_VALUE_START__/__EMDASH_SHELL_VALUE_END__, runsstripAnsi(OSC/bell/other escapes), then extracts the substring between markers so prompt noise cannot corruptSSH_AUTH_SOCK,CLAUDE_CONFIG_DIR, etc.normalizeClaudeConfigDir: Trims input, expands~and~/…viaos.homedir(), rejects non-absolute paths, normalizes withpath.normalize.initializeShellEnvironment: Applies normalization to existing and shell-detectedCLAUDE_CONFIG_DIR; clears invalid/relative values instead of forwarding them.ptyManager: When passingCLAUDE_CONFIG_DIRthrough the agent env allowlist for direct spawn and SSH PTYs, uses the same normalization.Tests
CLAUDE_CONFIG_DIR, and expanding~/.…from the shell.Summary by CodeRabbit
Bug Fixes
Tests