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(mobile): a held New Harness stops asking once Cancel request is pressed (#1448)

Bubu-Dudu-52hzeaf107de11ae
diff --git a/mobile/lib/phone/new_agent_page.dart b/mobile/lib/phone/new_agent_page.dart
index 2b049b585..395c00761 100644
--- a/mobile/lib/phone/new_agent_page.dart
+++ b/mobile/lib/phone/new_agent_page.dart
@@ -956,6 +956,8 @@ class _NewAgentPageState extends State<NewAgentPage> {
Future<void> _cancelPending() async {
final creation = _creation;
if (creation == null || _creating || creation.cancelling) return;
+ // Called off: no more asking by itself; whatever comes of the cancel, the person checks.
+ _holdCheck?.cancel();
setState(() {});
final problem = await widget.notifier.cancelAgentCreation(creation);
if (!mounted) return;
@@ -965,6 +967,7 @@ class _NewAgentPageState extends State<NewAgentPage> {
?.showSnackBar(const SnackBar(content: Text('Creation cancelled.')));
}
setState(() {
+ _held = null;
_error = problem;
_failure = null;
});
@@ -1000,7 +1003,11 @@ class _NewAgentPageState extends State<NewAgentPage> {
});
_holdCheck?.cancel();
_holdCheck = Timer(const Duration(seconds: 4), () {
- if (mounted && identical(_creation, creation) && !_creating) {
+ if (mounted &&
+ identical(_creation, creation) &&
+ !_creating &&
+ !creation.cancelling &&
+ _held != null) {
unawaited(_start());
}
});