Skip to content

Conversation

@scaryrawr
Copy link
Owner

Based on fish version

@scaryrawr scaryrawr requested a review from Copilot October 23, 2025 00:08
Copy link

Copilot AI left a comment

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 adds SSH ControlMaster multiplexing support to improve port forwarding performance by reusing SSH connections instead of creating new ones for each port forward. The main changes enable connection sharing and background reverse port forwarding.

Key Changes:

  • Implements SSH ControlMaster for connection multiplexing
  • Runs reverse port forwarding in background with dedicated logging
  • Adds GitHub Copilot token injection from local configuration

Reviewed Changes

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

File Description
devpod-gh.plugin.zsh Adds SSH multiplexing, background reverse forwarding with cleanup, and Copilot token support
README.md Documents SSH ControlMaster configuration and new Copilot token injection feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# Add GitHub Copilot token if available
local config_home="${XDG_CONFIG_HOME:-$HOME/.config}"
if [[ -f "$config_home/github-copilot/apps.json" ]]; then
local copilot_token=$(jq -r '."github.com:Iv1.b507a08c87ecfe98".oauth_token // empty' "$config_home/github-copilot/apps.json" 2>/dev/null)
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

The hardcoded client ID 'Iv1.b507a08c87ecfe98' appears to be magic value. Consider extracting this as a named constant at the top of the file or adding a comment explaining what this specific client ID represents.

Copilot uses AI. Check for mistakes.
local devpod_host="${selected_space}.devpod"

# Start SSH ControlMaster for multiplexing
ssh -MNf "$devpod_host" 2>/dev/null
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

SSH ControlMaster startup failures are silently suppressed. Consider capturing and logging errors to help diagnose connection issues, especially since the README indicates this is 'Required for optimal performance'.

Suggested change
ssh -MNf "$devpod_host" 2>/dev/null
local _ssh_cm_log=$(mktemp -t devpod-sshcm.${selected_space}.XXXXXX.log)
ssh -MNf "$devpod_host" 2> "$_ssh_cm_log"
local _ssh_cm_status=$?
if [[ $_ssh_cm_status -ne 0 ]]; then
echo "[devpod-gh] WARNING: SSH ControlMaster startup failed for $devpod_host. See $_ssh_cm_log for details." >&2
echo "[devpod-gh] SSH error output:" >&2
cat "$_ssh_cm_log" >&2
fi

Copilot uses AI. Check for mistakes.
# Remove temp log file
# Exit SSH ControlMaster connection
if [[ -n "$selected_space" ]]; then
ssh -O exit "${selected_space}.devpod" 2>/dev/null
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

The devpod_host variable is constructed here instead of reusing the existing variable from line 147. Use '$devpod_host' for consistency and to avoid duplication.

Suggested change
ssh -O exit "${selected_space}.devpod" 2>/dev/null
ssh -O exit "$devpod_host" 2>/dev/null

Copilot uses AI. Check for mistakes.
This enables things like [github copilot cli](https://github.com/features/copilot/cli/) to just work... automagically, in devpods.

It magically enables the [github cli](https://github.com/devcontainers/features/tree/main/src/github-cli) feature.
This enables things like [github copilot cli](https://github.com/features/copilot/cli/) and [github cli](https://github.com/devcontainers/features/tree/main/src/github-cli) to just work... automagically, in devpods.
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Corrected capitalization of 'github' to 'GitHub' for consistency with proper product naming.

Copilot uses AI. Check for mistakes.
@scaryrawr scaryrawr merged commit 6745c1c into main Nov 4, 2025
@scaryrawr scaryrawr deleted the multiplex branch November 4, 2025 15:52
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.

2 participants