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.

fix(desktop): a dismissed link prompt opens again when asked for

0xdiego25051ea5bccd82
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index d3a033569..ed5ba299b 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1385,6 +1385,15 @@ class AppNotifier extends ChangeNotifier {
if (_dismissedLinkPrompts.add(machineId)) notifyListeners();
}
+ /// The person asked to see the prompt again — a deliberate open, not the
+ /// reactive gate. Without this, every way in that does not go through
+ /// [showMachinePane] (the welcome's Machines row) opened a dialog that its
+ /// own "still needed?" check closed on the first frame: one popup, then
+ /// nothing, for as long as the app ran.
+ void revisitLinkPrompt(String machineId) {
+ if (_dismissedLinkPrompts.remove(machineId)) notifyListeners();
+ }
+
// ── ⌘B: a typed task, and which agent it belongs to ────────────────────────────────────────────
/// The machine this window is running ON — where the daemon that ANSWERS ⌘B lives.
diff --git a/desktop/lib/widgets/link_machine_screen.dart b/desktop/lib/widgets/link_machine_screen.dart
index f862e941f..dcb5b783b 100644
--- a/desktop/lib/widgets/link_machine_screen.dart
+++ b/desktop/lib/widgets/link_machine_screen.dart
@@ -17,6 +17,12 @@ Future<void> showLinkMachineScreenDialog(
AppNotifier notifier,
String machineId,
) async {
+ // Opening IS the answer to "was it dismissed?": a Cancel earlier marked the
+ // machine so the reactive gates stop insisting, and the gates check that mark
+ // before calling here — so anything that reaches this line is a person asking
+ // to see it. Clear the mark, or the check inside pops the dialog on its first
+ // frame and the row reads as dead.
+ notifier.revisitLinkPrompt(machineId);
await showAppDialog<void>(
context: context,
builder: (context) => Dialog(
diff --git a/desktop/test/link_prompt_revisit_test.dart b/desktop/test/link_prompt_revisit_test.dart
new file mode 100644
index 000000000..1258da008
--- /dev/null
+++ b/desktop/test/link_prompt_revisit_test.dart
@@ -0,0 +1,31 @@
+// A dismissed link prompt opens again when asked for.
+//
+// Reported from the desk: on the welcome's Machines list, "Link required" popped once, and after
+// Cancel a second click did nothing at all. Cancel marks the machine dismissed so the reactive gates
+// stop insisting; the dialog's own "still needed?" check read that mark and closed itself on the
+// first frame. The row stayed dead for the rest of the run.
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/auth/auth_session.dart';
+import 'package:harness/core/config.dart';
+import 'package:harness/state/app_state.dart';
+
+void main() {
+ test('revisiting clears the dismissal so the prompt can show again', () {
+ final app = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ );
+ expect(app.isLinkPromptDismissed('m1'), isFalse);
+ app.dismissLinkPrompt('m1');
+ expect(app.isLinkPromptDismissed('m1'), isTrue);
+ app.revisitLinkPrompt('m1');
+ expect(app.isLinkPromptDismissed('m1'), isFalse);
+ // Idempotent both ways: a second revisit is not an error and notifies nobody.
+ var notified = 0;
+ app.addListener(() => notified++);
+ app.revisitLinkPrompt('m1');
+ expect(notified, 0);
+ app.dispose();
+ });
+}