GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(shell): preserve literal carriage returns in captured values by Lucenx9 · Pull Request #35702 · pingdotgg/t3code

Conversation

@Lucenx9

@Lucenx9 Lucenx9 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Problem

Shell environment capture strips a literal trailing carriage return from a value when the probe uses LF delimiters. For example, an exported SSH_AUTH_SOCK ending in \r becomes a different pathname and cannot connect to its agent. I found this while checking whether environment capture preserves exported values byte for byte, then reproduced it with a private native SSH agent.

Change

Use the opening marker's newline to remove exactly one delimiter at each boundary, preserving CR characters that belong to the value. Desktop now uses the shared decoder for its login-shell and PowerShell probes, replacing its duplicate decoder with the same bug. Missing and empty variables remain omitted.

For an LF-framed value, \r below is pathname data and \n is the probe delimiter:

flowchart LR
    A["Socket pathname ends in CR"] --> B["LF-framed capture"]
    B --> C["Before: strips CR + LF"]
    B --> D["After: strips only LF"]
    C --> E["Different socket: connection fails"]
    D --> F["Original socket: agent reachable"]
Loading

Scope

A small fix for an obvious value-corruption bug; no issue required under CONTRIBUTING.md. Command generation, environment forwarding and wire contracts are unchanged. Targeted duplicate searches and inspection of the closest PRs found no equivalent decoder fix; #32646 fixes DEBUG-trap output and #35617 fixes printenv lookup.

Verification

  • Extended the existing multiline-value test with LF and CRLF framing and a literal trailing CR. On main, the LF row fails while the CRLF control passes. With the fix, shared shell tests pass 70/70 (2 existing opt-in tests remain skipped), and desktop shell tests pass 23/23.
  • Native Linux replay starts an isolated, empty-keyring ssh-agent on a socket whose pathname ends in CR, captures SSH_AUTH_SOCK through the actual Bash probe, and runs ssh-add -l. Before: the decoded pathname loses CR and ssh-add exits 2, Error connecting to agent: No such file or directory. After: the pathname is preserved and ssh-add exits 1, The agent has no identities. Exit 1 here confirms a working connection to an empty agent. Only the private agent is stopped; no user keys, remote host or live T3 state are used.
  • fast-check: 500 framed-decoder cases plus 60 real Bash round trips, seed 35618, pass. Jazzer.js: the base fails on the trailing-CR seed; the fix completes 1,000 fuzz executions without a finding.
  • StrykerJS: 13/14 decoder mutants killed. The survivor substitutes endsWith for the opening startsWith check; these agree for correctly paired frames in the selected tests. Malformed-frame handling is outside this fix. No mutant was suppressed.
  • Fallow: scoped new-only audit passes with recorded V8 coverage; one compatibility judgment accepted against the current graph. CodeScene MCP: all 3 changed files checked, quality gates pass. These are scoped source snapshots, not whole-repository audits.
  • Scoped Effect TypeScript check, format, lint and the local constraint-floor guard pass. The guard was checked against clean/moved assertions, removed assertions, suppressions, skipped tests and a scanner error. No checker settings or hooks were disabled.
  • The normal commit hook passes format, lint and both Knip checks. check:changed passes those stages and 95 tests across 3 selected files (2 existing opt-in skips), but exits 1 on stale local typecheck state. After lockfile-based dependency repair and a fresh desktop compile, the identical failed step passes 35/35 affected-package typechecks, using the same CI mapping and one worker. Already-green tests/Knip were not repeated; no hook or checker was bypassed.

Linux Bash and native OpenSSH only; no native macOS/Windows or interactive desktop session. Local Node 24.15 differs from the repository's Node 26.12.1. Independent read-only reviews: Daybreak Blue high, Sonnet medium, Opus 5.5 medium and Gemini 4 Argon all APPROVE; no blocking findings. Reviewers did not rerun tests. Gemini was used only as a reviewer.

Authored with GPT-6.1 Sol in the Codex harness.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Lucenx9
fix(shell): preserve literal carriage returns in captured values
3ea684d
Copilot AI balanced review requested due to automatic review settings November 12, 2026 23:49
Copilot AI reviewed Nov 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T23:52:12.199912Z 3ea684d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 12, 2026
macroscopeapp[bot]
macroscopeapp Bot approved these changes Nov 12, 2026
View reviewed changes
@macroscopeapp

