fix: apply paseo.json title overrides in non-git workspaces - #2666
fix: apply paseo.json title overrides in non-git workspaces#2666lzm04521 wants to merge 2 commits into
Conversation
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.
| return await options.workspaceGitService.resolveRepoRoot(options.cwd); | ||
| } catch { | ||
| // Non-git directory — fall back to the workspace cwd below. | ||
| } |
There was a problem hiding this comment.
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)
|
| 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
Problem
In a non-git workspace, the auto-generated session title ignores
metadataGeneration.title.instructionsfrompaseo.jsonand always uses the default English title style.Root cause
buildMetadataPromptreads project overrides viaresolveRepoRoot(cwd)→readPaseoConfigJson(repoRoot).resolveRepoRootthrows"Create worktree requires a git repository"for non-git directories (workspace-git-service.ts:680), and the surroundingtry/catchswallowed that as "no override" — so non-git workspaces never read theirpaseo.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: whenresolveRepoRootthrows (non-git) or no git resolver is injected, fall back tooptions.cwd. For a non-git workspace the cwd is the project root by definition, so the override is read from<cwd>/paseo.json.resolveRepoRootitself is untouched (its "throw on non-git" semantics are relied on byworktree-core,codex-app-server-agent, etc.).codex-app-server-agent.tsdoesresolveRepoRoot(cwd).catch(() => null)).paseo.jsonstill yields the default style — unchanged.Tests
New
build-metadata-prompt.test.ts(5 cases):resolveRepoRootthrows (non-git) — the core fixpaseo.jsonexistspaseo.jsonis invalid JSONVerification
oxlint/oxfmton changed files — cleantsgo -p tsconfig.server.typecheck.json --noEmit— cleanvitest run src/utils/build-metadata-prompt.test.ts— 5/5 passedgit-metadata-generator.test.tsunaffected (its resolver mock returns a path instead of throwing)