Skip to content

fix(terminal): terminal fails to open with custom node - #1382

Open
Jem256 wants to merge 1 commit into
jamaljsr:masterfrom
Jem256:terminal-bug
Open

fix(terminal): terminal fails to open with custom node#1382
Jem256 wants to merge 1 commit into
jamaljsr:masterfrom
Jem256:terminal-bug

Conversation

@Jem256

@Jem256 Jem256 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Closes #1359

Description

When using a custom-built LND image in a Polar network, the terminal window opens for a fraction of a second and immediately closes. The cause is two hardcoded assumptions in DockerTerminal.tsx: the exec requires /bin/bash and a user named lnd to exist in the container. Polar's managed images satisfy both via their entrypoint scripts, but custom images don't. So the exec fails silently, and the window closes before anyone can see why.

This PR tries the expected user and shell first, then falls back to the image's default user and to /bin/sh if needed, printing a note in the terminal whenever it falls back. If every attempt fails, the window now stays open and shows the error instead of closing.

Steps to Test

  1. Build a custom LND Docker image
  2. Add the custom image to Polar via Managed Images > Add a Custom Node.
  3. Create a new network and add the custom LND node.
  4. Start the network.
  5. Click on the node and click the Terminal tab.

The terminal window should stay open, show a note that it's connected as the image's default user, and give you a working shell.

Screenshots

image

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown

Greptile Summary

Fixes terminal startup for custom node images by trying alternate users and shells.

  • Tries the configured user with bash and sh before retrying with the image's default user.
  • Inspects each exec attempt and reports accumulated startup errors in the terminal.
  • Keeps failed terminal sessions visible and adds localized fallback diagnostics.

Confidence Score: 3/5

The PR should not merge until CLI aliases remain usable when the terminal falls back to an image's default user.

The new fallback successfully opens a shell under a different home directory, but existing aliases still resolve node configuration and credentials through that user's home, leaving common node CLI commands broken on the path this change is intended to repair.

src/components/terminal/DockerTerminal.tsx

Important Files Changed

Filename Overview
src/components/terminal/DockerTerminal.tsx Adds user and shell fallback attempts with persistent diagnostics, but default-user sessions can make home-relative CLI aliases target the wrong configuration directory.
src/i18n/locales/en-US.json Adds localized messages for user fallback, shell fallback, and complete exec failure.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Open node terminal] --> B[Configured user + bash]
    B -->|fails| C[Configured user + sh]
    C -->|fails| D[Image default user + bash]
    D -->|fails| E[Image default user + sh]
    B -->|runs| F[Connect stream]
    C -->|runs| F
    D -->|runs| F
    E -->|runs| F
    E -->|fails| G[Display accumulated errors]
    F --> H[Install CLI aliases]
    H --> I[Interactive terminal]
Loading

Reviews (1): Last reviewed commit: "fix(terminal): fall back when a custom i..." | Re-trigger Greptile

Comment thread src/components/terminal/DockerTerminal.tsx
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ef4324b) to head (0b3fa21).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1382   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          211       211           
  Lines         7190      7190           
  Branches      1447      1447           
=========================================
  Hits          7190      7190           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Abdulkbk
Abdulkbk self-requested a review July 27, 2026 06:28
@Abdulkbk Abdulkbk added the bug Something isn't working label Jul 27, 2026

@Abdulkbk Abdulkbk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed and left a few feedback

Comment thread src/components/terminal/DockerTerminal.tsx
Comment thread src/components/terminal/DockerTerminal.tsx Outdated
Comment thread src/components/terminal/DockerTerminal.tsx Outdated
Comment thread src/components/terminal/DockerTerminal.tsx Outdated
Comment thread src/components/terminal/DockerTerminal.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: terminal fails to open with LND custom node

2 participants