macroscopeapp Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 3ea684d

Macroscope's review found this PR approvable — Shell environment capture now preserves literal carriage returns and uses one shared decoder across desktop probes. Commands and environment selection remain unchanged, keeping the change narrowly scoped to value preservation.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: 56fd98b
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 87a85eb9-da21-4daa-a515-8fe01cdaa79d
Commits

Reviewing files that changed from the base of the PR and between 3ea684d and 3f6523b.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The shared shell utility now removes at most one framing line ending from each end of captured environment values. Desktop login-shell and PowerShell probes now use this utility. The extraction result type is now Record<string, string>.

Changes: Shell environment extraction

Layer / File(s) Summary
Extraction behavior and desktop probe integration
packages/shared/src/shell.ts, packages/shared/src/shell.test.ts, apps/desktop/src/shell/DesktopShellEnvironment.ts
The extraction utility removes at most one leading and trailing line ending, using CRLF framing when present and LF otherwise. Tests cover both framing types and preserve the captured value. Login-shell and PowerShell probes now call the shared utility. Its result type is Record<string, string>.

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

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#23610: This PR also uses extractEnvironmentValues to read shell environment values and merge PATH and JAVA_HOME into the process environment.

Suggested reviewers: juliusmarminge, serendeep, macroscopeapp

Merge Risk: Minimal · previous review 3ea68

The change preserves literal trailing carriage returns in captured shell environment values. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its subject: literal carriage returns are preserved in captured shell environment values. It follows the conventional commit format, is one sentence, and matches the descri…
Description check Passed The description follows the template's Problem, Change, Scope, and Verification sections. It explains the bug with a concrete SSH_AUTH_SOCK example and reproduction. It describes the shared decoder ch…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix and its subject: literal carriage returns are preserved in captured shell environment values. It follows the conventional commit format, is one sentence, and matches the described change in the summary and objectives. It does not cover the desktop decoder swap, but that is expected.

Full details: Description check

Explanation

The description follows the template's Problem, Change, Scope, and Verification sections. It explains the bug with a concrete SSH_AUTH_SOCK example and reproduction. It describes the shared decoder change and states that no issue is needed for this small fix. Verification gives specific test counts and observed results. It also states which checks were not run, such as native macOS and Windows. The description is long, and some verification detail goes beyond what the template asks for. It also mentions a Node version mismatch and reviewer tooling, which the template does not require. The required sections are all present and substantive, so the check passes.

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

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: 532bf2e
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 81d2e92c-45b2-41f5-9131-f6a1d2c5778f
Commits

Reviewing files that changed from the base of the PR and between 532bf2e and 3ea684d.

Files selected for processing: 3

  • apps/desktop/src/shell/DesktopShellEnvironment.ts
  • packages/shared/src/shell.test.ts
  • packages/shared/src/shell.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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 14, 2026
@juliusmarminge
Merge remote-tracking branch 'origin/main' into fix/shell-capture-lit…
3f6523b
…eral-cr
@juliusmarminge

juliusmarminge commented Nov 14, 2026

Copy link
Copy Markdown
Member

Evidence

Ran the same Linux Electron reproduction on fresh synthetic state, light theme, 1440×900. A private empty SSH agent used a socket pathname ending in literal CR, exported only by .bash_profile. Added an empty local Git project, created a replay thread, and checked the inherited value and ssh-add status in its non-login terminal, followed by a bash -lc control. The displayed pathname is limited to its basename for privacy.

Before After
56fd98be52 3f6523bc6f
Before: literal CR dropped; ssh-add connection error, rc=2 After: literal CR preserved; empty agent reachable, rc=1
Before recording After recording

The login-shell control preserves CR and reaches the empty agent on both commits. Exit code 1 means the reachable agent has no identities.

Reproduction and capture driver · Run metadata and observations

Not shown:

  • The desktop Windows PowerShell probe and CRLF framing were not exercised; this proof covers the reported Linux/bash SSH-agent reproduction.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 14, 2026
@lowlyleon lowlyleon mentioned this pull request Nov 15, 2026
fix(shell): non-ASCII Windows PATH entries survive the PowerShell environment probe #37154
Merged

This branch has not been deployed

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:M 30-99 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Lucenx9 @juliusmarminge
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.