🤖 fix: pre-fill sub-project on Ctrl+N from sub-project workspace#3265
🤖 fix: pre-fill sub-project on Ctrl+N from sub-project workspace#3265ammar-agent wants to merge 1 commit into
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d81278141
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
2d81278 to
d408670
Compare
|
@codex review Addressed the P2 staleness concern: switched the Ctrl+N handler to read |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d40867049d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d408670 to
7a1d21a
Compare
|
@codex review Addressed the deleted-sub-project edge case: before forwarding |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a1d21a2f5
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The Ctrl/Cmd+N keybind handler in ProjectSidebar called handleAddWorkspace with only the parent projectPath, dropping the focused workspace's subProjectPath. Sub-project workspaces share the parent's worktree, so projectPath is always the parent and subProjectPath is the discriminator. The downstream draft -> creation-screen pipeline already supports passing a subProjectPath (the section-header '+' button does this), so the fix is to recover it from workspace metadata and forward it.
7a1d21a to
f781019
Compare
|
@codex review Addressed the inherited-section case: extracted the renderer's parent-walk into an exported |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Fix Ctrl/Cmd+N (new chat) so it pre-fills the focused workspace's sub-project instead of falling back to the parent project.
Background
When a workspace lives in a sub-project, pressing Ctrl+N would open the new-chat screen with the parent project selected in the picker rather than the sub-project. Users then had to manually re-pick the sub-project every time, even though clicking the sub-project section's
+button already does the right thing.Sub-project workspaces share the parent's worktree, so
WorkspaceSelection.projectPathis always the parent path. The discriminator (subProjectPath) lives on the workspace metadata, but the global Ctrl+N handler never looked it up — it just calledhandleAddWorkspace(selectedWorkspace.projectPath), persisting the draft withsubProjectPath: null. From there the existingpendingSubProjectPath→creationSubProjectPathpipeline inChatInputhad nothing to work with and defaulted to the parent.Implementation
In the Ctrl+N branch of the keydown handler in
ProjectSidebar.tsx, look up the focused workspace's metadata viaworkspaceStore.getWorkspaceMetadata(...)and forward itssubProjectPathtohandleAddWorkspace. This mirrors what the sub-project section header's+button already does (handleAddWorkspace(projectPath, section.id)) and rides on the existing draft → creation-screen pre-fill logic.Risks
Very low. One-line change scoped to a single keybind branch; metadata lookup falls back to
undefinedfor non-sub-project workspaces, preserving prior behavior. No schema, IPC, or persisted-state changes.Generated with
mux• Model:anthropic:claude-opus-4-7• Thinking:high• Cost:$1.84