Skip to content

fix(web-ui): create a terminal session for GitHub PR authentication - #3958

Merged
wsp1911 merged 1 commit into
openBitFun:mainfrom
YodonTan:fix/github-pr-auth-terminal
Nov 17, 2026
Merged

wsp1911 merged 1 commit into
openBitFun:mainfrom
YodonTan:fix/github-pr-auth-terminal

Conversation

@YodonTan

@YodonTan YodonTan commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review. The Windows installer path has been validated by the user; see Manual verification below.

Reported reproduction

In a GitHub-backed workspace whose gh CLI session is missing, the review platform panel shows its authentication gate. Opening that dialog and choosing Open terminal copied gh auth login --hostname github.com, but the login terminal was not reliably created in the workspace that owns the panel.

Root cause

handleOpenGithubAuthTerminal opened the terminal through the IDE-control quick action (quickActions.openTerminal(undefined, workspacePath)). That entry point carries no terminal session identity and no workspace/connection scope, so the panel could not:

  • create the login terminal in its owning workspace instead of whatever the panel's canvas path points at (a restored review-platform panel can carry a fallback path belonging to another workspace), or
  • give a remote owning workspace its own connection, so the PTY was created without the connection that workspace needs.

Fix scope

Only src/web-ui/src/app/components/panels/review-platform/:

  • Create the terminal through the shared createManualTerminalSession service and open the returned session through the shared openShellSessionTarget service.
  • Resolve the owning workspace root and connection once, before any await and before the clipboard write; keep the panel path only when it is inside the owner root, otherwise start at the root.
  • Re-check the owner after each await (clipboard, creation) and refuse to present a PTY whose owner disappeared or moved to another connection. The existing retryable openAuthFailed error stays visible instead of silently retargeting the terminal.
  • Keep the panel lifetime and device-surface fences: no open or success notification after unmount or after a device switch.

Tests

Focused automated verification on the rebased tree (origin/main = f86f80a4f2e33b5e6489bdd90607a6ff37b62786):

  • node scripts/run-vitest.mjs run --maxWorkers=2 ... -- 4 files, 47 tests passed:
    ReviewPlatformPanel.test.tsx (35), ReviewPlatformPanel.trust.test.tsx (4), TerminalActionBridge.test.tsx (4), createManualTerminalSession.test.ts (4).
  • tsc --noEmit for src/web-ui: clean.
  • eslint on the changed files: 0 errors (the test file matches the repository's existing ignore pattern).
  • git diff --check origin/main..HEAD: clean; the diff is exactly the two files above.

Not run locally: pnpm run check:web (no pnpm on this machine's PATH). An independent theme color audit only reported the pre-existing stale generated src/shared/miniapp-chrome/generated/theme.css, which is not part of this diff.

Testing level: lightly tested (automated), plus a manual Windows pass

AI-assisted change. The automated evidence is unchanged: the new tests use simulated owner workspace records, device-surface switches and request lifecycles, so they do not establish real desktop UI rendering or live terminal behavior.

Manual verification

Confirmed by the user on Windows: the installer built from this branch (ff01e2874615220729f04da1c784d6d21cec11cf, version 1.0.11-beta.3958) fixes the GitHub PR authentication terminal flow, with no problems found.

That confirmation covers the Windows desktop path only. Still not exercised: real SSH workspace, Peer Device Mode, Remote Control, and Detached Dispatch.

The GitHub CLI authentication action opened a terminal through the
IDE-control quick action, which carries no session identity. The panel
could therefore neither create the login terminal in the workspace that
owns it nor keep it when the canvas path belonged to another workspace.

Create the terminal through the shared manual terminal session service,
resolve the owner workspace root and connection once before any await,
re-check that owner before the PTY is presented, and open the returned
session through the shared shell target with that owner scope. A missing,
changed, or device-switched owner now reports the existing retryable
error instead of silently retargeting the terminal.
@YodonTan

Copy link
Copy Markdown
Contributor Author

Unsigned Windows x64 verification build (artifact-only; not code-signed, not released)

  • Fork run: https://github.com/YodonTan/BitFun/actions/runs/44005320736 (run 44005320736, success, run_attempt 1)
  • Source: ff01e28
  • Version: 1.0.11-beta.3958 (beta channel, upload_to_release=false, windows-x64 only)
  • Artifact: openbitfun-v1.0.11-beta.3958-windows-x64-bundle (id 14298996665, 282,158,666 bytes, expires 2027-02-15) — https://github.com/YodonTan/BitFun/actions/runs/44005320736/artifacts/14298996665
  • Payload (SHA256, Authenticode NotSigned for both):
    • OpenBitFun_1.0.11-beta.3958_x64-setup.exe — 119,110,800 bytes — 3BEDF581B048683D18C94BEDF5926D8084611687232A2EC1717D3DF9D16752FF
    • openbitfun-installer.exe — 170,038,272 bytes — 05C0CE2C8670190C765F7CE4F185524EBBD9BC259AE0897BE800D76DD8CA17D5
  • PE version metadata reports 1.0.11-beta.3958 for both executables.

Status: manual Windows verification pending; this PR stays Draft/WIP and nothing was published.

@YodonTan YodonTan changed the title WIP: fix(web-ui): create a terminal session for GitHub PR authentication fix(web-ui): create a terminal session for GitHub PR authentication Nov 17, 2026
@YodonTan
YodonTan marked this pull request as ready for review November 17, 2026 06:39
@YodonTan

Copy link
Copy Markdown
Contributor Author

Manual verification is complete, so this PR is now ready for review.

The user validated the GitHub PR authentication terminal flow on Windows with the installer built from this branch (ff01e287, version 1.0.11-beta.3958). The review platform panel now opens the login terminal in the workspace that owns the panel, and no problems were reported.

That confirmation covers the Windows desktop path only. Real SSH workspace, Peer Device Mode, Remote Control, and Detached Dispatch remain unexercised, and the automated test evidence above is unchanged.

@YodonTan

Copy link
Copy Markdown
Contributor Author

@bobleer Could you please review this fix when you have a chance?

The reporter has verified the Windows build (1.0.11-beta.3958, ff01e2874) and confirmed that the GitHub PR authentication terminal issue is resolved. This PR is now ready for review.

I could not assign a reviewer through the repository API with the current permissions, so I am requesting the review here instead. Scenarios beyond the Windows desktop path, such as a real SSH workspace, Peer Device Mode, Remote Control, and Detached Dispatch, remain unexercised.

@bobleer
bobleer requested a review from wsp1911 November 17, 2026 06:45
@wsp1911
wsp1911 merged commit 47d4dd1 into openBitFun:main Nov 17, 2026
9 checks passed
wsp1911 pushed a commit to wsp1911/BitFun that referenced this pull request Nov 17, 2026
- Open the login terminal on the OpenBitFun host so GitHub CLI login
  shares credentials with the PR backend for SSH workspaces.
- Validate the captured workspace root and SSH connection before
  creating the terminal. Keep older Desktop peers on the explicit
  host terminal path.

Refs: openBitFun#3958
wsp1911 pushed a commit that referenced this pull request Nov 17, 2026
- Open the login terminal on the OpenBitFun host so GitHub CLI login
  shares credentials with the PR backend for SSH workspaces.
- Validate the captured workspace root and SSH connection before
  creating the terminal. Keep older Desktop peers on the explicit
  host terminal path.

Refs: #3958
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