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): Swarm PR status asks GitHub again once this computer connects (#1857)
0xken153043e870e70d
diff --git a/desktop/lib/super_tabs/pull_requests.dart b/desktop/lib/super_tabs/pull_requests.dartindex bbb7028ca..afd856101 100644--- a/desktop/lib/super_tabs/pull_requests.dart+++ b/desktop/lib/super_tabs/pull_requests.dart@@ -76,6 +76,9 @@ class _SuperTabPullRequestsState extends State<SuperTabPullRequests> {final _legacy = <String, PullRequestStatus>{};bool _all = false, _loading = false, _showMerged = false, _closed = false;bool _unsupported = false, _tickers = true;+ // This computer's GitHub was not reachable yet, as when a restored Swarm+ // reads before the computer connects: unlike the other codes, it passes.+ bool _localUnavailable = false;String? _scope, _error;String _linksKey = '';DateTime? _checkedAt;@@ -232,9 +235,10 @@ class _SuperTabPullRequestsState extends State<SuperTabPullRequests> {final urls = links.keys.where((url) => _entries[url]?.finalState != true).toList();- if (!_unsupported && urls.isNotEmpty) {+ if ((!_unsupported || _localUnavailable) && urls.isNotEmpty) {final values = <String, SuperTabPullRequestEntry>{};String? error;+ var unsupported = false;for (var i = 0; i < urls.length; i += 50) {final answer =await (widget.read ?? widget.app?.readPullRequestsStatus)?.call(@@ -248,7 +252,8 @@ class _SuperTabPullRequestsState extends State<SuperTabPullRequests> {'OWNER_REQUIRED','LOCAL_GITHUB_UNAVAILABLE',].contains(answer['error'])) {- _unsupported = true;+ unsupported = true;+ _localUnavailable = answer['error'] == 'LOCAL_GITHUB_UNAVAILABLE';break;}if (answer['error'] is String) error ??= answer['error'];@@ -264,6 +269,7 @@ class _SuperTabPullRequestsState extends State<SuperTabPullRequests> {}}}+ _unsupported = unsupported;if (error == 'GH_MISSING' || error == 'GH_SIGNED_OUT') {// A changed login must not leave yesterday's private titles under today's account._entries.clear();diff --git a/desktop/test/super_tab_pull_requests_test.dart b/desktop/test/super_tab_pull_requests_test.dartindex dbe7b47a7..dea3baee3 100644--- a/desktop/test/super_tab_pull_requests_test.dart+++ b/desktop/test/super_tab_pull_requests_test.dart@@ -362,6 +362,38 @@ void main() {},);}+ testWidgets('local GitHub unavailable is retried', (tester) async {+ var reads = 0;+ await mount(tester, prServer([1]), (_) async {+ reads++;+ return reads == 1+ ? {'error': 'LOCAL_GITHUB_UNAVAILABLE'}+ : {+ 'rows': [prRow(1)],+ };+ });+ expect(find.textContaining('View status on GitHub'), findsOneWidget);+ // This computer connects; the next minute's refresh asks GitHub again.+ await tester.pump(const Duration(seconds: 60));+ await tester.pumpAndSettle();+ expect(reads, 2);+ expect(find.text('Pull request 1'), findsOneWidget);+ expect(find.textContaining('View status on GitHub'), findsNothing);+ await tester.pumpWidget(const SizedBox());+ });+ testWidgets('a computer that cannot read PR status is not asked again', (+ tester,+ ) async {+ var reads = 0;+ await mount(tester, prServer([1]), (_) async {+ reads++;+ return {'error': 'UNSUPPORTED'};+ });+ await tester.pump(const Duration(seconds: 60));+ await tester.pumpAndSettle();+ expect(reads, 1);+ await tester.pumpWidget(const SizedBox());+ });testWidgets('refreshes only open PRs every minute and stops when the pane is hidden',(tester) async {