Skip to content

fix(desktop): restore SUPERSET_ROOT_PATH and related env vars to terminal - #311

Merged
saddlepaddle merged 1 commit into
mainfrom
fix/restore-terminal-env-vars
Dec 10, 2025
Merged

saddlepaddle merged 1 commit into
mainfrom
fix/restore-terminal-env-vars

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Dec 10, 2025 •

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • Open a terminal in a workspace
  • Run env | grep SUPERSET and verify all env vars are present

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Terminals now expose workspace context through environment variables (SUPERSET_WORKSPACE_NAME, SUPERSET_WORKSPACE_PATH, SUPERSET_ROOT_PATH), providing workspace and project information for terminal commands and scripts.

✏️ Tip: You can customize this high-level summary in your review settings.

…inal

Re-add environment variables that were accidentally removed in #303:
- SUPERSET_WORKSPACE_NAME: The workspace name
- SUPERSET_WORKSPACE_PATH: The worktree path
- SUPERSET_ROOT_PATH: The main repo path

These are needed by setup/teardown scripts that run in terminal sessions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 10, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
website Ready Ready Preview Comment Dec 10, 2025 8:20pm

@coderabbitai

coderabbitai Bot commented Dec 10, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR extends the terminal creation flow to propagate workspace metadata through the system. The terminal router now resolves workspace and project information, passing workspace name, workspace path, and root path as additional parameters to the TerminalManager, which forwards these values into terminal session environment configuration.

Changes

Cohort / File(s) Summary
Terminal Router Enhancement
apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
Updated to resolve workspace and project objects; passes workspaceName, workspacePath, and rootPath parameters to terminalManager.createOrAttach() call. Documentation extended to include new environment variables.
Terminal Manager API Extension
apps/desktop/src/main/lib/terminal-manager.ts
Method signatures for createOrAttach() and private doCreateSession() extended to accept optional workspaceName, workspacePath, and rootPath parameters; these are propagated into terminal session environment as SUPERSET_WORKSPACE_NAME, SUPERSET_WORKSPACE_PATH, and SUPERSET_ROOT_PATH.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward parameter propagation pattern across two files
  • No complex logic or conditional branching introduced
  • Consistent parameter passing through call stack
  • Extension of existing method signatures with optional fields

Possibly related PRs

  • xterm ui #115: Introduces the terminal router and initial terminal creation UI; this PR extends that flow to propagate workspace metadata through the terminal management pipeline.

Poem

🐰 A workspace hops through terminal lanes,
Its name and path now freely flowing,
The root grows roots in verdant plains,
Environment variables brightly glowing!
With metadata seeds, the sessions bloom—
Sweet parametric mushroom room!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the summary, test plan, and context, but is missing required template sections like Related Issues, Type of Change, and Additional Notes. Add missing template sections: explicitly link PR #303, mark 'Bug fix' checkbox, provide formal testing steps, and add any additional context.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: restoring three environment variables to terminal sessions, directly matching the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/restore-terminal-env-vars

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3870a61 and a596f98.

📒 Files selected for processing (2)
  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts (2 hunks)
  • apps/desktop/src/main/lib/terminal-manager.ts (6 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
apps/desktop/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc

Files:

  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
  • apps/desktop/src/main/lib/terminal-manager.ts
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: Please use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary

Files:

  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
  • apps/desktop/src/main/lib/terminal-manager.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Maintain type safety and avoid using any unless absolutely necessary in TypeScript code

Files:

  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
  • apps/desktop/src/main/lib/terminal-manager.ts
apps/desktop/src/lib/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules like node:fs, node:path, node:os in src/lib/electron-router-dom.ts or similar shared code

Files:

  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
apps/desktop/src/main/lib/terminal-*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use node-pty for terminal session management in the desktop app

Files:

  • apps/desktop/src/main/lib/terminal-manager.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:32:32.232Z
Learning: Applies to apps/desktop/src/main/lib/*{workspace,worktree}-*.ts : Use git worktree-based workspace management in the desktop app through workspace-manager.ts and worktree-manager.ts
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:32:32.232Z
Learning: Applies to apps/desktop/src/main/lib/terminal-*.ts : Use node-pty for terminal session management in the desktop app
📚 Learning: 2025-12-08T23:32:32.232Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:32:32.232Z
Learning: Applies to apps/desktop/src/main/lib/terminal-*.ts : Use node-pty for terminal session management in the desktop app

Applied to files:

  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
  • apps/desktop/src/main/lib/terminal-manager.ts
📚 Learning: 2025-12-08T23:32:32.232Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:32:32.232Z
Learning: Applies to apps/desktop/src/main/lib/*{workspace,worktree}-*.ts : Use git worktree-based workspace management in the desktop app through workspace-manager.ts and worktree-manager.ts

Applied to files:

  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
  • apps/desktop/src/main/lib/terminal-manager.ts
🧬 Code graph analysis (1)
apps/desktop/src/lib/trpc/routers/terminal/terminal.ts (2)
apps/desktop/src/main/lib/db/index.ts (1)
  • db (18-25)
apps/desktop/src/main/lib/terminal-manager.ts (1)
  • terminalManager (646-646)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (7)
apps/desktop/src/lib/trpc/routers/terminal/terminal.ts (3)

18-20: LGTM: Documentation clearly describes the restored environment variables.

The documentation accurately describes the three environment variables being restored and their intended use case for setup/teardown scripts.


64-66: LGTM: Parameters correctly passed to terminal manager.

The three new parameters are properly passed to terminalManager.createOrAttach, using optional chaining to safely handle cases where workspace or project don't exist. The naming is consistent with the environment variable names documented above.


55-58: Code is correct: Project lookup safely accesses mainRepoPath.

The mainRepoPath field exists on the Project interface as a string, and the code properly uses optional chaining (project?.mainRepoPath) to safely access it when a workspace exists. The lookup pattern is sound and consistent with the rest of the codebase.

apps/desktop/src/main/lib/terminal-manager.ts (4)

54-56: LGTM: Optional parameters properly typed.

The three new parameters are correctly defined as optional strings, maintaining type safety throughout the call chain.


66-77: LGTM: Parameter destructuring correctly updated.

The destructuring statement properly extracts all parameters including the three new workspace-related fields.


103-105: LGTM: Parameters correctly forwarded to doCreateSession.

The three new parameters are properly forwarded to the internal session creation method, maintaining the flow from the router to the PTY environment.


125-127: Environment variables properly configured with safe defaults.

The implementation correctly:

  • Adds optional parameters to the internal session creation method with proper TypeScript typing
  • Destructures them for use within the method scope
  • Sets environment variables with sensible defaults (empty string for undefined values)
  • Uses consistent naming convention (SUPERSET_WORKSPACE_NAME, SUPERSET_WORKSPACE_PATH, SUPERSET_ROOT_PATH)
  • Maintains type safety without using any

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Dec 10, 2025 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@saddlepaddle
saddlepaddle merged commit 094dde1 into main Dec 10, 2025
8 checks passed
@Kitenite
Kitenite deleted the fix/restore-terminal-env-vars branch December 11, 2025 03:06
AviPeltz added a commit that referenced this pull request Oct 1, 2026
Closes Dependabot alerts #311, #312, #313, #314 (hono/jsx renders plain
strings unescaped in boundary components, XSS). hono resolves through the
root override and sherif requires one version across workspaces, so the
override and all four workspace manifests move together.

Co-authored-by: Claude <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — a596f98f Deployed Dec 10, 2025 by vercel[bot]
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.

1 participant