Skip to content

fix(server): restore PR detection without HOME - #4985

Merged
maria-rcks merged 2 commits into
pingdotgg:mainfrom
StiensWout:t3code/fix-worktree-pr-numbers
Jul 30, 2026
Merged

fix(server): restore PR detection without HOME#4985
maria-rcks merged 2 commits into
pingdotgg:mainfrom
StiensWout:t3code/fix-worktree-pr-numbers

Conversation

@StiensWout

@StiensWout StiensWout commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Problem

T3 servers launched by service managers without HOME cannot let gh locate its existing credentials. Git status then silently omits pull request metadata, which leaves PR numbers blank for threads in worktrees and remote clients.

Fix

Hydrate a missing or blank POSIX HOME from os.homedir() during server startup before hydrating PATH, while preserving any explicitly configured value. Add focused coverage for missing, blank, and explicit HOME values.

Impact

PR numbers and statuses resolve across worktrees for web, desktop, and mobile clients connected to the updated server.

Validation

  • Commit-time formatting passed for both changed files.
  • vp run --filter t3 typecheck passed (existing Effect suggestions only).
  • git diff --check upstream/main...HEAD passed.
  • A standalone server startup with HOME unset used the real gh binary and returned PR #4844.
  • A separate tracked worktree displayed PR #4844 in the thread footer and sidebar.
  • T3's Checkout pull request → Worktree flow displayed PR #4981 in the sidebar, footer, and View PR action.
  • vp test run apps/server/src/os-jank.test.ts is blocked before collection by the existing Vitest failed to find current suite runner failure, which reproduces on unchanged tests.

image

image

Created with GPT-5.6-Sol in the T3 Code Codex harness.

Note

Restore PR detection by hydrating HOME on POSIX when unset or blank

  • Adds hydratePosixHome in os-jank.ts that sets env.HOME from NodeOS.userInfo().homedir when HOME is missing or blank.
  • Updates the fixPath generator to call hydratePosixHome before hydratePosixPath on POSIX, wrapping failures with Effect.catchDefect to log a warning rather than crash.
  • Behavioral Change: process.env.HOME will now be populated on POSIX systems where it was previously unset, which fixes PR detection flows that depend on a valid home directory.

Macroscope summarized 643f981.


Note

Low Risk
Startup-only env repair on POSIX with early return when HOME is already set; failures are logged and do not block server startup.

Overview
Restores PR metadata when the server runs without HOME (e.g. service managers) by hydrating env.HOME from the user account before existing PATH hydration on darwin/linux.

Adds hydratePosixHome, which fills missing or whitespace-only HOME via os.userInfo().homedir and leaves an explicit value untouched. fixPath invokes it ahead of hydratePosixPath, with the same defect logging pattern as PATH failures. Unit tests cover empty env, blank HOME, and preserved custom HOME.

Reviewed by Cursor Bugbot for commit 643f981. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 434f6786-b8e9-4ce9-8541-cd4763ffc571

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 30, 2026
@StiensWout
StiensWout marked this pull request as ready for review July 30, 2026 13:26

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 99f6455. Configure here.

Comment thread apps/server/src/os-jank.ts
Comment thread apps/server/src/os-jank.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 643f981

This is a straightforward bug fix that hydrates the HOME environment variable when missing, with defensive logic that preserves existing values. The changes are small, well-tested, and include proper error handling.

You can customize Macroscope's approvability policy. Learn more.

@maria-rcks
maria-rcks merged commit edc503a into pingdotgg:main Jul 30, 2026
17 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Jul 30, 2026
## What's Changed
* fix(mobile): support pre-Liquid-Glass iOS bottom toolbar by @gabrielelpidio in pingdotgg/t3code#4984
* fix(server): restore PR detection without HOME by @StiensWout in pingdotgg/t3code#4985
* fix(web): fill fast mode icon by @maria-rcks in pingdotgg/t3code#5004
* fix: cache project favicons across web and mobile by @gabrielelpidio in pingdotgg/t3code#4767
* perf(ci): cut stale runs and redundant setup by @t3dotgg in pingdotgg/t3code#4802


**Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260730.957...v0.0.32-nightly.20260730.958

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260730.958
aaditagrawal pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 1, 2026
(cherry picked from commit edc503a)
(cherry picked from commit 896ccca)
aaditagrawal added a commit to aaditagrawal/t3code that referenced this pull request Aug 1, 2026
sync: port upstream websocket/compression and git perf work (pingdotgg#4291pingdotgg#4985)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants