Skip to content

fix(server): recover the login shell SSH agent - #10312

Closed
yashranaway wants to merge 6 commits into
pingdotgg:mainfrom
yashranaway:fix/server-login-shell-ssh-agent
Closed

yashranaway wants to merge 6 commits into
pingdotgg:mainfrom
yashranaway:fix/server-login-shell-ssh-agent

Conversation

@yashranaway

@yashranaway yashranaway commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The Windows desktop WSL backend can start without SSH_AUTH_SOCK even when its login shell exports a working agent. With SSH commit signing enabled, Commit, Commit & push, and Commit, push & PR then fail at the commit step.

Change

Recover a missing SSH_AUTH_SOCK alongside PATH from the accepted login-shell probe during unprepared Linux/macOS server startup. Preserve an inherited socket, the prepared-environment early return, and PATH/mise hydration.

Scope and approval

Fixes #5740
GitCafe: https://git.cafe/pingdotgg/t3code/issues/5740
Triaged bug via the automated issue flow. Existing contributor implementation and maintainer takeover retained. Limited to agent sockets exported by the login shell; it does not address #10179.

Verification

Rechecked during issue triage on October 22:

  • vp test run apps/server/src/os-jank.test.ts packages/shared/src/shell.test.ts: 63 passed, 1 skipped at the PR head.
  • Production fixPath plus real Git SSH signing, using an isolated agent, disposable key and a wrapper shell: current main 3b95e7831b leaves the socket absent and commit exits 128; PR head recovers the socket, commit exits 0, and the commit contains an SSH signature. This is a direct server-startup behavior check, not a Windows/WSL desktop reproduction.
  • No visible render paths changed; visual fixture matrix is empty. Windows/WSL desktop remains cannot-verify desktop-wsl because wsl.exe is unavailable here.

5740-runtime.mjs
5740-runtime-current-main.log
5740-runtime-pr.log

Previously recorded verification follows:

Verification on d189ceac58:

  • Replaced the six original hydrator-level cases with a five-row extension of main’s startup test: Linux/macOS recovery, forwarded socket precedence, accepted shell without an agent, and no accepted PATH. Existing HOME/prepared/Windows checks remain; mise also asserts its associated PATH. os-jank cases: 15→13.
  • Both recovery cases fail behaviorally against main; focused os-jank/shared-shell suites pass 63 tests with one existing skip. Scoped server typecheck, targeted lint, formatting, and whitespace checks pass.
  • Headless Linux proof ran production fixPath through a real login-shell wrapper and two temporary empty SSH agents:
recovery: ssh-add -l exit 2 (no agent) → exit 1 (agent has no identities)
forwarded: inherited second-agent socket preserved
prepared: shell calls=0; existing PATH preserved
PATH and __MISE_DIFF propagation: passed
owned agents stopped; temporary HOME/sockets/wrapper removed

The wrapper avoids user profiles; mise’s record was synthetic. Empty-agent connectivity does not establish key signing, remote Git authentication, or a provider CLI flow. macOS, Windows, iOS, Android, Electron desktop, OrbStack, and WSL were not verified live. No visual UI change; screenshots do not apply.

One independent review round (Claude Opus 5.5 and GPT-6-Sol) found no code blockers. Historical GitHub findings were rechecked against this revision. Windows desktop/WSL remains unverified (cannot-verify desktop-wsl); this Linux VM has no wsl.exe.

Tests: GPT-6-Astra; implementation: GPT-6.1-Sol; adversarial reviews: Claude Opus 5.5 and GPT-6-Sol. T3 Code using the Codex and Claude harnesses.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 6, 2026
Comment thread apps/server/src/os-jank.ts Resolved
@macroscopeapp

macroscopeapp Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 5c319d9

Macroscope's review found this PR approvable — Restores the login shell’s SSH agent when the server starts without one, while preserving inherited sockets and prepared environments. The change reuses the existing startup probe and does not modify keys or persistent configuration.

You can add or adjust custom eligibility rules. Learn more.

Copy link
Copy Markdown
Member

Note

This comment is posted by Julius' dot

The reporter in #10179 returned “absent” when the login shell started without SSH_AUTH_SOCK, and this patch reads that same login-shell environment. Can you remove the “Fixes #10179” claim and limit the stated coverage to agents available from the login shell, or provide evidence showing how this path recovers that reporter's socket? The verification requirement calls for evidence matching the claimed fix; #5740 remains a useful, distinct case.

@yashranaway

Copy link
Copy Markdown
Contributor Author

Removed the automatic closing claim for #10179 and narrowed the description to sockets exported by the login shell. The patch does not recover an agent socket absent from that environment; #5740 remains the covered case.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 1, 2026 — with ChatGPT Codex Connector
@juliusmarminge juliusmarminge self-assigned this Oct 19, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Taking over this one. I’m retaining @yashranaway’s login-shell agent recovery, resolving main’s PATH/mise and prepared-environment conflicts, and replacing the test-only hydrator seam with startup behavior coverage. Headless Linux proof uses two isolated SSH agents. Leaving it unmerged for credential-propagation review.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The login-shell environment probe now requests SSH_AUTH_SOCK. When a shell PATH is found, hydratePosixPath copies the socket value only if the existing environment does not have one. A test covers the accepted probe value and preservation of an existing value.

Changes: SSH agent environment hydration

Layer / File(s) Summary
Probe and copy SSH_AUTH_SOCK
apps/server/src/os-jank.ts, apps/server/src/os-jank.test.ts
The login-shell lookup now requests SSH_AUTH_SOCK. When a shell PATH is found and env.SSH_AUTH_SOCK is unset, hydratePosixPath copies the shell value. The test checks that the accepted probe value is used, the rejected shell value is ignored, and an existing forwarded value is preserved.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: t3dotgg, juliusmarminge

Merge Risk: Minimal · up to 5c319

The change recovers the login-shell SSH agent socket when the server environment lacks one, and it keeps any inherited socket. No concrete merge-blocking risk was found. Windows/WSL desktop behavior was not verified at runtime.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive For #5740, hydratePosixPath now requests SSH_AUTH_SOCK from the accepted login-shell probe and sets it only when the server environment lacks a socket. The added test verifies accepted-shell recov… Provide reviewable evidence for the #5740 unavailable-agent error behavior, such as the existing implementation and a focused automated test or an explicit requirement decision that excludes this behavior.
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: recovering the SSH agent from the login shell during server startup.
Description check Passed The description covers the required Problem, Change, Scope and approval, and Verification sections. It explains the affected behavior, implementation scope, linked issue, test results, production veri…
Out of Scope Changes check Passed The pull request changes only POSIX startup environment hydration and its test. The changes support #5740 by recovering a login-shell SSH_AUTH_SOCK and preserving an inherited socket. No unrelated p…
Full details: Description check

Explanation

The description covers the required Problem, Change, Scope and approval, and Verification sections. It explains the affected behavior, implementation scope, linked issue, test results, production verification, and remaining Windows/WSL verification limits.

Full details: Out of Scope Changes check

Explanation

The pull request changes only POSIX startup environment hydration and its test. The changes support #5740 by recovering a login-shell SSH_AUTH_SOCK and preserving an inherited socket. No unrelated product behavior is present. The stated exclusion of #10179 remains within scope.

Full details: Linked Issues check

Explanation

For #5740, hydratePosixPath now requests SSH_AUTH_SOCK from the accepted login-shell probe and sets it only when the server environment lacks a socket. The added test verifies accepted-shell recovery and inherited-socket precedence. The issue also requires actionable Git stderr when the signing agent is unavailable. The reviewed diff adds no error-reporting code or test for that behavior, and the available evidence does not establish whether existing Git error handling already satisfies it.

Resolution

Provide reviewable evidence for the #5740 unavailable-agent error behavior, such as the existing implementation and a focused automated test or an explicit requirement decision that excludes this behavior.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 362ef9a and 5c319d9.

Files selected for processing: 2

  • apps/server/src/os-jank.test.ts
  • apps/server/src/os-jank.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Oct 19, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Takeover complete at d189ceac58. Current-head build, lint, and test jobs pass; skipped jobs remain skipped. No unresolved inline findings. One full independent review round with Claude Opus 5.5 and GPT-6-Sol found no code blockers. The PR body contains the current focused tests, headless proof, original-author credit, and platform limits.

Macroscope correctness passed. Its neutral approvability result explicitly requires human review of login-shell credential propagation. Leaving unmerged.

@juliusmarminge juliusmarminge added the bugfix Fix PR opened by an issue lead; enters the PR loop label Oct 22, 2026 — with GitCafe Production
@juliusmarminge juliusmarminge added the pr:needs-julius Needs Julius: route gate, unverifiable surface, or blocked label Oct 22, 2026
Resolve the conflict with JAVA_HOME hydration by reading JAVA_HOME and
SSH_AUTH_SOCK from the same login-shell probe, and fold the SSH agent
tests into one case alongside main's JAVA_HOME test.

AI-assisted; verified with the tests and tools listed above.
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Nov 11, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

The shared POSIX startup/signing behavior reproduces on Linux. Windows desktop launching WSL was not exercised.

On both commits: launch the real server without SSH_AUTH_SOCK, expose a loaded signing agent through its login shell, enable SSH commit signing, modify README.md, and submit the same explicit message through Git action options > Commit.

Before After
Before: failed app commit and missing-agent diagnostic
362ef9a88a
After: app-created commit with verified SSH signature
5c319d94fc
Continuous recording: 29.5 seconds, 885 frames Continuous recording: 18.1 seconds, 543 frames

Base creates no commit. Its actual toast exposes a generic Git failure; the subsequent terminal diagnostic shows Couldn't get agent socket?, failed to write commit object, and exit 128. Head creates synthetic commit 646bf98; its terminal shows a good SSH signature and git verify-commit exit 0.

Both recordings are continuous 30 fps captures without splicing, reordering, or speed changes. Stills were extracted from the processed recordings. Only the repository path is masked in the base toast; the terminal error remains visible and untouched.

The inherited-socket guard also passed: the login-shell agent has no identities, the inherited agent contains the signing identity, and the app creates distinct synthetic commit 4626be5, whose signature verifies with exit 0.

Inherited signing agent preserved

Inherited-agent continuous recording · Driver and seed scripts · Supplementary verification transcript

AI-assisted; verified with the tests and tools listed above.

Not shown:

  • Windows desktop launching a fresh WSL backend was unavailable on this Linux VM; the captures prove the shared POSIX server path under Linux.
  • Commit & push and Commit, push & PR were not exercised; the captured app action is Commit.
  • The final paired captures use key:: public-key configuration to require the agent; the file-valued user.signingkey variant was not captured.

@t3dotgg

t3dotgg commented Nov 12, 2026

Copy link
Copy Markdown
Member

Note

🤖 Claude Opus 5.5 responding on behalf of Theo

Closing. This PR has been open for more than 3 weeks, and main has moved a long way since then. If the change still matters, open a fresh PR from current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews pr:needs-julius Needs Julius: route gate, unverifiable surface, or blocked size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows/WSL commit actions fail for SSH-signed commits because SSH_AUTH_SOCK is not inherited

3 participants