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.

Swarm GitHub access: a quiet setup step, a dialog that says what is allowed, and a screen while GitHub is open

bitcoinbuilder61000335ed6e
diff --git a/backend/integration/superTabGithub.test.ts b/backend/integration/superTabGithub.test.ts
index 48d047dfd..9050ccad9 100644
--- a/backend/integration/superTabGithub.test.ts
+++ b/backend/integration/superTabGithub.test.ts
@@ -336,7 +336,7 @@ describe('a queued start\'s preparation token', () => {
push = true
const done = await env.app.inject({ method: 'GET', url: `/api/github/callback?code=c&state=${encodeURIComponent(state)}` })
expect(done.statusCode).toBe(200)
- expect(done.body).toContain('example/app approved')
+ expect(done.body).toContain('example/app is allowed')
// The page names the project it was approved for (local Team account run, 2026-10-28: 'This project can now use it').
expect(done.body).toContain('Teammates' agents in Pool can now push to it.')
expect(env.approved).toEqual([expect.objectContaining({ tabId: tab, projectId: 'lead', repository: 'example/app', scope: 'project', login: 'olive' })])
@@ -362,7 +362,7 @@ describe('a queued start\'s preparation token', () => {
url: `/api/github/callback?error=access_denied&error_description=The+user+has+denied+your+application+access.&state=${encodeURIComponent(state)}` })
expect(cancelled.statusCode).toBe(200)
expect(cancelled.body).toContain('Sign-in was cancelled')
- expect(cancelled.body).toContain('Nothing was approved. Go back to Harness and choose Approve to try again.')
+ expect(cancelled.body).toContain('Nothing was allowed. Go back to Harness and choose Continue in GitHub to try again.')
expect(cancelled.body).not.toContain('Harness is installed')
expect(env.approved).toEqual([])
})
diff --git a/backend/src/routes/superTabs.ts b/backend/src/routes/superTabs.ts
index fff01d1a2..e02be582a 100644
--- a/backend/src/routes/superTabs.ts
+++ b/backend/src/routes/superTabs.ts
@@ -256,24 +256,25 @@ export async function superTabRoutes(app: FastifyInstance, options: { store?: Su
app.get<{ Querystring: z.infer<typeof callbackQuery> }>('/api/github/callback', { preHandler: validateQuery(callbackQuery) }, async (req, reply) => {
const page = (title: string, text: string, status = 200) => reply.status(status).type('text/html; charset=utf-8').send(githubPage(title, text))
const request = approvalSecret && req.query.state ? readState(approvalSecret, req.query.state, Date.now()) : null
- if (!request) return page('This link has expired', 'Go back to Harness and choose Approve again.', 400)
+ if (!request) return page('This link has expired', 'Go back to Harness and choose Continue in GitHub again.', 400)
const named = githubRepository(`https://github.com/${request.repository}`)
// Cancel on GitHub's sign-in sends the person back with `error` and no code: they were told Harness was installed
// (local Team account run, 2026-10-28).
- if (req.query.error) return page('Sign-in was cancelled', 'Nothing was approved. Go back to Harness and choose Approve to try again.')
+ if (req.query.error) return page('Sign-in was cancelled', 'Nothing was allowed. Go back to Harness and choose Continue in GitHub to try again.')
if (!req.query.code || !signIn || !named) {
- return page('Harness is installed', 'Go back to Harness and choose Approve, so this project can use it.')
+ return page('Harness is installed', 'Go back to Harness and choose Continue in GitHub, so this project can use it.')
}
const seen = await signIn.permission(req.query.code, named).catch(() => null)
- if (!seen) return page('GitHub could not confirm your access', 'Go back to Harness and choose Approve again.', 502)
+ if (!seen) return page('GitHub could not confirm your access', 'Go back to Harness and choose Continue in GitHub again.', 502)
if (!seen.push) {
- return page(`You can't push to ${named.fullName}`, 'So you can\'t approve it for this Swarm. Someone who can push to it can.', 403)
+ return page(`You can't push to ${named.fullName}`, 'So you can\'t allow it. Ask someone who can push to it to open the project in Harness and choose Set up GitHub for teammates.', 403)
}
await approvals.approve(request, seen.login)
// Named, so the person knows which project it was for (local Team account run, 2026-10-28: 'This project can now use it').
const where = request.scope === 'swarm' ? 'every project in this Swarm'
: await store.projectNameFor(request.userId, request.autonomousEnv as AuthUser['autonomousEnv'], request.tabId, request.projectId).catch(() => null) ?? 'this project'
- return page(`${named.fullName} approved`, `Teammates' agents in ${where} can now push to it. You can go back to Harness.`)
+ // Worded as the desktop's GitHub access dialog is (design 2026-10-30): allowed, not approved.
+ return page(`${named.fullName} is allowed`, `Teammates' agents in ${where} can now push to it. You can go back to Harness.`)
})
app.get<{ Params: z.infer<typeof machineParams> }>('/api/super-tabs/:tabId/machines/:machineId/removal', { preHandler: validateParams(machineParams) },
(req, reply) => respond(reply, () => store.machineRemoval(req.user!, req.params.tabId, req.params.machineId)))
diff --git a/desktop/lib/super_tabs/project_github.dart b/desktop/lib/super_tabs/project_github.dart
index a9301c140..c0dc1b1dc 100644
--- a/desktop/lib/super_tabs/project_github.dart
+++ b/desktop/lib/super_tabs/project_github.dart
@@ -46,12 +46,17 @@ class SuperTabProjectGitHub {
/// github/projectAccess.ts): approving is per project, so a second one asks again.
final List<String> approvedFor;
- /// What stops teammates' agents here, in the sidebar's one line; null when nothing does or it cannot be said.
+ /// The sidebar's one line under the project, null when it needs none. Setting up access is a step to take, not a
+ /// fault, so it reads as one (design 2026-10-30: the orange "Teammates can't push here yet" read as an error on a
+ /// Swarm whose owner had done nothing wrong); a repository that is not on GitHub is the one real blocker.
String? get problem => switch (state) {
- 'not-installed' || 'not-approved' => "Teammates can't push here yet",
+ 'not-installed' || 'not-approved' => 'Set up GitHub for teammates',
'not-github' => "Teammates can't work here: not on GitHub",
_ => null,
};
+
+ /// [problem] is a step to take rather than a blocker.
+ bool get setupStep => state == 'not-installed' || state == 'not-approved';
}
/// Names in a sentence: "Notes", "Notes and Docs", "Notes, Docs and Site".
@@ -59,14 +64,16 @@ String _names(List<String> names) => names.length < 2
? names.join()
: '${names.sublist(0, names.length - 1).join(', ')} and ${names.last}';
-/// The project's GitHub access in full, with what to do about it: Project details, and the dialog the sidebar line
-/// opens. Read when shown; [SuperTabController.readGitHubAccess] keeps it at most 5 minutes.
+/// The project's GitHub access in full, with what to do about it: Project details' row, and the dialog the sidebar line
+/// opens ([dialog]). Read when shown; [SuperTabController.readGitHubAccess] keeps it at most 5 minutes.
class ProjectGitHubAccess extends StatefulWidget {
const ProjectGitHubAccess({
super.key,
required this.controller,
required this.projectId,
this.detailRow = false,
+ this.dialog = false,
+ this.projectName,
});
final SuperTabController controller;
@@ -75,6 +82,13 @@ class ProjectGitHubAccess extends StatefulWidget {
/// As a row of Project details: its label in the dialog's label column, rather than a heading above it.
final bool detailRow;
+ /// As the whole dialog the sidebar line opens: a heading and buttons for each state, closing itself
+ /// (design 2026-10-30, "Swarm GitHub access flow").
+ final bool dialog;
+
+ /// The project's name, for the dialog's headings.
+ final String? projectName;
+
@override
State<ProjectGitHubAccess> createState() => _ProjectGitHubAccessState();
}
@@ -83,12 +97,16 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
with WidgetsBindingObserver {
bool _checking = false;
bool _copied = false;
+ bool _askCopied = false;
bool _busy = false;
String? _error;
/// GitHub's page is open in the browser: said here until the person is back and it is read again.
bool _inBrowser = false;
+ /// The page last opened in the browser, for "Open GitHub again".
+ String? _openedLink;
+
@override
void initState() {
super.initState();
@@ -139,7 +157,10 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
listenable: widget.controller,
builder: (context, _) {
final access = widget.controller.githubAccessOf(widget.projectId);
- if (access?.state == 'unavailable') return const SizedBox.shrink();
+ if (access?.state == 'unavailable') {
+ return widget.dialog ? _dialogFor(null) : const SizedBox.shrink();
+ }
+ if (widget.dialog) return _dialogFor(access);
// Read as the dialog opens: said, so the section does not appear from nothing a moment later.
if (access == null) {
return _framed(
@@ -151,37 +172,13 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
);
}
final repository = access.repository ?? 'its repository';
- final text = switch (access.state) {
- 'covered' =>
- "Teammates' agents can push and open pull requests on $repository.",
- 'not-installed' =>
- "Teammates' agents can't push to $repository yet. Install Harness on GitHub there: "
- "an owner of ${repository.split('/').first}, or the repository's owner, can.",
- 'not-approved' =>
- access.canApprove && access.approvedFor.isNotEmpty
- // Approving is per project: one approved for the reader's other projects says so (group #646, item 8).
- ? "Teammates' agents can't use $repository in this project yet. It's approved for "
- '${_names(access.approvedFor)}. Approve it here too?'
- : access.canApprove
- ? "Teammates' agents can't use $repository in this project yet. Someone who can push to it "
- 'approves it, signing in to GitHub.'
- : "Teammates' agents can't use $repository in this project yet. This Harness server can't approve "
- 'repositories yet.',
- 'not-github' => "Teammates' agents can't work on this project: its repository isn't on GitHub.",
- 'no-repository' => 'This project has no repository address yet. Its owner or Lead sets it.',
- 'unread' => "Couldn't check GitHub access just now.",
- _ => "Couldn't reach GitHub to check $repository.",
- };
- final waiting =
- _inBrowser &&
- (access.state == 'not-installed' || access.state == 'not-approved');
- final install = access.installUrl;
- final approve = access.state == 'not-approved' && access.canApprove;
final sentence = Text(
- text,
+ _sentence(access, repository),
key: ValueKey('super-project-github-text-${widget.projectId}'),
style: DesktopChrome.text(),
);
+ final pending =
+ access.state == 'not-installed' || access.state == 'not-approved';
return _framed(
Column(
mainAxisSize: MainAxisSize.min,
@@ -205,30 +202,19 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
)
else
sentence,
- if (waiting)
+ if (_inBrowser && pending)
Padding(
padding: const EdgeInsets.only(top: _halfGap),
child: Text(
- 'Finish on GitHub in your browser. This updates when you come back.',
+ 'Finish in GitHub in your browser. This updates when you come back.',
key: const Key('super-project-github-waiting'),
style: DesktopChrome.text().copyWith(
color: DesktopChrome.muted,
),
),
),
- if (_error != null)
- Padding(
- padding: const EdgeInsets.only(top: _halfGap),
- child: Text(
- _error!,
- key: const Key('super-project-github-error'),
- style: DesktopChrome.text().copyWith(
- color: grid.AppPalette.warn,
- ),
- ),
- ),
- if (access.state == 'not-installed' ||
- access.state == 'not-approved' ||
+ if (_error != null) _errorText(),
+ if (pending ||
access.state == 'unknown' ||
access.state == 'unread')
Padding(
@@ -237,36 +223,9 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
spacing: 8,
runSpacing: 4,
children: [
- if (install != null &&
- access.state == 'not-installed') ...[
- FilledButton(
- key: const Key('super-project-github-install'),
- onPressed: _busy ? null : () => _install(install),
- child: const Text('Install on GitHub'),
- ),
- TextButton(
- key: const Key('super-project-github-copy'),
- onPressed: () async {
- await Clipboard.setData(
- ClipboardData(text: install),
- );
- if (mounted) setState(() => _copied = true);
- },
- child: Text(_copied ? 'Link copied' : 'Copy link'),
- ),
- ],
- if (approve) ...[
- FilledButton(
- key: const Key('super-project-github-approve'),
- onPressed: _busy ? null : () => _approve('project'),
- child: const Text('Approve for this project'),
- ),
- ],
- TextButton(
- key: const Key('super-project-github-check'),
- onPressed: _checking ? null : _check,
- child: Text(_checking ? 'Checking…' : 'Check again'),
- ),
+ ..._installButtons(access),
+ if (_canApprove(access)) _approveButton(),
+ if (!pending) _tryAgainButton(),
],
),
),
@@ -277,6 +236,373 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
);
}
+ bool _canApprove(SuperTabProjectGitHub access) =>
+ access.state == 'not-approved' && access.canApprove;
+
+ /// The project's GitHub access in one sentence, for Project details' row.
+ String _sentence(
+ SuperTabProjectGitHub access,
+ String repository,
+ ) => switch (access.state) {
+ 'covered' =>
+ "Teammates' agents can push and open pull requests on $repository.",
+ 'not-installed' =>
+ "Teammates' agents can't push to $repository yet. An owner of ${_owner(repository)} installs Harness on GitHub there.",
+ 'not-approved' =>
+ access.canApprove && access.approvedFor.isNotEmpty
+ // Approving is per project: one approved for the reader's other projects says so (group #646, item 8).
+ ? "Teammates' agents can't push to $repository from this project yet. It's allowed for "
+ '${_names(access.approvedFor)}. Allow it here too?'
+ : access.canApprove
+ ? "Teammates' agents can't push to $repository from this project yet. Anyone who can push to it can "
+ 'allow it.'
+ : "Teammates' agents can't push to $repository from this project yet. This Harness server can't allow "
+ 'repositories yet.',
+ 'not-github' => "Teammates' agents can't work on this project: its repository isn't on GitHub.",
+ 'no-repository' =>
+ 'This project has no repository address yet. Its owner or Lead sets it.',
+ 'unread' => "Couldn't check GitHub access just now.",
+ _ => "Couldn't reach GitHub to check $repository.",
+ };
+
+ static String _owner(String repository) => repository.split('/').first;
+
+ Widget _errorText() => Padding(
+ padding: const EdgeInsets.only(top: _halfGap),
+ child: Text(
+ _error!,
+ key: const Key('super-project-github-error'),
+ style: DesktopChrome.text().copyWith(color: grid.AppPalette.warn),
+ ),
+ );
+
+ List<Widget> _installButtons(SuperTabProjectGitHub access) {
+ final install = access.installUrl;
+ if (install == null || access.state != 'not-installed') return const [];
+ return [
+ FilledButton(
+ key: const Key('super-project-github-install'),
+ onPressed: _busy ? null : () => _install(install),
+ child: const Text('Install on GitHub'),
+ ),
+ TextButton(
+ key: const Key('super-project-github-copy'),
+ onPressed: () async {
+ await Clipboard.setData(ClipboardData(text: install));
+ if (mounted) setState(() => _copied = true);
+ },
+ child: Text(_copied ? 'Link copied' : 'Copy link'),
+ ),
+ ];
+ }
+
+ Widget _approveButton() => FilledButton(
+ key: const Key('super-project-github-approve'),
+ onPressed: _busy ? null : () => _approve('project'),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Text('Continue in GitHub'),
+ const SizedBox(width: 6),
+ Icon(AppIcons.arrowUpRight, size: grid.AppControl.iconSize),
+ ],
+ ),
+ );
+
+ Widget _tryAgainButton() => TextButton(
+ key: const Key('super-project-github-check'),
+ onPressed: _checking ? null : _check,
+ child: Text(_checking ? 'Checking…' : 'Try again'),
+ );
+
+ /// The dialog the sidebar line opens: one screen per state, each saying what happens next.
+ Widget _dialogFor(SuperTabProjectGitHub? access) {
+ final name = widget.projectName ?? 'this project';
+ final repository = access?.repository ?? 'its repository';
+ void close() => Navigator.maybePop(context);
+ final pending =
+ access?.state == 'not-installed' || access?.state == 'not-approved';
+ if (access == null) {
+ return _screen(
+ heading: 'GitHub access',
+ body: [_body(access == null ? 'Checking…' : '', muted: true)],
+ actions: [_closeButton(close)],
+ );
+ }
+ if (_inBrowser && pending) {
+ return _screen(
+ key: const Key('super-project-github-waiting'),
+ leading: SizedBox(
+ width: 18,
+ height: 18,
+ child: CircularProgressIndicator(
+ strokeWidth: 2,
+ color: grid.AppPalette.swarmAccent,
+ ),
+ ),
+ heading: 'Finish in GitHub',
+ body: [
+ _body(
+ access.state == 'not-installed'
+ ? 'GitHub is open in your browser. Install Harness on ${_owner(repository)} there. '
+ 'This updates by itself when you come back.'
+ : 'GitHub is open in your browser. Click Authorize on the “Harness for Autonomous” page. '
+ 'This updates by itself when you come back.',
+ ),
+ if (access.state == 'not-approved')
+ _box(
+ title: "What GitHub's page means",
+ text:
+ "“Act on your behalf” is GitHub's wording for any app you sign in to. Harness uses it to "
+ 'confirm you can push to $repository.',
+ ),
+ ],
+ aside: [
+ if (_openedLink != null)
+ TextButton(
+ key: const Key('super-project-github-reopen'),
+ onPressed: () => launchUrl(
+ Uri.parse(_openedLink!),
+ mode: LaunchMode.externalApplication,
+ ),
+ child: const Text('Open GitHub again'),
+ ),
+ ],
+ actions: [
+ OutlinedButton(
+ key: const Key('super-project-github-cancel'),
+ onPressed: () => setState(() => _inBrowser = false),
+ child: const Text('Cancel'),
+ ),
+ ],
+ );
+ }
+ switch (access.state) {
+ case 'covered':
+ return _screen(
+ leading: Icon(
+ AppIcons.check,
+ size: grid.AppControl.iconSize + 4,
+ color: grid.AppPalette.online,
+ ),
+ heading: "Teammates' agents can push to $name",
+ body: [
+ _body(
+ 'From now on they push branches and open pull requests on $repository from their own machines.',
+ key: ValueKey('super-project-github-text-${widget.projectId}'),
+ ),
+ ],
+ actions: [
+ FilledButton(
+ key: const Key('super-project-github-done'),
+ onPressed: close,
+ child: const Text('Done'),
+ ),
+ ],
+ );
+ case 'not-approved' when access.canApprove:
+ return _screen(
+ heading: "Let teammates' agents push to $name",
+ body: [
+ _body(
+ "Agents on your teammates' machines push branches and open pull requests through the Harness "
+ 'GitHub app. Anyone who can push to $repository can allow it for this project.'
+ '${access.approvedFor.isEmpty ? '' : " It's already allowed for ${_names(access.approvedFor)}."}',
+ key: ValueKey('super-project-github-text-${widget.projectId}'),
+ ),
+ _repository(repository),
+ _allows('Push branches and open pull requests'),
+ _allows('Only in this repository, only for this project'),
+ _body(
+ "GitHub opens next to check that you can push to it. Come back here when it's done.",
+ muted: true,
+ ),
+ if (_error != null) _errorText(),
+ ],
+ aside: [
+ TextButton(
+ key: const Key('super-project-github-ask'),
+ onPressed: () async {
+ await Clipboard.setData(
+ ClipboardData(
+ text:
+ 'Could you open $name in Harness and click “Set up GitHub for teammates”? Our agents '
+ 'need it to push to $repository.',
+ ),
+ );
+ if (mounted) setState(() => _askCopied = true);
+ },
+ child: Text(
+ _askCopied
+ ? 'Message copied'
+ : "Can't push to it? Copy a message",
+ ),
+ ),
+ ],
+ actions: [
+ OutlinedButton(onPressed: close, child: const Text('Not now')),
+ _approveButton(),
+ ],
+ );
+ case 'not-approved':
+ return _screen(
+ heading: "GitHub access isn't available yet",
+ body: [
+ _body(
+ "Teammates' agents can't push to $repository from this project yet: this Harness server "
+ "can't allow repositories yet.",
+ key: ValueKey('super-project-github-text-${widget.projectId}'),
+ ),
+ ],
+ actions: [_closeButton(close)],
+ );
+ case 'not-installed':
+ return _screen(
+ heading: 'Install Harness on GitHub for $name',
+ body: [
+ _body(
+ "Teammates' agents push through the Harness GitHub app, which isn't on ${_owner(repository)} yet. "
+ 'An owner of ${_owner(repository)} can install it.',
+ key: ValueKey('super-project-github-text-${widget.projectId}'),
+ ),
+ _repository(repository),
+ if (_error != null) _errorText(),
+ ],
+ aside: [..._installButtons(access).skip(1)],
+ actions: [
+ OutlinedButton(onPressed: close, child: const Text('Not now')),
+ ..._installButtons(access).take(1),
+ ],
+ );
+ default:
+ return _screen(
+ heading: 'GitHub access',
+ body: [
+ _body(
+ _sentence(access, repository),
+ key: ValueKey('super-project-github-text-${widget.projectId}'),
+ ),
+ ],
+ actions: [
+ if (access.state == 'unknown' || access.state == 'unread')
+ _tryAgainButton(),
+ _closeButton(close),
+ ],
+ );
+ }
+ }
+
+ Widget _closeButton(VoidCallback close) =>
+ OutlinedButton(onPressed: close, child: const Text('Close'));
+
+ Widget _screen({
+ Key? key,
+ Widget? leading,
+ required String heading,
+ required List<Widget> body,
+ List<Widget> aside = const [],
+ required List<Widget> actions,
+ }) => KeyedSubtree(
+ key: ValueKey('super-project-github-${widget.projectId}'),
+ child: Column(
+ key: key,
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ if (leading != null) ...[leading, const SizedBox(width: 10)],
+ Expanded(
+ child: Text(
+ heading,
+ key: const Key('super-project-github-heading'),
+ style: DesktopChrome.heading(),
+ ),
+ ),
+ ],
+ ),
+ for (final part in body) ...[const SizedBox(height: _gap + 2), part],
+ if (aside.isNotEmpty) ...[
+ const SizedBox(height: _gap),
+ Wrap(spacing: 4, children: aside),
+ ],
+ const SizedBox(height: _gap * 2),
+ // Wraps under large text rather than overflowing the dialog.
+ SizedBox(
+ width: double.infinity,
+ child: Wrap(
+ alignment: WrapAlignment.end,
+ spacing: _gap - 2,
+ runSpacing: _halfGap,
+ children: actions,
+ ),
+ ),
+ ],
+ ),
+ );
+
+ Widget _body(String text, {Key? key, bool muted = false}) => Text(
+ text,
+ key: key,
+ style: DesktopChrome.text(color: muted ? DesktopChrome.muted : null),
+ );
+
+ Widget _repository(String repository) => Container(
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
+ decoration: BoxDecoration(
+ color: grid.AppSurface.wellFill,
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ border: Border.all(color: DesktopChrome.rim),
+ ),
+ child: Row(
+ children: [
+ Icon(
+ AppIcons.gitBranch,
+ size: grid.AppControl.iconSize,
+ color: DesktopChrome.muted,
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Text(repository, style: DesktopChrome.text(medium: true)),
+ ),
+ ],
+ ),
+ );
+
+ Widget _allows(String text) => Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(top: 2),
+ child: Icon(
+ AppIcons.check,
+ size: grid.AppControl.iconSize,
+ color: grid.AppPalette.online,
+ ),
+ ),
+ const SizedBox(width: 10),
+ Expanded(child: _body(text)),
+ ],
+ );
+
+ Widget _box({required String title, required String text}) => Container(
+ width: double.infinity,
+ padding: const EdgeInsets.all(12),
+ decoration: BoxDecoration(
+ color: grid.AppSurface.wellFill,
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ border: Border.all(color: DesktopChrome.rim),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(title, style: DesktopChrome.control(medium: true)),
+ const SizedBox(height: 4),
+ Text(text, style: DesktopChrome.metadata()),
+ ],
+ ),
+ );
+
/// Under its heading, or as Project details' row.
Widget _framed(Widget content) => KeyedSubtree(
key: ValueKey('super-project-github-${widget.projectId}'),
@@ -313,6 +639,7 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
setState(() {
_busy = false;
_inBrowser = true;
+ _openedLink = link;
});
}
}
@@ -332,12 +659,17 @@ class _ProjectGitHubAccessState extends State<ProjectGitHubAccess>
Uri.parse(links.authorizeUrl),
mode: LaunchMode.externalApplication,
);
- if (mounted) setState(() => _inBrowser = true);
+ if (mounted) {
+ setState(() {
+ _inBrowser = true;
+ _openedLink = links.authorizeUrl;
+ });
+ }
} on SuperTabFailure catch (failure) {
if (mounted) setState(() => _error = failure.message);
} catch (_) {
if (mounted) {
- setState(() => _error = "Couldn't start approving. Try again.");
+ setState(() => _error = "Couldn't open GitHub. Try again.");
}
}
if (mounted) setState(() => _busy = false);
@@ -398,20 +730,38 @@ class _ProjectGitHubLineState extends State<ProjectGitHubLine>
if (c.snapshot?.hasTeammates != true) return const SizedBox.shrink();
// A Swarm that gained a person since: read now (at most every 5 minutes, answered or not).
c.readGitHubAccess(widget.project.id);
- final problem = c.githubAccessOf(widget.project.id)?.problem;
+ final access = c.githubAccessOf(widget.project.id);
+ final problem = access?.problem;
if (problem == null) return const SizedBox.shrink();
return InkWell(
key: ValueKey('super-project-github-line-${widget.project.id}'),
onTap: () => showProjectGitHubAccess(context, c, widget.project),
child: Padding(
padding: const EdgeInsets.only(bottom: _halfGap),
- child: Text(
- problem,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata().copyWith(
- color: grid.AppPalette.warn,
- ),
+ child: Row(
+ children: [
+ if (access!.setupStep) ...[
+ Container(
+ width: 6,
+ height: 6,
+ decoration: BoxDecoration(
+ color: grid.AppPalette.swarmAccent,
+ shape: BoxShape.circle,
+ ),
+ ),
+ const SizedBox(width: 6),
+ ],
+ Flexible(
+ child: Text(
+ problem,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(
+ color: access.setupStep ? null : grid.AppPalette.warn,
+ ),
+ ),
+ ),
+ ],
),
),
);
@@ -428,16 +778,15 @@ Future<void> showProjectGitHubAccess(
context: context,
builder: (context) => AlertDialog(
key: const Key('super-project-github-dialog'),
- title: Text(project.name),
+ scrollable: true,
content: SizedBox(
- width: 400,
- child: ProjectGitHubAccess(controller: c, projectId: project.id),
- ),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context),
- child: const Text('Close'),
+ width: 464,
+ child: ProjectGitHubAccess(
+ controller: c,
+ projectId: project.id,
+ dialog: true,
+ projectName: project.name,
),
- ],
+ ),
),
);
diff --git a/desktop/test/super_tab_project_github_test.dart b/desktop/test/super_tab_project_github_test.dart
index 946959b46..ca7568fda 100644
--- a/desktop/test/super_tab_project_github_test.dart
+++ b/desktop/test/super_tab_project_github_test.dart
@@ -135,7 +135,7 @@ void main() {
tester,
(c, p) => ProjectGitHubLine(controller: c, project: p),
);
- expect(find.text("Teammates can't push here yet"), findsOneWidget);
+ expect(find.text('Set up GitHub for teammates'), findsOneWidget);
expect(asked, hasLength(1));
// Read again only after 5 minutes, whatever rebuilds meanwhile.
await tester.pump();
@@ -165,13 +165,15 @@ void main() {
});
testWidgets(
- 'Project details explains it, links to GitHub\'s install page, copies the link, and checks again',
+ 'Project details explains it, links to GitHub\'s install page, copies the link, and reads again on return',
(tester) async {
final c = await mount(
tester,
(c, p) => ProjectGitHubAccess(controller: c, projectId: p.id),
);
expect(find.textContaining("can't push to acme/app yet"), findsOneWidget);
+ // Nothing to press to check again: coming back to the app reads it again (design 2026-10-30).
+ expect(find.byKey(const Key('super-project-github-check')), findsNothing);
expect(
find.byKey(const Key('super-project-github-install')),
findsOneWidget,
@@ -180,7 +182,8 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Link copied'), findsOneWidget);
answer = {'state': 'covered', 'repository': 'acme/app'};
- await tester.tap(find.byKey(const Key('super-project-github-check')));
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
await tester.pumpAndSettle();
expect(asked.last, endsWith('/github?refresh=1'));
// A check mark, the app's own, not a ✓ typed into the sentence (Ken, 2026-10-28).
@@ -248,7 +251,7 @@ void main() {
(c, p) => ProjectGitHubAccess(controller: c, projectId: p.id),
);
expect(
- find.textContaining("can't use acme/app in this project yet"),
+ find.textContaining("can't push to acme/app from this project yet"),
findsOneWidget,
);
// Approved one project at a time: nothing widens it to every project in one click (Scholes, 2026-10-28).
@@ -289,7 +292,7 @@ void main() {
);
expect(
find.text(
- "Teammates' agents can't use acme/app in this project yet. $line",
+ "Teammates' agents can't push to acme/app from this project yet. $line",
),
findsOneWidget,
);
@@ -300,16 +303,16 @@ void main() {
c.dispose();
}
- await reads(['Notes'], "It's approved for Notes. Approve it here too?");
+ await reads(['Notes'], "It's allowed for Notes. Allow it here too?");
await reads([
'Notes',
'Docs',
- ], "It's approved for Notes and Docs. Approve it here too?");
+ ], "It's allowed for Notes and Docs. Allow it here too?");
await reads([
'Notes',
'Docs',
'Site',
- ], "It's approved for Notes, Docs and Site. Approve it here too?");
+ ], "It's allowed for Notes, Docs and Site. Allow it here too?");
},
);
@@ -325,10 +328,7 @@ void main() {
tester,
(c, p) => ProjectGitHubAccess(controller: c, projectId: p.id),
);
- expect(
- find.textContaining("can't approve repositories yet"),
- findsOneWidget,
- );
+ expect(find.textContaining("can't allow repositories yet"), findsOneWidget);
expect(find.byKey(const Key('super-project-github-approve')), findsNothing);
c.dispose();
});
@@ -370,9 +370,94 @@ void main() {
await tester.tap(find.byKey(const Key('super-project-github-check')));
await tester.pumpAndSettle();
expect(
- find.textContaining('Install Harness on GitHub there'),
+ find.textContaining('installs Harness on GitHub there'),
+ findsOneWidget,
+ );
+ c.dispose();
+ },
+ );
+
+ // Design 2026-10-30 ("Swarm GitHub access flow"): the dialog the sidebar line opens says what is being allowed, waits
+ // for GitHub in its own screen, and ends with a plain confirmation.
+ testWidgets(
+ 'the dialog asks to allow it, waits for GitHub, and confirms when it is done',
+ (tester) async {
+ answer = {
+ 'state': 'not-approved',
+ 'repository': 'acme/app',
+ 'canApprove': true,
+ };
+ final c = controllerFor();
+ await c.refresh();
+ final project = c.snapshot!.projects.first;
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: Builder(
+ builder: (context) => TextButton(
+ onPressed: () => showProjectGitHubAccess(context, c, project),
+ child: const Text('open github'),
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.tap(find.text('open github'));
+ await tester.pumpAndSettle();
+ expect(
+ find.text("Let teammates' agents push to ${project.name}"),
+ findsOneWidget,
+ );
+ expect(find.text('acme/app'), findsOneWidget);
+ expect(find.text('Push branches and open pull requests'), findsOneWidget);
+ await tester.ensureVisible(
+ find.byKey(const Key('super-project-github-ask')),
+ );
+ await tester.tap(find.byKey(const Key('super-project-github-ask')));
+ await tester.pumpAndSettle();
+ expect(find.text('Message copied'), findsOneWidget);
+ await tester.ensureVisible(
+ find.byKey(const Key('super-project-github-approve')),
+ );
+ await tester.tap(find.byKey(const Key('super-project-github-approve')));
+ // The waiting screen's spinner never settles.
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 100));
+ expect(launched.last, contains('/login/oauth/authorize'));
+ expect(find.text('Finish in GitHub'), findsOneWidget);
+ expect(find.text("What GitHub's page means"), findsOneWidget);
+ // Cancel goes back to the question; Continue opens GitHub again.
+ await tester.ensureVisible(
+ find.byKey(const Key('super-project-github-cancel')),
+ );
+ await tester.tap(find.byKey(const Key('super-project-github-cancel')));
+ await tester.pumpAndSettle();
+ expect(find.text('Finish in GitHub'), findsNothing);
+ await tester.ensureVisible(
+ find.byKey(const Key('super-project-github-approve')),
+ );
+ await tester.tap(find.byKey(const Key('super-project-github-approve')));
+ // The waiting screen's spinner never settles.
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 100));
+ // Back from GitHub, approved.
+ answer = {'state': 'covered', 'repository': 'acme/app'};
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
+ await tester.pumpAndSettle();
+ expect(
+ find.text("Teammates' agents can push to ${project.name}"),
findsOneWidget,
);
+ await tester.ensureVisible(
+ find.byKey(const Key('super-project-github-done')),
+ );
+ await tester.tap(find.byKey(const Key('super-project-github-done')));
+ await tester.pumpAndSettle();
+ expect(
+ find.byKey(const Key('super-project-github-dialog')),
+ findsNothing,
+ );
c.dispose();
},
);
@@ -421,7 +506,7 @@ void main() {
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
await tester.pumpAndSettle();
expect(asked.last, endsWith('/github?refresh=1'));
- expect(find.text("Teammates can't push here yet"), findsNothing);
+ expect(find.text('Set up GitHub for teammates'), findsNothing);
expect(find.textContaining("Teammates' agents can push"), findsOneWidget);
expect(
find.byKey(const Key('super-project-github-waiting')),