Skip to content

fix(hub): inherit environment in PTY sessions - #147

Merged
antfu merged 1 commit into
devframes:mainfrom
dvcolomban:dvcol/fix-pty-environment
Jul 29, 2026
Merged

fix(hub): inherit environment in PTY sessions#147
antfu merged 1 commit into
devframes:mainfrom
dvcolomban:dvcol/fix-pty-environment

Conversation

@dvcolomban

Copy link
Copy Markdown
Contributor

Summary

  • inherit the parent process environment when spawning interactive PTY sessions
  • preserve PTY defaults and explicit caller overrides
  • add native PTY regression coverage for inherited environment variables

Root cause

startPtySession replaced the complete process environment with terminal-specific variables. Commands launched by name consequently lost PATH, causing the PTY child to exit without output and leaving consumers with a blank terminal.

Validation

  • pnpm lint
  • pnpm typecheck
  • pnpm run test -- --run (891 tests)
  • linked the package into ContentSquare/app-frontends and ran the @uxanalytics/vite-helpers suite (482 tests)

- Preserve PATH and parent environment variables when spawning PTYs
- Add native PTY regression coverage for inherited variables

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 28, 2026 17:22
@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit bf076dd
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a68e54861ac8800089a8b58
😎 Deploy Preview https://deploy-preview-147--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes interactive PTY terminal sessions in @devframes/hub by ensuring spawned PTY processes inherit the parent process environment (notably PATH), while keeping the terminal defaults and allowing explicit caller overrides.

Changes:

  • Update PTY spawn options to include ...process.env when constructing the PTY environment.
  • Preserve existing PTY defaults (TERM, COLORTERM, FORCE_COLOR) and keep executeOptions.env as the highest-precedence override.
  • Add a native PTY regression test verifying environment inheritance.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/hub/src/node/host-terminals.ts Ensures PTY sessions inherit the parent environment while preserving defaults and caller overrides.
packages/hub/src/node/tests/host-terminals.test.ts Adds a native PTY test to prevent regressions in environment inheritance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@antfu
antfu merged commit 64103f5 into devframes:main Jul 29, 2026
12 checks passed
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.

3 participants