Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(working-sidebar): keep Review on web for a topic on its own worktree (#21623)

LiJianf90a92f40bde
diff --git a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
index a49081a5bcc..a8ba4f77c0e 100644
--- a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
@@ -332,6 +332,34 @@ describe('AgentWorkingSidebar β€” controlled panel width', () => {
expect(screen.queryByText('/Users/me/project')).not.toBeInTheDocument();
expect(filesProps.current).toBeUndefined();
});
+
+ it('shows Review on web for a topic worktree the remote device does not list', () => {
+ platform.isDesktop = false;
+ agentStore.activeAgentId = 'agent';
+ effectiveConfig.agencyConfig = { boundDeviceId: 'remote-device', executionTarget: 'device' };
+ // The device's workingDirs track a different worktree, so the lookup misses.
+ reviewState.repoType = undefined;
+ reviewState.workingDirectory = '/repo-feature';
+ chatStore.activeTopicId = 'topic-wt';
+ chatStore.topicDetailMap = {
+ 'topic-wt': {
+ id: 'topic-wt',
+ metadata: {
+ workingDirectoryConfig: {
+ git: { activeWorktree: '/repo-feature', branch: 'feature', isWorktree: true },
+ path: '/repo',
+ repoType: 'github',
+ },
+ },
+ },
+ };
+ globalStore.status.workingSidebarTab = 'works';
+ localStorageState.openTabsByContext = { 'topic:topic-wt': ['works', 'review'] };
+
+ render(<AgentWorkingSidebar />);
+
+ expect(screen.getByRole('button', { name: 'workingPanel.review.title' })).toBeInTheDocument();
+ });
});
describe('Pull request Markdown', () => {
diff --git a/src/features/Conversation/WorkingSidebar/index.tsx b/src/features/Conversation/WorkingSidebar/index.tsx
index 948d9588498..d9b3a8172e0 100644
--- a/src/features/Conversation/WorkingSidebar/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/index.tsx
@@ -311,14 +311,23 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
const targetDeviceId = resolveTargetDeviceId(agencyConfig, currentDeviceId, {
workspaceScoped,
});
- const repoType = useRepoType(workingDirectory, targetDeviceId);
+ const topicWorkingDirectoryConfig = useChatStore(
+ (s) => topicSelectors.currentTopicMetadata(s)?.workingDirectoryConfig,
+ );
+ // A topic on its own worktree matches no device `workingDirs` entry (the
+ // device keeps one `activeWorktree` per repo), and a remote device can't be
+ // probed β€” so fall back to the repoType the topic persisted for that checkout,
+ // or Review disappears on web.
+ const deviceRepoType = useRepoType(workingDirectory, targetDeviceId);
+ const repoType =
+ deviceRepoType ??
+ (getWorkingDirEffectivePath(topicWorkingDirectoryConfig) === workingDirectory
+ ? topicWorkingDirectoryConfig?.repoType
+ : undefined);
// The SOURCE repo, not the checkout β€” same fallback chain as
// WorkingDirectorySection: a persisted-worktree topic has no matching
// `workingDirs` entry, and committing the worktree path as sourcePath would
// rewrite the topic's repo source (see that component's comment).
- const topicWorkingDirectoryConfig = useChatStore(
- (s) => topicSelectors.currentTopicMetadata(s)?.workingDirectoryConfig,
- );
const topicDeviceId = useChatStore((s) => topicSelectors.currentTopicMetadata(s)?.boundDeviceId);
const deviceDirs = useDeviceStore(deviceSelectors.getDeviceWorkingDirs(targetDeviceId));
const sourceWorkingDirectory = useMemo(() => {