Skip to content

🤖 feat: seamless fork semantics#2295

Merged
ammario merged 29 commits intomainfrom
fork-1z8m
Feb 17, 2026
Merged

🤖 feat: seamless fork semantics#2295
ammario merged 29 commits intomainfrom
fork-1z8m

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Feb 9, 2026

Summary

This PR delivers seamless fork semantics, robust workspace title regeneration, and backend-authoritative gateway model routing. Forking now auto-generates deterministic numbered names/titles, title regeneration is deduped and correctly tracked per workspace, and gateway users no longer rely on frontend model-string rewriting.

Background

Two sources of friction were addressed:

  1. Fork flow ergonomics: users had to manage naming edge cases manually.
  2. Gateway routing drift: multiple call sites handled routing differently, which caused regressions (including title-generation paths) and frontend workarounds.

Codex review also surfaced correctness issues around suffix parsing, stale-branch collisions, command routing consistency, and assistant-context selection for title regeneration.

Implementation

Fork semantics and collision handling

  • Added deterministic suffix helpers for forks and titles.
  • Hardened title suffix parsing to ignore malformed numeric suffixes.
  • Included local branch names in auto-fork collision checks (not just metadata) to avoid stale-branch reuse.
  • Reduced fork session-copy duplication via copyIfExists helper.

Title regeneration correctness

  • Added workspace.regenerateTitle path hardening to use the first assistant reply after the first user message as context.
  • Added dedupe guard for concurrent regeneration requests.
  • Switched loading state from single workspace id to a set of in-flight workspace ids.
  • Ensured synchronous throws in regenerate callbacks still clear in-flight state.

Command/UI routing consistency

  • Centralized generate-title triggering through a typed custom event (WORKSPACE_GENERATE_TITLE_REQUESTED) and a shared sidebar handler.
  • Hid “Generate New Title” command for Chat-with-Mux workspace where unsupported.

Gateway routing centralization

  • ProviderModelFactory.createModel() resolves gateway routing internally (idempotent).
  • Removed duplicated/manual gateway resolution call paths.
  • Simplified name-generation candidate construction and aligned comments/docs with backend-authoritative routing.

Validation

  • Local: make static-check passed.
  • Local targeted suites passed, including:
    • src/node/services/workspaceService.test.ts
    • src/node/services/providerModelFactory.test.ts
    • src/browser/contexts/WorkspaceTitleEditContext.test.tsx
    • src/browser/utils/commands/sources.test.ts
  • PR checks: all required CI checks are green.
  • Codex review: no unresolved comments/threads.

Risks

  • Low-to-moderate risk in workspace naming/title generation paths due to broad call-site touchpoints.
  • Mitigated by helper-level tests, service-level tests, command routing tests, and full static check/CI pass.

Generated with mux • Model: openai:gpt-5.3-codex • Thinking: low • Cost: $59.78

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: 6b5afd6282

ℹ️ 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".

@ammar-agent ammar-agent force-pushed the fork-1z8m branch 3 times, most recently from f46c527 to 90aac9c Compare February 12, 2026 15:04
@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: 1c8e91ffbe

ℹ️ 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".

@ammar-agent ammar-agent force-pushed the fork-1z8m branch 2 times, most recently from 917c32f to 61b3388 Compare February 15, 2026 23:03
@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: a753f4b509

ℹ️ 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".

@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: 8f43c39eb5

ℹ️ 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".

@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: 7b2fa90644

ℹ️ 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".

@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: 2960a16bb5

ℹ️ 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".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the latest two comments:

  • gated sidebar F2 title-edit keybind handling to expanded sidebar state
  • added explicit rejection handling in title-regeneration wrapper

Also completed integration-test stabilization work and verified locally with:

  • make test-integration
  • make static-check

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: 30a41c8cd7

ℹ️ 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".

…ation

- Schema: add autoName flag to WorkspaceMetadata and WorkspaceConfig
- Backend: auto-generate fork branch names ({parent}-fork-N pattern)
  when /fork is used without an explicit name
- Backend: clear autoName flag on any title update (manual rename or
  auto-generated) to exit the provisional naming state
- Frontend: simplify /fork command - bare /fork works, everything after
  is treated as a start message
- Frontend: auto-name on first message via nameGeneration IPC
  (fire-and-forget, reuses existing LLM title generation pipeline)
- Frontend: italic styling in sidebar for auto-name workspaces
- Remove fork-help toast (no longer needed since bare /fork works)
- Tests: update fork command tests, add generateForkBranchName unit tests
Move the auto-naming trigger from ChatInput (frontend) to
WorkspaceService.sendMessage (backend), fixing three issues:

1. Eliminates duplicate candidate-building logic that was missing
   gateway model transforms (bug)
2. Includes prior assistant message from forked history for richer
   title generation context
3. Colocates the trigger with existing fire-and-forget side effects
   (updateRecencyTimestamp pattern)

Changes:
- Add autoGenerateTitle() private method to WorkspaceService
- Trigger from sendMessage after recency timestamp update
- Add assistantContext param to generateWorkspaceIdentity prompt
- Remove auto-naming block, refs, and imports from ChatInput
- Un-export NAME_GEN_PREFERRED_MODELS (now module-private)
- Add RENAME_WORKSPACE and REGENERATE_WORKSPACE_NAME to keybinds registry
- Add workspace.regenerateTitle backend endpoint (reads first user message +
  assistant reply from history, calls generateWorkspaceIdentity, persists via
  updateTitle)
