Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Jan 23, 2026

Summary

Simplify the fork UX so /fork works without arguments by auto-generating incremented names and titles.

Background

Previously, /fork required specifying a new name, which interrupted workflow when users just wanted to branch off quickly. This change allows /fork to auto-generate an incremented name and title based on the source workspace.

Implementation

Given a workspace with:

  • Name: bugs-asd23
  • Title: Fixing bugs

Running /fork produces:

  • Name: bugs-asd23-2
  • Title: Fixing bugs 2

Subsequent forks continue the sequence (-3, -4, etc.).

Changes:

  • Add forkNameGenerator.ts with parsing and generation logic
  • Add shared workspace naming helpers (WORKSPACE_NAME_MAX_LENGTH, buildWorkspaceNameWithSuffix, resolveWorkspaceName) so create/fork/rename enforce length + collision rules in one place
  • Update fork API schema to make newName optional
  • Update /fork slash command to work without arguments
  • Remove fork-help toast type (no longer needed - empty args triggers auto-generate)
  • Fix config.addWorkspace to persist the title field (was missing, prevented titles from persisting through reload)
  • Add integration tests for auto-increment + collision avoidance

Validation

  • Unit tests for fork name/title parsing + naming helpers
  • Integration tests for fork auto-increment + collision avoidance
  • make static-check

Risks

  • Workspace name resolution now routes create/rename/fork through a shared resolver. A bug here could impact name generation or collision handling across flows. Mitigated by unit coverage for collision + length truncation and integration coverage for fork collision/auto-increment.

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high • Cost: $15.08

@github-actions github-actions bot added the enhancement New feature or functionality label Jan 23, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fe17d7003

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 1499 to 1503
// Auto-generate name and title if not provided
const forkIdentity = newName
? { name: newName, title: undefined }
: generateForkIdentity(sourceMetadata.name, sourceMetadata.title);
const resolvedName = forkIdentity.name;
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved - Fixed in c2ae6dd. Auto-generation now checks existing workspace names and skips to next available suffix.

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c2ae6dd2d3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 91 to 96
export function generateForkNameWithSuffix(sourceName: string, suffix: number): string {
const { base } = parseWorkspaceName(sourceName);
return `${base}-${suffix}`;
}
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved - Centralized name resolution now truncates base names to fit the 64-char limit and checks collisions via resolveWorkspaceName (commit 3f51f81).

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed name length + collision invariants by centralizing workspace name resolution in resolveWorkspaceName (3f51f81).

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f51f81c5d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +21 to +28
export function parseWorkspaceName(name: string): { base: string; suffix: number } {
const match = /^(.+)-(\d+)$/.exec(name);
if (match) {
const [, base, numStr] = match;
const num = parseInt(numStr, 10);
// Only treat as fork suffix if it's >= 2 (fork numbering starts at 2)
if (num >= 2) {
return { base, suffix: num };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid treating any trailing digits as fork suffixes

Because parseWorkspaceName treats any trailing -<digits> (>=2) as an existing fork suffix, auto-forking a workspace whose name naturally ends in numbers (e.g., release-2024) will produce release-2025 instead of release-2024-2. The same logic exists for titles, so Release 2024 becomes Release 2025. This changes the semantic meaning of names/titles and can produce surprising or incorrect results whenever the original name/title legitimately ends with a number. Consider only interpreting numeric suffixes as fork counters when the base name/title exists without the number, or persist a fork counter separately.

Useful? React with 👍 / 👎.

Simplify the fork UX so '/fork' without arguments works by
auto-generating incremented names and titles:

- Original: name 'bugs-asd23', title 'Fixing bugs'
- First fork: name 'bugs-asd23-2', title 'Fixing bugs 2'
- Second fork: name 'bugs-asd23-3', title 'Fixing bugs 3'

Changes:
- Add forkNameGenerator.ts with parsing and generation logic
- Update fork API to make newName optional
- Update /fork slash command to work without arguments
- Remove fork-help toast (no longer needed)
- Fix config.addWorkspace to persist title field
- Add integration tests for auto-increment behavior

Tests: 15 unit tests + 11 integration tests pass
Address Codex review feedback - when forking the same workspace
multiple times without specifying a name, the auto-generation now
checks existing workspace names and skips to the next available suffix.

Example: forking 'bugs-asd23' three times now produces:
- bugs-asd23-2 (first fork)
- bugs-asd23-3 (second fork, skips -2)
- bugs-asd23-4 (third fork, skips -2 and -3)

Added:
- findNextForkSuffix() to scan existing names for collisions
- 6 new unit tests for collision avoidance
- 1 integration test for multiple forks from same source
Move workspace name length/collision rules into shared helpers so
create/rename/fork paths consistently enforce the same constraints:

- Add WORKSPACE_NAME_MAX_LENGTH constant and use in validation + task names
- Add buildWorkspaceNameWithSuffix() for length-safe suffixing
- Add resolveWorkspaceName() with collision strategies (error/random/numeric)
- Update create/rename/fork flows to use resolver and avoid name collisions
- Ensure auto-fork truncates base names to keep within 64-char limit

Tests:
- Added workspaceNaming + workspaceNameResolver unit tests
- Updated forkNameGenerator tests for length handling
- Updated workspaceValidation tests to use shared constant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant