Skip to content

fix: Resolve multiple bugs (#69, #70, #73, #74, #82, #83)#84

Merged
mithun50 merged 3 commits intomainfrom
fix/multi-bug-fixes-69-70-73-74-82-83
Mar 22, 2026
Merged

fix: Resolve multiple bugs (#69, #70, #73, #74, #82, #83)#84
mithun50 merged 3 commits intomainfrom
fix/multi-bug-fixes-69-70-73-74-82-83

Conversation

@mithun50
Copy link
Copy Markdown
Owner

@mithun50 mithun50 commented Mar 22, 2026

Summary

Changes

File Change
flutter_app/android/build.gradle Replace jcenter() with mavenCentral() in plugin repos
flutter_app/lib/widgets/progress_step.dart Indeterminate progress when 0%, show percentage
flutter_app/lib/screens/setup_wizard_screen.dart Fix off-by-one step completion
flutter_app/lib/models/gateway_state.dart Add clearDashboardUrl to copyWith
flutter_app/lib/services/gateway_service.dart Read token from config, clear stale token on start
flutter_app/lib/screens/splash_screen.dart Auto-repair bionic bypass on app update
flutter_app/pubspec.yaml + constants.dart Version bump to 1.8.5+16

Test plan

  • Build APK and verify no jcenter() build errors
  • Run setup wizard and verify progress bar animates during extraction and npm install steps
  • Verify step completion checkmarks appear at the correct time
  • Start gateway, verify token displayed matches openclaw.json config
  • Restart gateway, verify new token is shown (not stale old one)
  • Simulate missing bionic-bypass.js, relaunch app, verify auto-repair

Summary by cubic

Fixes Android build failures, improves setup progress UX, and makes gateway auth consistent. Also auto-repairs a missing bionic-bypass after updates to avoid re-setup.

Written for commit 02b7da0. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Automatic repair step during startup to address incomplete initialization.
  • Bug Fixes

    • More accurate progress-step and progress-indicator behavior during setup.
    • Improved dashboard URL handling and persistence, preferring fresh config tokens and clearing stale URLs.
  • Chores

    • App version bumped to 1.8.5.
    • Updated dependency repository configuration for improved build reliability.

- Fix usb_serial jcenter() build failure by replacing deprecated repos
  with mavenCentral() in subproject afterEvaluate (#69)
- Fix setup progress bar stalling at 0% during extraction and npm
  install by using indeterminate animation, show percentage when real
  progress is available, fix off-by-one in step completion check (#83)
- Fix token mismatch by reading actual token from openclaw.json config
  as source of truth, clear stale token on gateway start, add
  clearDashboardUrl to state copyWith (#74, #82)
- Auto-repair missing bionic-bypass.js after app update instead of
  forcing full re-setup (#70, #73)

Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>
Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0068074-e3dd-4b2f-b5d1-bffe7570e785

📥 Commits

Reviewing files that changed from the base of the PR and between d253e3b and 02b7da0.

📒 Files selected for processing (1)
  • flutter_app/android/build.gradle
✅ Files skipped from review due to trivial changes (1)
  • flutter_app/android/build.gradle

📝 Walkthrough

Walkthrough

App version bumped to 1.8.5 and repo metadata changed for Android. Gateway initialization now prefers tokens from root/.openclaw/openclaw.json and can clear persisted dashboard URLs; splash boot adds an auto-repair step for a missing bionic bypass; progress step widgets treat 0.0 as indeterminate.

Changes

Cohort / File(s) Summary
Version Bump
flutter_app/pubspec.yaml, flutter_app/lib/constants.dart
Package version incremented (pubspec: 1.8.4+151.8.5+16); AppConstants.version updated 1.8.41.8.5.
Android Build Configuration
flutter_app/android/build.gradle
Added jcenter() to allprojects { repositories { ... } } so JCenter is included as a fallback repository for all modules.
Gateway State & Service
flutter_app/lib/models/gateway_state.dart, flutter_app/lib/services/gateway_service.dart
Added clearDashboardUrl flag to GatewayState.copyWith; added _readTokenFromConfig() to parse root/.openclaw/openclaw.json; init(), start(), and _checkHealth() updated to prefer config-derived tokens, persist/clear prefs.dashboardUrl, and overwrite displayed dashboardUrl from config when available.
Setup and Boot Flow
flutter_app/lib/screens/setup_wizard_screen.dart, flutter_app/lib/screens/splash_screen.dart
Progress step completion check changed to state.stepNumber > step.index; splash boot routing now tries an auto-repair: checks bootstrap subcomponents, sets status to “Repairing bionic bypass...”, calls NativeBridge.installBionicBypass(), and rechecks bootstrap completion (errors suppressed).
Progress Indicator Refinement
flutter_app/lib/widgets/progress_step.dart
Treat progress == 0.0 as indeterminate: circular/linear indicators use value=null for 0.0, show percentage text only when progress > 0.0, and consolidate active-progress UI under a single conditional.

Sequence Diagram(s)

sequenceDiagram
participant App as App/UI
participant GatewaySvc as GatewayService
participant FS as FileSystem
participant Prefs as SharedPrefs
participant Native as NativeBridge

App->>GatewaySvc: init()
GatewaySvc->>Prefs: read persisted dashboardUrl
GatewaySvc->>FS: _readTokenFromConfig()
alt token in config
GatewaySvc->>Prefs: write dashboardUrl (http://localhost:18789/#token=...)
GatewaySvc->>App: update state.dashboardUrl (from config)
else no token
GatewaySvc->>App: keep persisted dashboardUrl
end

App->>Native: isBootstrapComplete()
alt not complete and bypass missing but others present
App->>Native: getBootstrapStatus()
App->>App: set status "Repairing bionic bypass..."
App->>Native: installBionicBypass()
App->>Native: isBootstrapComplete() (recheck)
end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 I hopped through code to bump the tune,
Tokens found beneath the moon,
A bypass fixed with careful art,
Progress bars play their part,
Version one-eight-five — a tiny, joyful boon! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change—fixing multiple bugs across the Flutter app—and references the issue numbers. It accurately reflects the multi-faceted bugfix nature of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/multi-bug-fixes-69-70-73-74-82-83

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

@github-actions
Copy link
Copy Markdown

Build Failed

The build failed for commit 2437709.

View build logs

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
flutter_app/lib/services/gateway_service.dart (1)

304-321: Consider caching the PreferencesService instance.

prefs.init() is called on each health check transition to running. While not a hot path, you could consider caching the initialized PreferencesService instance at the class level to avoid repeated initialization.

♻️ Optional refactor to cache PreferencesService
 class GatewayService {
   Timer? _healthTimer;
   Timer? _initialDelayTimer;
   StreamSubscription? _logSubscription;
   final _stateController = StreamController<GatewayState>.broadcast();
   GatewayState _state = const GatewayState();
   DateTime? _startingAt;
   bool _startInProgress = false;
+  PreferencesService? _prefs;
   static final _tokenUrlRegex = RegExp(r'https?://(?:localhost|127\.0\.0\.1):18789/#token=[0-9a-f]+');

Then use a helper:

Future<PreferencesService> _getPrefs() async {
  _prefs ??= PreferencesService();
  await _prefs!.init();
  return _prefs!;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@flutter_app/lib/services/gateway_service.dart` around lines 304 - 321, Cache
the PreferencesService instance to avoid repeated initialization: add a private
field (e.g., PreferencesService? _prefs) on the GatewayService class and
implement a helper method Future<PreferencesService> _getPrefs() that assigns
_prefs if null, awaits _prefs!.init() and returns it; then replace the local
creation in the block that calls _readTokenFromConfig() so it awaits _getPrefs()
instead of creating a new PreferencesService() and calling init() each time;
keep the rest of the logic (setting prefs.dashboardUrl) the same.
flutter_app/lib/screens/splash_screen.dart (1)

133-133: Consider logging repair failures for debugging.

The empty catch block silently swallows any repair errors. While the fallback to SetupWizardScreen is correct behavior, logging the exception would help diagnose persistent repair failures.

♻️ Optional: Add debug logging
-        } catch (_) {}
+        } catch (e) {
+          debugPrint('Bionic bypass repair failed: $e');
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@flutter_app/lib/screens/splash_screen.dart` at line 133, The empty catch
block that currently swallows exceptions (the "catch (_)" in splash_screen.dart
where the code falls back to SetupWizardScreen) should log the caught error for
debugging; update that catch to capture the exception (and optionally
stackTrace) and call the app's logging mechanism (e.g., debugPrint or your
Logger) with a brief message like "Repair failed" plus the error details to aid
diagnosis while keeping the fallback to SetupWizardScreen unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@flutter_app/android/build.gradle`:
- Around line 28-35: The project.afterEvaluate callback is registered too late
(after evaluationHasBeen forced by evaluationDependsOn(":app")) which causes the
"already evaluated" error; replace the project.afterEvaluate usage by using
gradle.projectsEvaluated and run the repository adjustments for every subproject
there: in the gradle.projectsEvaluated block iterate the relevant
projects/subprojects and ensure each project.repositories contains
mavenCentral() and remove jcenter entries (detect via instanceof
MavenArtifactRepository and repo.url.toString().contains("jcenter")); this
ensures the repository changes run after all projects are evaluated without
attempting to register afterEvaluate on an already-evaluated project.

---

Nitpick comments:
In `@flutter_app/lib/screens/splash_screen.dart`:
- Line 133: The empty catch block that currently swallows exceptions (the "catch
(_)" in splash_screen.dart where the code falls back to SetupWizardScreen)
should log the caught error for debugging; update that catch to capture the
exception (and optionally stackTrace) and call the app's logging mechanism
(e.g., debugPrint or your Logger) with a brief message like "Repair failed" plus
the error details to aid diagnosis while keeping the fallback to
SetupWizardScreen unchanged.

In `@flutter_app/lib/services/gateway_service.dart`:
- Around line 304-321: Cache the PreferencesService instance to avoid repeated
initialization: add a private field (e.g., PreferencesService? _prefs) on the
GatewayService class and implement a helper method Future<PreferencesService>
_getPrefs() that assigns _prefs if null, awaits _prefs!.init() and returns it;
then replace the local creation in the block that calls _readTokenFromConfig()
so it awaits _getPrefs() instead of creating a new PreferencesService() and
calling init() each time; keep the rest of the logic (setting
prefs.dashboardUrl) the same.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0927448d-e022-44c2-a598-27b5cbf5270f

📥 Commits

Reviewing files that changed from the base of the PR and between 1cdc5d0 and d253e3b.

📒 Files selected for processing (8)
  • flutter_app/android/build.gradle
  • flutter_app/lib/constants.dart
  • flutter_app/lib/models/gateway_state.dart
  • flutter_app/lib/screens/setup_wizard_screen.dart
  • flutter_app/lib/screens/splash_screen.dart
  • flutter_app/lib/services/gateway_service.dart
  • flutter_app/lib/widgets/progress_step.dart
  • flutter_app/pubspec.yaml

Comment on lines +28 to +35
project.afterEvaluate {
project.repositories {
mavenCentral()
}
project.repositories.removeIf { repo ->
repo instanceof MavenArtifactRepository && repo.url.toString().contains("jcenter")
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read-only verification: locate lifecycle/repository hooks in Gradle files
rg -n -C3 --type-add 'gradle:*.gradle' --type gradle \
  'evaluationDependsOn|afterEvaluate|projectsEvaluated|repositories\.removeIf|jcenter|mavenCentral'

Repository: mithun50/openclaw-termux

Length of output: 1804


afterEvaluate registration is too late and breaks the Gradle build.

At line 28, project.afterEvaluate { ... } is registered inside the subprojects block after project.evaluationDependsOn(":app") has already forced :app evaluation. Once a project is evaluated, registering afterEvaluate callbacks fails with "Cannot run Project.afterEvaluate(Closure) when the project is already evaluated."

Proposed fix (use gradle.projectsEvaluated instead)
 subprojects {
     project.evaluationDependsOn(":app")
-
-    // Fix plugins that still reference the deprecated jcenter() repository (`#69`).
-    // Force all subprojects to use mavenCentral() instead.
-    project.afterEvaluate {
-        project.repositories {
-            mavenCentral()
-        }
-        project.repositories.removeIf { repo ->
-            repo instanceof MavenArtifactRepository && repo.url.toString().contains("jcenter")
-        }
-    }
 }
+
+// Fix plugins that still reference the deprecated jcenter() repository (`#69`).
+// Apply once after project evaluation phase has completed.
+gradle.projectsEvaluated {
+    subprojects { subproject ->
+        subproject.repositories {
+            mavenCentral()
+        }
+        subproject.repositories.removeIf { repo ->
+            repo instanceof MavenArtifactRepository && repo.url.toString().contains("jcenter")
+        }
+    }
+}
🧰 Tools
🪛 GitHub Actions: Build OpenClaw Apps

[error] 28-28: Gradle build failed while evaluating root project 'android': Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@flutter_app/android/build.gradle` around lines 28 - 35, The
project.afterEvaluate callback is registered too late (after evaluationHasBeen
forced by evaluationDependsOn(":app")) which causes the "already evaluated"
error; replace the project.afterEvaluate usage by using gradle.projectsEvaluated
and run the repository adjustments for every subproject there: in the
gradle.projectsEvaluated block iterate the relevant projects/subprojects and
ensure each project.repositories contains mavenCentral() and remove jcenter
entries (detect via instanceof MavenArtifactRepository and
repo.url.toString().contains("jcenter")); this ensures the repository changes
run after all projects are evaluated without attempting to register
afterEvaluate on an already-evaluated project.

)

The afterEvaluate approach fails because evaluationDependsOn(":app")
already evaluates the project. Add jcenter() directly to allprojects
repositories as a fallback for usb_serial and other plugins that still
need it.

Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>
@github-actions
Copy link
Copy Markdown

Build Successful

Version: v1.8.5

Download APKs

Architecture Download
arm64-v8a (recommended) OpenClaw-v1.8.5-arm64-v8a.apk
armeabi-v7a (32-bit) OpenClaw-v1.8.5-armeabi-v7a.apk
x86_64 (emulator) OpenClaw-v1.8.5-x86_64.apk
Universal (all ABIs) OpenClaw-v1.8.5-universal.apk
App Bundle (Play Store) OpenClaw-v1.8.5.aab

Download from Actions Artifacts


Built from baec708 by GitHub Actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant