Skip to content

fix(cli): open relative startup directories with leading spaces - #44442

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
jadelike-wine:codex/cli-startup-leading-space
Nov 27, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
jadelike-wine:codex/cli-startup-leading-space

Conversation

@jadelike-wine

Copy link
Copy Markdown
Contributor

Problem

From a directory containing a folder named project, running t3 ' project' fails with Unknown command "project". The quotes preserve the leading space in the argument, but T3 trims it before checking whether the folder exists and again while resolving the startup directory.

Change

Use the same startup argument normalization for the command check and server configuration. Preserve the leading space in relative directory names so startup can open the selected folder.

Scope

This is a small, separately reproducible CLI startup bug. It needs no separate issue. The change follows the relative-path handling introduced for project management commands in #44156.

Verification

  • Ran the production CLI on macOS with an isolated home and loopback server. On main, the quoted folder was rejected before startup. With the fix, the server reached readiness and the project stored in SQLite pointed to the exact folder named Needs leading space. An ordinary directory bootstrapped successfully in both runs, and an unknown command still exited with an error.
  • The focused subprocess regression failed on main and passed after the fix. It exercises the real bin.ts entry point and confirms startup no longer drops the leading space.
  • The repository's changed-file checks passed. Native Windows startup was outside this verification.

GPT-6 via Codex desktop.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CLI now normalizes explicit working-directory arguments before resolving server configuration or checking whether an argument names a command or directory. Tests cover whitespace handling for relative and absolute paths.

Changes: CLI working-directory normalization

Layer / File(s) Summary
Normalize working-directory arguments
apps/server/src/cli/config.ts
Adds normalizeServerCwdArgument and uses it to normalize an explicit cwd before resolving server configuration.
Apply normalization across CLI entry points
apps/server/src/cli/server.ts, apps/server/src/cli/config.test.ts
Uses the normalization helper before command-or-directory checks. Tests verify that relative paths retain leading spaces and surrounding whitespace is removed from absolute paths.

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to b637e

The change makes the CLI preserve a leading space in relative startup directory names instead of wrongly rejecting them as unknown commands. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: relative startup directories with leading spaces are now opened correctly by the CLI. It follows the conventional commit format and matches the changeset (normalizeSer…
Description check Passed The description follows the repository template. It covers Problem (the quoted ' project' argument is trimmed and rejected as an unknown command), Change (shared startup argument normalization that ke…
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 main change: relative startup directories with leading spaces are now opened correctly by the CLI. It follows the conventional commit format and matches the changeset (normalizeServerCwdArgument in config.ts and server.ts, plus a config test for leading spaces).

Full details: Description check

Explanation

The description follows the repository template. It covers Problem (the quoted ' project' argument is trimmed and rejected as an unknown command), Change (shared startup argument normalization that keeps the leading space), Scope (a small bug fix with no separate issue needed, and a reference to #44156), and Verification (macOS production CLI runs, a focused subprocess regression that failed on main and passed after the fix, and a note that Windows was not tested). The template also asks for the agent model and harness, and the author gave 'GPT-6 via Codex desktop'. The Scope section does not link an issue, but it gives a reason for omitting one, as the template allows.

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 e2835df and b637e84.

Files selected for processing: 1

  • apps/server/src/cli/config.test.ts

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 27, 2026
juliusmarminge and others added 2 commits November 27, 2026 20:55
Replace the subprocess test, which only showed command rejection was
skipped, with a config test that checks the resolved project path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Ran the real built CLI on Linux with fresh synthetic state. From a parent directory, ran t3 ' project' --base-dir <fresh-state> --no-browser --port <free-port>, first with only project, then with both project and project. Captures render actual CLI output and persisted project observations.

Before After
18d0019964 b637e84397
Before: rejects the directory or selects the unprefixed sibling After: starts and preserves the leading space in both cases

Before output · After output · Reproduction driver

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 27, 2026
@juliusmarminge
juliusmarminge merged commit 51f9ca9 into pingdotgg:main Nov 27, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 27, 2026
CesarDavidXI pushed a commit to CesarDavidXI/t3code-cd that referenced this pull request Nov 28, 2026
…dotgg#44442)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
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 Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants