The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(desktop): a pane on no branch shows just its folder (#214)
Dee6b6482e9fcdf
diff --git a/desktop/design/new-harness-entry-rules.md b/desktop/design/new-harness-entry-rules.mdindex 6f86fc87a..3c6262370 100644--- a/desktop/design/new-harness-entry-rules.md+++ b/desktop/design/new-harness-entry-rules.md@@ -43,8 +43,10 @@ folder it was started in and its repository's branch. Pane headers read`folder › branch`, with the machine first only for another computer: the folderthe harness started in (a subfolder as itself, a checkout's root — aworktree's too — as its repository), which does not follow the agent's shell,-and the branch with the same icon everywhere. Worktree folders are never shown;-the header's tooltip has the full path. Cut short, the folder shortens in the+and the branch with the same icon everywhere. A checkout on no branch — a+commit an agent checked out to read or test — shows no branch; the tooltip says+`No branch: on commit 65281563`. Worktree folders are never shown; the header's+tooltip has the full path. Cut short, the folder shortens in themiddle before the branch does. A folder inside a linkedworktree (the focused pane's, or one typed or browsed) shows as the same folderin the repository's main checkout, so Cmd-N from a worktree pane starts besidediff --git a/desktop/lib/core/local_git_projects.dart b/desktop/lib/core/local_git_projects.dartindex b4cb08929..f2e86bcd6 100644--- a/desktop/lib/core/local_git_projects.dart+++ b/desktop/lib/core/local_git_projects.dart@@ -118,7 +118,7 @@ class LocalGitProjects {final branch = head?.startsWith('ref: refs/heads/') == true? head!.substring(16): head != null && RegExp(r'^[a-fA-F0-9]{40,64}$').hasMatch(head)- ? 'Detached ${head.substring(0, 7)}'+ ? '$kDetachedBranchPrefix${head.substring(0, 7)}': null;final project = AgentProject.fromJson({// A linked worktree is named for its repository, not its folder.diff --git a/desktop/lib/core/models.dart b/desktop/lib/core/models.dartindex 11322d881..372894ae5 100644--- a/desktop/lib/core/models.dart+++ b/desktop/lib/core/models.dart@@ -773,6 +773,10 @@ class RouteCandidate {String _str(Object? value) => value is String ? value : '';+/// How a checkout on no branch reports itself, `Detached 65281563`: the+/// daemon (cli/src/lib/agentProject.ts) and [LocalGitProjects] both say so.+const kDetachedBranchPrefix = 'Detached ';+/// Context reported by the owning daemon. Missing on older daemons.class AgentProject {const AgentProject({@@ -813,6 +817,20 @@ class AgentProject {name;}+ /// On a commit rather than a branch: an agent reading or testing one.+ bool get detached => branch?.startsWith(kDetachedBranchPrefix) == true;++ /// The branch worth showing beside the folder: none while Harness's made-up+ /// name waits for the session's, and none on no branch at all.+ String? get shownBranch => branchPending || detached ? null : branch;++ /// The branch as a tooltip says it.+ String? get branchDetail => branch == null+ ? null+ : detached+ ? 'No branch: on commit ${branch!.substring(kDetachedBranchPrefix.length)}'+ : 'Branch: $branch';+String identity(String machineId) =>remote != null ? 'repo:$remote' : 'folder:$machineId:${root ?? cwd}';diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dartindex b17686831..d062cbd3b 100644--- a/desktop/lib/state/swarm_navigation.dart+++ b/desktop/lib/state/swarm_navigation.dart@@ -655,7 +655,7 @@ class SwarmLocationCatalog {harness: label,machine: machineLabel,project: project?.label,- branch: project?.branchPending == true ? null : project?.branch,+ branch: project?.shownBranch,leading: machine?.nodeOnline == false ? 'Offline' : null,),swarmId: swarm.id,@@ -1195,7 +1195,7 @@ List<SwarmDestination> swarmDestinations(harness: label,machine: machineName,project: project?.label,- branch: project?.branchPending == true ? null : project?.branch,+ branch: project?.shownBranch,leading: machine?.nodeOnline == false ? 'Offline' : null,),swarmId: owner?.id,diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex c83c38eb9..9133c6e10 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -1890,7 +1890,7 @@ class _TerminalHeader extends StatelessWidget {session.agentName,machineName,if (project != null) project.cwd,- if (project?.branch != null) 'Branch: ${project!.branch}',+ ?project?.branchDetail,if (profile != null) 'Codex profile: $profile','Double-click to rename',].join('\n');@@ -2145,8 +2145,7 @@ class _TerminalHeader extends StatelessWidget {if (forkedFrom != null)'Forked from ${forkedFrom.name}',if (project != null) project.cwd,- if (project?.branch?.isNotEmpty == true)- 'Branch: ${project!.branch}',+ ?project?.branchDetail,machineName,].join('\n'),child: PromptContextView(@@ -2158,11 +2157,9 @@ class _TerminalHeader extends StatelessWidget {// The folder as it was chosen and its repository's branch;// the full working folder is in the tooltip.project: narrow ? null : project?.label,- // Waiting for the session's name, a branch Harness made- // up at Start is not worth reading.- branch: narrow || project?.branchPending == true- ? null- : project?.branch,+ // Not a branch Harness made up that waits for the+ // session's name, nor a commit an agent checked out.+ branch: narrow ? null : project?.shownBranch,leading: !narrow && forkedFrom != null? 'forked from ${forkedFrom.name}': null,diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dartindex 36fe6df2c..cfa58509d 100644--- a/desktop/test/terminal_panel_presentation_test.dart+++ b/desktop/test/terminal_panel_presentation_test.dart@@ -142,6 +142,36 @@ void main() {findsNothing,reason: 'A made-up branch waits for the session to name it.',);+ app.machineStates['m']!.agents = [+ const Agent(+ id: 'a0',+ name: 'Renamed terminal',+ engine: 'codex',+ terminalAvailable: true,+ project: AgentProject(+ name: 'harness',+ cwd: '/work/harness',+ root: '/work/harness',+ branch: '${kDetachedBranchPrefix}65281563',+ ),+ ),+ ];+ revision.value = 5;+ await tester.pump();+ expect(find.text('harness'), findsOneWidget);+ expect(+ find.textContaining('Detached'),+ findsNothing,+ reason: 'A commit an agent checked out is not a branch to show.',+ );+ expect(+ find.byWidgetPredicate(+ (widget) =>+ widget is Tooltip &&+ (widget.message ?? '').contains('No branch: on commit 65281563'),+ ),+ findsWidgets,+ );revision.value = 2;await tester.pump();expect(find.byTooltip('Zoom Pane'), findsOneWidget);