Filter app runtime env vars from terminal spawn environment - #44
Conversation
- build terminal spawn env from a filtered copy of process env - exclude `PORT`, `T3CODE_*`, `VITE_*`, and Electron runtime vars - add test coverage to verify filtered and preserved env keys
WalkthroughImplements environment variable filtering for spawned terminal sessions. A blocklist of sensitive variables (PORT, ELECTRON_RENDERER_PORT, ELECTRON_RUN_AS_NODE) and framework-specific prefixes (T3CODE_, VITE_) are excluded from the shell environment. New helper functions sanitize the environment before terminal spawn, with comprehensive test coverage validating the filtering behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
Filter terminal spawn environment in
|
Greptile OverviewGreptile SummaryAdds environment variable filtering to terminal spawn operations to prevent app runtime configuration from interfering with shell sessions.
Confidence Score: 5/5
Important Files Changed
Flowchartflowchart TD
A[startSession called] --> B[createTerminalSpawnEnv called with process.env]
B --> C{For each env key/value}
C --> D{value === undefined?}
D -->|Yes| E[Skip]
D -->|No| F{shouldExcludeTerminalEnvKey}
F --> G{Starts with T3CODE_?}
G -->|Yes| E
G -->|No| H{Starts with VITE_?}
H -->|Yes| E
H -->|No| I{In TERMINAL_ENV_BLOCKLIST?}
I -->|Yes - PORT, ELECTRON_RENDERER_PORT, ELECTRON_RUN_AS_NODE| E
I -->|No| J[Include in spawnEnv]
E --> K{More keys?}
J --> K
K -->|Yes| C
K -->|No| L[Return filtered spawnEnv]
L --> M[ptyAdapter.spawn with filtered env]
Last reviewed commit: ecea657 |
…ker gating Port upstream commits 9bb9023..b36888e: - Handle branch selection across main and secondary worktrees (pingdotgg#44) - Preserve fork PR upstreams when preparing local and worktree threads (pingdotgg#45) Adds resolveBranchSelectionTarget for unified checkout cwd/worktree decisions, GitCore helpers for remote management (ensureRemote, fetchRemoteBranch, setBranchUpstream), GitHub CLI cross-repo PR metadata parsing, and GitManager fork head materialization with upstream tracking.
* Revert "feat: add a split-screen-horizontally toggle for the right panel (pingdotgg#41)" This reverts commit 0ea9e96. The ask was to remove a horizontal split, not to add one, so the toggle should not have shipped. Every file pingdotgg#41 touched is back to its pre-pingdotgg#41 content and its three new files are gone: rightPanelOrientation.ts, useResizablePanelHeight.ts and its test. `git diff fd3b851 -- apps packages` is empty. The fork delta here is nil again, so the Split Screen Delta section, its inventory row, its path policy rows and its convergence row go with it. Kept from pingdotgg#41, because they stand on their own and are not about the toggle: the upstream-remote ownership check in Path policy, the .plans/** row split it turned up, the messageOrigin.ts verification, and AGENTS.md's rule that fork code says so in a comment where it sits. Verification: web typecheck and lint clean, vp fmt --check clean, 83 tests across apps/web/src/hooks and apps/web/src/components/preview. Model: Claude Opus 5. Harness: Claude Code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(web): drop the terminal-drawer toggle from the chat header The chat's panel layout controls carry two buttons: one opens the right panel, the other splits the screen horizontally by opening a terminal across the bottom. The fork keeps one way to reach a terminal — the right panel's terminal surface — so the second button is a split nobody asked for beside a panel that already does the job. Hides it the fork way rather than deleting upstream's code: a new `terminalDrawerToggle` flag in `apps/web/src/fork/features.ts` and one gate expression in `PanelLayoutControls.tsx`. Upstream's props, the drawer and the `terminal.toggle` keybinding are untouched, so the drawer still opens from the keyboard and deleting the flag brings the button back. Model: Claude Opus 5. Harness: Claude Code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(fork): the log keeps what is known, not what was undone The 2026-08-03 entry led with a toggle that was added and then reverted in the same day. Nothing in the tree carries it, so a future merge learns nothing from reading about it. What that day actually produced is the upstream-remote ownership check and what it found, which is what the entry says now. Model: Claude Opus 5. Harness: Claude Code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Summary
PORT,ELECTRON_RENDERER_PORT,ELECTRON_RUN_AS_NODE, and any keys prefixed withT3CODE_orVITE_.Testing
apps/server/src/terminalManager.test.ts(filters app runtime env variables from terminal sessions) to verify:PORT,T3CODE_PORT, andVITE_DEV_SERVER_URLare excluded from terminal spawn env.TEST_TERMINAL_KEEPis preserved.Summary by CodeRabbit
Release Notes