Registry Mirror
Skip to content

Conversation

@smirea

@smirea smirea commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Note

Gemini 4 Neon writing on behalf of Stefan.

Problem

When a user renames a project in Settings → Projects and another checkout of the same repository joins the group later (on the same machine or a linked environment), the later checkout keeps its default folder title (hasCustomTitle: false). pingdotgg#44281 fixed deriveProjectGroupLabel so the sidebar, Settings → Projects, and pickers keep showing the custom name, but thread headers and the new-thread hero still read project.title directly:

  • Opening a thread in the later checkout shows its raw folder name in the web/desktop chat header breadcrumb (ChatHeader.tsx) and mobile thread header subtitle (ThreadRouteScreen.tsx), while the sidebar shows the renamed name.
  • Starting a new draft in the later checkout shows its raw folder name in the What should we build in …? hero trigger (DraftHeroHeadline.tsx), directly above the picker dropdown listing the renamed name.

Reproduce (one machine, Linux or macOS, no provider account):

  1. Create two clones of one repository sharing the same origin remote (a/demo and b/demo).
  2. Add a/demo and rename it to demo-renamed.
  3. Add b/demo (joins the group with default folder title demo).
  4. Start and open a thread in b/demo: the sidebar shows demo-renamed, while the chat header breadcrumb shows demo.
  5. Click the breadcrumb's project name to start a new draft in b/demo: the breadcrumb and hero show demo.

