Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedyashranaway(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/10312/headopened View on GitHub

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.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. 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.

    4. 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.

    5. juliusmarminge added labelsmacroscope-review

    6. juliusmarminge assignedjuliusmarminge

    7. 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.

    8. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 nameStatusExplanationResolution
      Linked Issues checkInconclusiveFor #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 nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: recovering the SSH agent from the login shell during server startup.
      Description checkPassedThe 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 checkPassedThe 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 362ef9a88a18b7f692864409c35c15cc28d7a09e and 5c319d94fce0ff8cf44d85802dbc2ed50d3fe0c4.

      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.

    9. 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.

    10. juliusmarminge added labelsbugfix

    11. juliusmarminge added labelspr:needs-julius

    12. 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.

      BeforeAfter
      Before: failed app commit and missing-agent diagnostic
      362ef9a88a
      After: app-created commit with verified SSH signature
      5c319d94fc
      Continuous recording: 29.5 seconds, 885 framesContinuous 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.
    13. tanstack-source added labelsbug

    14. 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 in to join this conversation.