Skip to content

fix: apply paseo.json title overrides in non-git workspaces - #2666

Open
lzm04521 wants to merge 2 commits into
getpaseo:mainfrom
lzm04521:fix/non-git-metadata-override
Open

fix: apply paseo.json title overrides in non-git workspaces#2666
lzm04521 wants to merge 2 commits into
getpaseo:mainfrom
lzm04521:fix/non-git-metadata-override

Conversation

@lzm04521

Copy link
Copy Markdown

Problem

In a non-git workspace, the auto-generated session title ignores metadataGeneration.title.instructions from paseo.json and always uses the default English title style.

Root cause

buildMetadataPrompt reads project overrides via resolveRepoRoot(cwd)readPaseoConfigJson(repoRoot). resolveRepoRoot throws "Create worktree requires a git repository" for non-git directories (workspace-git-service.ts:680), and the surrounding try/catch swallowed that as "no override" — so non-git workspaces never read their paseo.json.

This affects every consumer of buildMetadataPrompt: the title/branch generator (worktree-branch-name-generator.ts) and the commit-message / PR-text generators (git-metadata-generator.ts).

Fix

Add resolveMetadataConfigDir: when resolveRepoRoot throws (non-git) or no git resolver is injected, fall back to options.cwd. For a non-git workspace the cwd is the project root by definition, so the override is read from <cwd>/paseo.json.

  • Only the metadata-config lookup changes; resolveRepoRoot itself is untouched (its "throw on non-git" semantics are relied on by worktree-core, codex-app-server-agent, etc.).
  • Parent-directory walking is intentionally not added (precedent: codex-app-server-agent.ts does resolveRepoRoot(cwd).catch(() => null)).
  • Missing or invalid paseo.json still yields the default style — unchanged.

Tests

New build-metadata-prompt.test.ts (5 cases):

  1. reads overrides from the resolved git repo root
  2. falls back to cwd when resolveRepoRoot throws (non-git) — the core fix
  3. reads overrides from cwd when no git resolver is injected
  4. uses default style when no paseo.json exists
  5. uses default style when paseo.json is invalid JSON

Verification

  • oxlint / oxfmt on changed files — clean
  • server tsgo -p tsconfig.server.typecheck.json --noEmit — clean
  • vitest run src/utils/build-metadata-prompt.test.ts — 5/5 passed
  • existing git-metadata-generator.test.ts unaffected (its resolver mock returns a path instead of throwing)

lzm04521 added 2 commits July 30, 2026 22:49
resolveRepoRoot throws in non-git directories, so buildMetadataPrompt's
override reader swallowed the error and non-git workspaces always fell
back to the default English title style, ignoring
metadataGeneration.title.instructions in their paseo.json.

Fall back to the workspace cwd when resolveRepoRoot throws or no git
resolver is injected. For a non-git workspace the cwd is the project
root by definition, so parent-directory walking is intentionally out of
scope. The shared reader also backs the commit-message and PR-text
generators, so they get the same fix.

Adds build-metadata-prompt.test.ts covering the git repo root path,
both non-git fallbacks (resolver throws and no resolver), missing
paseo.json, and invalid JSON.
Comment on lines +69 to +72
return await options.workspaceGitService.resolveRepoRoot(options.cwd);
} catch {
// Non-git directory — fall back to the workspace cwd below.
}

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.

P2 Broad resolver error fallback

The unqualified catch treats every resolveRepoRoot failure as a non-Git workspace, so operational resolution errors silently switch configuration lookup to cwd and can apply nested or default metadata instructions instead of the repository-root configuration.

Rule Used: # Code Review Pattern Reference: Slop, Tests, Feat... (source)

@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR enables metadata-generation overrides in non-Git workspaces.

  • Resolves the configuration directory through the Git repository root when available.
  • Falls back to the supplied workspace cwd when repository resolution fails or no resolver is provided.
  • Adds tests for Git-root lookup, non-Git and resolver-less fallbacks, missing configuration, and invalid JSON.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking concern that unexpected repository-resolution failures can silently select the cwd configuration.

The intended non-Git fallback is covered and preserves default behavior, but its unqualified catch changes configuration precedence for every resolver rejection rather than only the expected non-Git condition.

Files Needing Attention: packages/server/src/utils/build-metadata-prompt.ts

Important Files Changed

Filename Overview
packages/server/src/utils/build-metadata-prompt.ts Adds cwd fallback for metadata configuration lookup, but the broad resolver catch also treats unrelated operational failures as non-Git workspaces.
packages/server/src/utils/build-metadata-prompt.test.ts Adds focused interface-level coverage for the intended lookup and fallback behavior.

Reviews (1): Last reviewed commit: "Merge branch 'main' into fix/non-git-met..." | Re-trigger Greptile

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