Change

  • Extract the non-subfolder single-rename rule already in deriveProjectGroupLabel (packages/client-runtime/src/state/projectGrouping.ts) into shared helpers and export resolveProjectDisplayTitle(project, projects, settings).
    • If the checkout already has hasCustomTitle === true, is a scratch project, or is a subfolder of a whole-repository group, it keeps project.title.
    • Otherwise, if its group's non-subfolder renamed checkouts agree on exactly one custom title (matching deriveProjectGroupLabel), it returns that title; else it keeps project.title.
  • Wire resolveProjectDisplayTitle into:
    • Web/desktop ChatHeader (apps/web/src/components/chat/ChatHeader.tsx) — breadcrumb label, New thread in … tooltip, and aria-label.
    • Web/desktop DraftHeroHeadline (apps/web/src/components/chat/DraftHeroHeadline.tsx) — hero trigger, tooltip, fallback button, and heading width measurement.
    • Mobile ThreadRouteScreen (apps/mobile/src/features/threads/ThreadRouteScreen.tsx) — thread header subtitle (mobile's NewTaskDraftScreen already resolves the label through the project group).

Scope

Fixes #

Verification

Automated (Linux VM, no account)

  • Unit test: vp test run packages/client-runtime/src/state/projectGrouping.test.ts (34/34 pass; fails on main). Covers later-joined root checkouts (repository), later-joined subfolders (repository_path), unrenamed checkouts with distinct folder names, subfolders under a renamed repo root, conflicting renames, and separate mode.
  • Web browser tests: vp test run apps/web/src/components/chat/ChatHeader.browser.test.tsx apps/web/src/components/chat/DraftHeroHeadline.browser.test.tsx (5/5 pass).
  • Real-app scenario proof (vp run scenarios:prove scripts/scenarios/chat-header-project-rename.e2e.ts --base origin/main): fails on origin/main (f72ab41bfe) and v0.1.14-nightly.20261204.5719 (527abfe31e), passes on this branch (2ef31deb86).
  • Non-bug control check in the real web app: confirmed two unrenamed checkouts (alpha-folder / beta-folder) and an unrenamed subfolder (apps/web) under a renamed root (mono-renamed) keep beta-folder and web in both the breadcrumb and draft hero.
  • Reverting each changed source file (projectGrouping.ts, ChatHeader.tsx, DraftHeroHeadline.tsx) in turn causes either the unit test or the scenario to fail.
  • vp run check:changed passes (format, lint, knip, typecheck across 7 affected packages including @t3tools/mobile, tests, React Compiler).
main (f72ab41bfe) This branch (2ef31deb86)
Thread header (second checkout) Before: thread header shows demo while sidebar shows demo-renamed After: thread header shows demo-renamed
New-thread draft hero (second checkout) Before: breadcrumb and draft hero show demo while sidebar shows demo-renamed After: breadcrumb and draft hero show demo-renamed
Scenario source (scripts/scenarios/chat-header-project-rename.e2e.ts)
import { expect } from "e2e";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";

import { T3_HOME } from "../e2e.config.ts";
import { run } from "./shell.ts";
import { makeState, runPromise, test, WEB } from "./t3.ts";

const checkout = () =>
  runPromise(
    Effect.gen(function* () {
      const fs = yield* FileSystem.FileSystem;
      const path = yield* Path.Path;
      yield* fs.makeDirectory(path.join(T3_HOME, "workspaces"), { recursive: true });
      const parent = yield* fs.makeTempDirectory({
        directory: path.join(T3_HOME, "workspaces"),
        prefix: "w-",
      });
      const directory = path.join(parent, "demo");
      yield* fs.makeDirectory(directory);
      yield* fs.writeFileString(path.join(directory, "README.md"), "");
      const git = (args: ReadonlyArray<string>) => run("git", args, { cwd: directory });
      yield* git(["init", "--quiet", "--initial-branch=main"]);
      yield* git(["remote", "add", "origin", "https://github.com/scenario/demo.git"]);
      yield* git(["add", "--all"]);
      yield* git([
        "-c",
        "user.name=Scenario",
        "-c",
        "user.email=scenario@example.invalid",
        "commit",
        "--quiet",
        "--message",
        "Initial commit",
      ]);
      return directory;
    }),
  );

test(
  "A thread in a later-joined checkout of a renamed project shows the project's name in the header and new-thread hero",
  WEB,
  async ({ t3, app, screen, browser }) => {
    const state = makeState(T3_HOME);
    const first = await checkout();
    const second = await checkout();
    try {
      await runPromise(state.cli(["project", "add", first]));
      await runPromise(state.cli(["project", "rename", first, "demo-renamed"]));
      // The second checkout arrives later with its default folder-name title.
      await runPromise(state.cli(["project", "add", second]));
      const thread = await t3.thread({
        project: second,
        title: "Second checkout thread",
        messages: ["Hello"],
      });

      await t3.open(thread);
      const sidebar = screen.getByRole("navigation").first();
      await expect(sidebar.getByText("Second checkout thread").first()).toBeVisible();
      await expect(sidebar.getByText("demo-renamed", { exact: true }).first()).toBeVisible();

      const breadcrumb = screen.getByRole("navigation", "Thread breadcrumb");
      const projectBreadcrumb = breadcrumb.getByRole("button").first();
      const projectBreadcrumbLabel = browser
        .locator('nav[aria-label="Thread breadcrumb"] [data-slot="workspace-breadcrumb-text"]')
        .first();
      await expect(projectBreadcrumbLabel).toBeVisible();
      await app.screenshot("thread-header-second-checkout");
      const threadBreadcrumbText = (await projectBreadcrumbLabel.textContent())?.trim();

      // Clicking the breadcrumb starts a new draft in the same checkout.
      await projectBreadcrumb.tap();
      const projectPicker = browser.locator("[data-draft-project-trigger]");
      await expect(projectPicker).toBeVisible();
      await app.screenshot("draft-hero-second-checkout");

      expect(threadBreadcrumbText).toBe("demo-renamed");
      await expect(projectBreadcrumbLabel).toHaveText("demo-renamed");
      await expect(breadcrumb.getByRole("button", "New thread in demo-renamed")).toBeVisible();
      await expect(projectPicker).toHaveText("demo-renamed");
    } finally {
      for (const workspace of [first, second]) {
        await runPromise(state.cli(["project", "remove", workspace, "--force"], [0, 1]));
      }
    }
  },
);

Not verified on device

  • Native mobile (apps/mobile/src/features/threads/ThreadRouteScreen.tsx) was verified via shared client-runtime unit tests and @t3tools/mobile typecheck/lint, not launched on an iOS/Android device.

Gemini 4 Neon in Antigravity (T3 Code).

…'s name on later checkouts (by antigravity/gemini-4-neon)
…arrow mobile header subscription (by antigravity/gemini-4-neon)
@smirea
smirea force-pushed the fix/chat-header-project-rename branch from 46af666 to c9aefad Compare December 4, 2026 20:50
@smirea

smirea commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Opened upstream at pingdotgg#49026 (fixes pingdotgg#49025).

@smirea smirea closed this Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant