Skip to content

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.

Simplify branch counts and expand completed-only PR history (#426)

Deecb73b46537a5
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index 7b90befdc..f2999aa76 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -139,13 +139,15 @@ text and hand cursor as the status symbols. Machine opens the shared picker scop
identity; project opens its harnesses across matching remote checkouts; branch
opens the focused session's branches and PRs when the daemon supplies `gitContext`.
When recent successful work identifies one Git branch, show its name followed
-by the count of other checked-out branches, for example `ship-hn · +3`. The
+by the count of other checked-out branches, for example `ship-hn +3`. The
tooltip explains that this is recent confirmed work and gives its observation
time. Git remains the source of branch names for every engine. When several
branches have equal recent evidence, show the count instead of selecting one.
Details group each branch with its PRs, put recent work and open PRs first, and
-fold completed work behind one action. Show a shared repository once, align PR
+fold completed work behind one action when other PRs need attention. If every
+recorded PR is completed, expand the history by default. Keep a user's explicit
+expand/collapse choice through refreshes. Show a shared repository once, align PR
states on the right, and keep head/base names and check times in inspection
details. Size the dialog to its contents with bounded scrolling. Escape returns
focus to the terminal.
diff --git a/desktop/lib/core/agent_git_context.dart b/desktop/lib/core/agent_git_context.dart
index 60936ce9c..e0d9c1a25 100644
--- a/desktop/lib/core/agent_git_context.dart
+++ b/desktop/lib/core/agent_git_context.dart
@@ -134,7 +134,7 @@ class AgentGitContext {
String? get branchLabel {
final checked = branchRows.where((row) => row.checkedOut).toList();
if (recentWork?.shownBranch case final branch?) {
- return checked.length > 1 ? '$branch · +${checked.length - 1}' : branch;
+ return checked.length > 1 ? '$branch +${checked.length - 1}' : branch;
}
if (checked.length > 1) return '${checked.length} branches';
if (checked.length == 1) return checked.single.branch;
diff --git a/desktop/lib/widgets/session_work_dialog.dart b/desktop/lib/widgets/session_work_dialog.dart
index a72b01de2..844d6e74c 100644
--- a/desktop/lib/widgets/session_work_dialog.dart
+++ b/desktop/lib/widgets/session_work_dialog.dart
@@ -33,7 +33,8 @@ class SessionWorkDialog extends StatefulWidget {
class _SessionWorkDialogState extends State<SessionWorkDialog> {
AgentGitContext? _data;
- bool _loading = false, _showCompleted = false;
+ bool _loading = false;
+ bool? _showCompleted;
String? _error;
int? _nextOffset;
int _revision = 0, _visiblePrs = 4;
@@ -158,6 +159,8 @@ class _SessionWorkDialogState extends State<SessionWorkDialog> {
prs.sort(comparePrs);
bool completed(AgentWorkPr pr) =>
pr.state == 'Merged' || pr.state == 'Closed';
+ final showCompleted =
+ _showCompleted ?? (prs.isNotEmpty && prs.every(completed));
final recentUrls = branches
.where((b) => data?.isRecentBranch(b) == true)
.expand((b) => b.pullRequests.map((pr) => pr.url))
@@ -184,7 +187,7 @@ class _SessionWorkDialogState extends State<SessionWorkDialog> {
.toList();
final visibleUrls = {
...ongoingPrs.take(_visiblePrs).map((pr) => pr.url),
- if (_showCompleted)
+ if (showCompleted)
...completedPrs.take(_visiblePrs).map((pr) => pr.url),
};
final groupedUrls = branches
@@ -440,17 +443,16 @@ class _SessionWorkDialogState extends State<SessionWorkDialog> {
alignment: Alignment.centerLeft,
child: TerminalTextAction(
key: const ValueKey('work-completed'),
- label: _showCompleted
+ label: showCompleted
? 'Hide completed'
: 'Completed ($completedCount)',
padding: EdgeInsets.zero,
- onPressed: () => setState(
- () => _showCompleted = !_showCompleted,
- ),
+ onPressed: () =>
+ setState(() => _showCompleted = !showCompleted),
),
),
);
- if (_showCompleted) {
+ if (showCompleted) {
for (final branch in branches.where(completedBranch)) {
addBranch(branch);
}
@@ -475,7 +477,7 @@ class _SessionWorkDialogState extends State<SessionWorkDialog> {
}
if (_nextOffset != null ||
ongoingPrs.length > _visiblePrs ||
- _showCompleted && completedPrs.length > _visiblePrs) {
+ showCompleted && completedPrs.length > _visiblePrs) {
separate();
rows.add(
Align(
diff --git a/desktop/test/session_git_context_test.dart b/desktop/test/session_git_context_test.dart
index f335d4c96..853103cef 100644
--- a/desktop/test/session_git_context_test.dart
+++ b/desktop/test/session_git_context_test.dart
@@ -103,7 +103,7 @@ void main() {
];
fixture['recentWork'] = {'project': recent, 'at': '2026-09-27T13:00:00Z'};
final context = AgentGitContext.fromJson(fixture)!;
- expect(context.branchLabel, 'hn/preview-fix · +1');
+ expect(context.branchLabel, 'hn/preview-fix +1');
expect(context.displayProject(null)?.branch, 'hn/preview-fix');
expect(context.requestIdentity?['cwd'], '/ship-hn');
expect(
diff --git a/desktop/test/session_work_dialog_test.dart b/desktop/test/session_work_dialog_test.dart
index 9391c1322..7028f259e 100644
--- a/desktop/test/session_work_dialog_test.dart
+++ b/desktop/test/session_work_dialog_test.dart
@@ -160,6 +160,41 @@ void main() {
},
);
+ testWidgets(
+ 'completed-only history starts expanded and respects a choice after refresh',
+ (tester) async {
+ final git = gitFixture();
+ git['history']['pullRequests'][0]['result'].addAll({
+ 'state': 'Merged',
+ 'headBranch': 'hn/preview-fix',
+ });
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SessionWorkDialog(
+ agent: workAgent(git: git),
+ read: (_) async => {'gitContext': git, 'history': git['history']},
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(find.text('#12'), findsOneWidget);
+ expect(find.text('[ Hide completed ]'), findsOneWidget);
+ await tester.tap(find.byKey(const ValueKey('work-completed')));
+ await tester.pumpAndSettle();
+ expect(find.text('#12'), findsNothing);
+ await tester.tap(find.text('[ Refresh ]'));
+ await tester.pumpAndSettle();
+ expect(find.text('#12'), findsNothing);
+ expect(find.text('[ Completed (1) ]'), findsOneWidget);
+ await tester.tap(find.byKey(const ValueKey('work-completed')));
+ await tester.pumpAndSettle();
+ expect(find.text('#12'), findsOneWidget);
+ expect(tester.takeException(), isNull);
+ },
+ );
+
testWidgets(
'completed history remains reachable beside a full open PR page',
(tester) async {
diff --git a/desktop/test/session_work_navigation_test.dart b/desktop/test/session_work_navigation_test.dart
index fa9a451a7..2d5451a63 100644
--- a/desktop/test/session_work_navigation_test.dart
+++ b/desktop/test/session_work_navigation_test.dart
@@ -58,10 +58,7 @@ void main() {
final pane = app.adoptSessionForTest(terminal('hn', input));
final session = pane.session;
await mount(tester, app, nativeTabs: native);
- expect(
- WorkspacePaneContext.focused(app)?.branch,
- 'hn/preview-fix · +1',
- );
+ expect(WorkspacePaneContext.focused(app)?.branch, 'hn/preview-fix +1');
if (native) {
final fields =
((updates.last['focusedContext'] as Map)['fields'] as List)
diff --git a/docs/worktree-pull-requests.md b/docs/worktree-pull-requests.md
index d33a9801a..a2300c828 100644
--- a/docs/worktree-pull-requests.md
+++ b/docs/worktree-pull-requests.md
@@ -8,7 +8,7 @@ for locating code, not user-facing identities.
The focused bar shows the branch at the most recent confirmed Git work location,
plus its matching PR link when there is one. Other checked-out branches appear
-as a compact count, for example `ship-hn · +3`. This is recent work, not a claim
+as a compact count, for example `ship-hn +3`. This is recent work, not a claim
that an agent is executing there now. Hovering explains the observation time.
Without a unique recent location, one checked-out branch appears by name and
multiple branches appear as `2 branches` (or the corresponding count). Historical
@@ -17,8 +17,10 @@ branches do not increase this count. A dependent viewer uses its owner's context
Click the branch, or use **Branches and pull requests** in the desktop command
picker. Each branch appears once, with its PR links, titles and GitHub states
directly beneath it. Recent work leads, followed by branches with open or draft
-PRs. Completed work folds into **Completed**, except PRs on the recent work
-branch, whose state remains visible. The repository appears once when shared.
+PRs. Completed work folds into **Completed** while other PRs need attention;
+when all recorded PRs are completed, history starts expanded. An explicit
+expand/collapse choice persists through refreshes. PRs on the recent work
+branch always remain visible. The repository appears once when shared.
Hover or accessibility inspection exposes full titles, head/base branches and
GitHub check times. Short lists fit their content; long lists scroll within a
bounded dialog. Temporary folder names and subdirectory lists are not shown.