- Add SidebarRenameKeybinds component inside RenameProvider for F2/Shift+F2
  (F2 enters inline edit mode, Shift+F2 calls regenerateTitle API)
- Update WorkspaceListItem context menu: F2 hint on 'Edit chat title',
  new 'Generate new title' item with Shift+F2 hint and Sparkles icon
- Add command palette entries with shortcut hints
- Add keybind labels + navigation group entries in KeybindsSection
All rename/name terminology updated to reflect that this feature is
about workspace *titles*, not workspace names/branches:

Keybinds:
- RENAME_WORKSPACE → EDIT_WORKSPACE_TITLE
- REGENERATE_WORKSPACE_NAME → GENERATE_WORKSPACE_TITLE

Commands:
- ws:rename → ws:edit-title (+ ws:rename-any → ws:edit-title-any)
- ws:regenerate-name → ws:generate-title

Context:
- WorkspaceRenameContext.tsx → WorkspaceTitleEditContext.tsx (git mv)
- RenameProvider → TitleEditProvider, useRename → useTitleEdit
- requestRename/confirmRename/cancelRename → requestEdit/confirmEdit/cancelEdit

WorkspaceContext:
- renameWorkspace → updateWorkspaceTitle
- onRenameWorkspace → onUpdateTitle (command palette sources + App.tsx)

Schema:
- autoName → autoTitle (project + workspace schemas, workspaceService)

UI strings updated: 'Rename Workspace' → 'Edit Workspace Title',
field labels from 'name' to 'title', initial values from .name to .title
When Shift+F2 or 'Generate new title' triggers regenerateTitle, the
sidebar title now shimmers (using the existing Shimmer component) and
renders in italic — matching the autoTitle placeholder style.

TitleEditContext gains generatingTitleWorkspaceId state and a
wrapGenerateTitle(workspaceId, asyncFn) helper that manages the
loading lifecycle. Both call sites (keybind handler in ProjectSidebar,
context menu in WorkspaceListItem) use the wrapper so the loading
state is consistent regardless of entry point.
Replace the lazy AI title generation on fork with a simple numbered
suffix: forking "Fix sidebar" produces "Fix sidebar (1)", then
"Fix sidebar (2)", etc. The suffix logic strips any existing "(N)"
from the parent title before incrementing, so forking "Fix sidebar (2)"
yields "Fix sidebar (3)" — not "Fix sidebar (2) (1)".

Removed:
- autoTitle field from project + workspace schemas
- autoGenerateTitle() method in WorkspaceService
- sendMessage trigger that called autoGenerateTitle on first message
- autoTitle clearing in updateTitle
- Italic styling for autoTitle in WorkspaceListItem

Users can still manually generate a new AI title any time via Shift+F2
or the context menu "Generate new title" action.

Added:
- generateForkTitle() helper (+ 5 unit tests)
Move gateway resolution from scattered call sites into
ProviderModelFactory.createModel(), so every model instantiation
automatically routes through the gateway when configured.

Changes:
- createModel now calls resolveGatewayModelString (idempotent)
- Remove manual gateway resolution from system1ToolWrapper
- Remove resolveGatewayModelString from AIService public API
- Simplify frontend buildNameGenCandidates (no gateway transform needed)
- Extract NAME_GEN_PREFERRED_MODELS to shared constant
- Update schema/router comments to reflect new behavior
@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: 1dc552bb90

ℹ️ 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".

@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: e8a7fd2601

ℹ️ 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".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the fork title suffix parsing feedback:

  • generateForkTitle now only counts fully numeric suffixes.
  • Added regression coverage for non-numeric/partially-numeric suffixes.

Please re-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: 0e4d4cf2b6

ℹ️ 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".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed latest comments:

  • generateForkTitle now only increments on fully numeric suffixes.
  • wrapGenerateTitle now dedupes concurrent regenerations per workspace.
  • Added targeted tests for both behaviors.

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: b3bf6996c7

ℹ️ 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".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed loading-state concurrency for title regeneration:

  • WorkspaceTitleEditContext now tracks a set of in-flight workspace IDs.
  • Duplicate requests are still deduped per workspace.
  • Added tests covering duplicate requests and parallel workspace regenerations.

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: de7b75145c

ℹ️ 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".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed latest review items:

  • Command-palette title generation now dispatches a shared regenerate-title event handled by WorkspaceTitleEditContext via wrapGenerateTitle (shared dedupe/loading path).
  • wrapGenerateTitle now wraps callback invocation in Promise.resolve().then(...) so synchronous throws are caught and cleanup always runs.
  • Added/updated tests for event dispatch and sync-throw recovery.

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: cb9acc5a7a

ℹ️ 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".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed latest comments:

  • Auto-fork naming now preflights local git branches (not just metadata names) to avoid stale-branch reuse collisions.
  • Command palette no longer shows "Generate New Title" for Chat with Mux.

All local checks and targeted tests are green.

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: e457ebc1e6

ℹ️ 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".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed assistant-context ordering in regenerateTitle:

  • Assistant context is now selected as the first assistant message after the first user message.
  • Added regression coverage for compacted-summary-first histories.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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".

@ammario ammario merged commit 67a72a1 into main Feb 17, 2026
23 checks passed
@ammario ammario deleted the fork-1z8m branch February 17, 2026 01:20
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.

2 participants