Conversation
The New Chat picker collapsed same-repo copies onto the selected chat's environment. Clicking that row while a remote was reconnecting waited forever on t3.json. List every checkout (including same-environment worktrees), skip the file read unless the target is connected, retarget to a reachable sibling when one exists, and toast when the only copy is down. Fixes pingdotgg#12093
| candidate.id === requestedProjectRef.projectId && | ||
| candidate.environmentId === requestedProjectRef.environmentId, | ||
| ); | ||
| const requestedLogicalProjectKey = requestedProject |
There was a problem hiding this comment.
🟠 High hooks/useHandleNewThread.ts:104
When the requested project has a stale or missing repositoryIdentity, New Chat reports Environment unavailable even though a reachable sibling for the same repository exists. requestedLogicalProjectKey falls back to the requested project's physical key, while the filter at lines 110–113 derives the sibling's repository key independently, so no sibling reaches resolveAvailableNewThreadProjectRef; use the existing physical-to-logical key map for this lookup instead of deriving the keys independently.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/hooks/useHandleNewThread.ts around line 104:
When the requested project has a stale or missing `repositoryIdentity`, New Chat reports `Environment unavailable` even though a reachable sibling for the same repository exists. `requestedLogicalProjectKey` falls back to the requested project's physical key, while the filter at lines 110–113 derives the sibling's repository key independently, so no sibling reaches `resolveAvailableNewThreadProjectRef`; use the existing physical-to-logical key map for this lookup instead of deriving the keys independently.
| const currentEntry = | ||
| input.entries.find((entry) => | ||
| projectRefsMatch( | ||
| { environmentId: entry.targetProject.environmentId, projectId: entry.targetProject.id }, | ||
| currentProjectRef, | ||
| ), | ||
| ) ?? null; |
There was a problem hiding this comment.
🟡 Medium src/sidebarProjectGrouping.ts:255
resolveNewThreadPickerFocusEntry returns null for a valid current thread when its ref remains in group.memberProjectRefs but its stale physical row was removed from memberProjects. Because currentEntry only matches targetProject, the function never reaches the reachable-sibling fallback, so New Chat loses its initial focus. Match the current ref against the group as a fallback.
- const currentEntry =
- input.entries.find((entry) =>
- projectRefsMatch(
- { environmentId: entry.targetProject.environmentId, projectId: entry.targetProject.id },
- currentProjectRef,
- ),
- ) ?? null;
+ const currentEntry =
+ input.entries.find(
+ (entry) =>
+ projectRefsMatch(
+ { environmentId: entry.targetProject.environmentId, projectId: entry.targetProject.id },
+ currentProjectRef,
+ ) || groupContainsProjectRef(entry.group, currentProjectRef),
+ ) ?? null;🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/sidebarProjectGrouping.ts around lines 255-261:
`resolveNewThreadPickerFocusEntry` returns `null` for a valid current thread when its ref remains in `group.memberProjectRefs` but its stale physical row was removed from `memberProjects`. Because `currentEntry` only matches `targetProject`, the function never reaches the reachable-sibling fallback, so New Chat loses its initial focus. Match the current ref against the group as a fallback.
| contextualRefBelongsToGroup | ||
| ? contextualProjectRef | ||
| : scopeProjectRef(project.environmentId, project.id), | ||
| const environment = environments.find( |
There was a problem hiding this comment.
🟠 High components/CommandPalette.tsx:1331
Selecting an enabled offline row in the expanded new-thread picker shows “Environment unavailable” and does not create a thread, even when the group has a reachable sibling checkout. The guard returns before handleNewThread, which already resolves the requested checkout to a reachable logical-project sibling; remove the guard so the rendered row follows that fallback path.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/CommandPalette.tsx around line 1331:
Selecting an enabled offline row in the expanded new-thread picker shows “Environment unavailable” and does not create a thread, even when the group has a reachable sibling checkout. The guard returns before `handleNewThread`, which already resolves the requested checkout to a reachable logical-project sibling; remove the guard so the rendered row follows that fallback path.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR changes production New Chat routing, picker presentation, connectivity gating, and workspace context across several components rather than making a small isolated fix. Unresolved findings identify concrete cases where reachable-copy fallback or picker focus can fail. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughNew Chat now lists grouped project copies by environment, prioritizes reachable copies, retargets thread creation when needed, clears incompatible workspace options, and reports unavailable environments instead of proceeding silently. ChangesNew Chat reachability
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~30 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant CommandPalette
participant PickerGrouping
participant ThreadHandler
participant Toast
CommandPalette->>PickerGrouping: Build reachable environment-copy entries
PickerGrouping-->>CommandPalette: Return ordered picker entries and focus target
CommandPalette->>ThreadHandler: Start thread for selected project
ThreadHandler->>Toast: Show "Environment unavailable" when no reachable copy exists
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What
Why
Fixes #12093
Redo of closed #12731 addressing Macroscope Not-approved / High: smaller picker fix with same-env worktree regression coverage.
UI
New Chat / project picker: reachable copies listed; same-env worktrees not omitted.
Checklist
Summary by CodeRabbit
New Features
Bug Fixes