Skip to content

Support non-Latin (e.g. Japanese) task titles in branch/worktree names - #2974

Open
aburada-ai wants to merge 1 commit into
generalaction:mainfrom
aburada-ai:support-japanese-task-names
Open

Support non-Latin (e.g. Japanese) task titles in branch/worktree names#2974
aburada-ai wants to merge 1 commit into
generalaction:mainfrom
aburada-ai:support-japanese-task-names

Conversation

@aburada-ai

Copy link
Copy Markdown

Summary

  • Task/branch names are generated via nbranch, which transliterates input to ASCII and drops non-Latin scripts entirely — a Japanese task title collapses to a generic feat-unknown slug instead of preserving any of the original title.
  • Non-Latin titles now bypass nbranch and are slugified directly with a Unicode-aware sanitizer (\p{L}\p{N}- instead of a-z0-9-}), so the original characters (Japanese, etc.) are preserved in the generated branch name and worktree folder name.
  • Applied the same fix to the EMDASH_TASK_NAME env var slugify helper in workspace-env.ts for consistency.

Test plan

  • Added unit tests in generateTaskName.test.ts covering a Japanese title and a Japanese title containing unsafe characters (/, parentheses, spaces).
  • Verified existing ASCII-title test cases are unaffected (regex/logic unchanged for ASCII input path).
  • CI / full test suite (not run locally — pnpm not available in this environment).

nbranch transliterates input to ASCII and drops non-Latin scripts
entirely, so a Japanese task title collapsed to a generic
"feat-unknown" slug. Non-Latin titles now bypass nbranch and are
slugified directly with a Unicode-aware sanitizer (\p{L}\p{N}- instead
of a-z0-9-), preserving the original characters in the branch name and
worktree folder name. Same fix applied to the EMDASH_TASK_NAME env var
slugify helper.
@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds Unicode-aware task and environment-name sanitization and bypasses nbranch for non-ASCII titles.

  • Preserves Japanese letters and numbers in generated task and branch names.
  • Adds focused Japanese-title sanitization tests.
  • Applies the same Unicode allowlist to EMDASH_TASK_NAME.
  • The downstream worktree sanitizer remains ASCII-only, and the allowlist omits combining marks used by several scripts.

Confidence Score: 4/5

The worktree-path collision and combining-mark corruption should be fixed before merging.

Preserved Unicode branch names still collapse under the downstream ASCII-only worktree sanitizer, while the new allowlist corrupts scripts whose letters require combining marks.

Files Needing Attention: apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts, apps/emdash-desktop/src/main/core/workspaces/workspace-env.ts

Important Files Changed

Filename Overview
apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts Preserves Unicode titles, but exposes collisions in downstream worktree paths and strips combining marks from several scripts.
apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.test.ts Covers Japanese characters and punctuation but does not exercise combining-mark scripts or downstream worktree naming.
apps/emdash-desktop/src/main/core/workspaces/workspace-env.ts Makes EMDASH_TASK_NAME Unicode-aware but repeats the combining-mark omission.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Non-Latin task title] --> B[generateTaskName preserves Unicode]
  B --> C[Git branch name]
  C --> D[ASCII-only worktree path sanitizer]
  D --> E[Unicode characters become hyphens]
  B --> F[workspace-env slugify]
  F --> G[EMDASH_TASK_NAME]
Loading
Prompt To Fix All With AI
### Issue 1
apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts:9
**Unicode worktree paths still collide**

When distinct non-Latin task titles reach worktree creation, this sanitizer preserves the Unicode branch names but the downstream ASCII-only worktree sanitizer replaces every non-ASCII character with hyphens, causing different branches to resolve to the same worktree directory.

### Issue 2
apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts:9
**Combining marks are stripped**

When a title uses combining marks, including common Devanagari vowel signs or Arabic diacritics, this allowlist replaces those marks with hyphens because it omits Unicode category `M`, corrupting the generated task name and allowing distinct words to collapse to the same slug.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Support non-Latin task titles in generat..." | Re-trigger Greptile

return raw
.toLowerCase()
.replace(/[^a-z0-9-]/g, '-')
.replace(/[^\p{L}\p{N}-]/gu, '-')

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.

P1 Unicode worktree paths still collide

When distinct non-Latin task titles reach worktree creation, this sanitizer preserves the Unicode branch names but the downstream ASCII-only worktree sanitizer replaces every non-ASCII character with hyphens, causing different branches to resolve to the same worktree directory.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts
Line: 9

Comment:
**Unicode worktree paths still collide**

When distinct non-Latin task titles reach worktree creation, this sanitizer preserves the Unicode branch names but the downstream ASCII-only worktree sanitizer replaces every non-ASCII character with hyphens, causing different branches to resolve to the same worktree directory.

**Context Used:** AGENTS.md ([source](https://github.com/generalaction/emdash/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

return raw
.toLowerCase()
.replace(/[^a-z0-9-]/g, '-')
.replace(/[^\p{L}\p{N}-]/gu, '-')

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.

P1 Combining marks are stripped

When a title uses combining marks, including common Devanagari vowel signs or Arabic diacritics, this allowlist replaces those marks with hyphens because it omits Unicode category M, corrupting the generated task name and allowing distinct words to collapse to the same slug.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts
Line: 9

Comment:
**Combining marks are stripped**

When a title uses combining marks, including common Devanagari vowel signs or Arabic diacritics, this allowlist replaces those marks with hyphens because it omits Unicode category `M`, corrupting the generated task name and allowing distinct words to collapse to the same slug.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

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