Skip to content

fix: parameterize magic numbers in ensureA2uiReady (issue #22745) - #22807

Closed
ambicuity wants to merge 1 commit into
openclaw:mainfrom
ambicuity:fix/issue-22745-clean
Closed

ambicuity wants to merge 1 commit into
openclaw:mainfrom
ambicuity:fix/issue-22745-clean

Conversation

@ambicuity

@ambicuity ambicuity commented Feb 21, 2026 •

Copy link
Copy Markdown

Fixes #22745. Recreating PR 22785 from a clean branch to resolve bot closure.

Greptile Summary

Extracted hardcoded magic numbers (50 retries, 120ms delay) from ensureA2uiReady into configurable parameters with sensible defaults, addressing issue #22745.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is simple, well-scoped, and backward-compatible. It adds optional parameters with sensible defaults that match the previous hardcoded values. All existing call sites remain functional without modification. No logical errors, security issues, or runtime risks identified.
  • No files require special attention

Last reviewed commit: 498d597

Copilot AI review requested due to automatic review settings February 21, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses issue #22745 by parameterizing the hardcoded "magic numbers" (50 and 120) in the ensureA2uiReady function of the Android A2UIHandler class. The function previously used fixed values for the number of retry attempts and delay between attempts, which could not be adjusted for different scenarios or devices.

Changes:

  • Added two optional parameters to ensureA2uiReady: numberOfTries (default 50) and delayToWaitMs (default 120L)
  • Replaced hardcoded values with the new parameters in the retry loop

suspend fun ensureA2uiReady(
a2uiUrl: String,
numberOfTries: Int = 50,
delayToWaitMs: Long = 120L

Copilot AI Feb 21, 2026

Copy link

Choose a reason for hiding this comment

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

The parameter name delayToWaitMs is inconsistent with the codebase convention. Other Android Kotlin files use the simpler naming pattern delayMs for delay parameters in milliseconds. For example, TalkModeManager.kt and VoiceWakeManager.kt both use delayMs: Long as a parameter name. Consider renaming this to delayMs for consistency.

Copilot uses AI. Check for mistakes.
suspend fun ensureA2uiReady(a2uiUrl: String): Boolean {
suspend fun ensureA2uiReady(
a2uiUrl: String,
numberOfTries: Int = 50,

Copilot AI Feb 21, 2026

Copy link

Choose a reason for hiding this comment

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

The parameter name numberOfTries is inconsistent with the codebase convention for parameters passed to repeat(). The established pattern in this Android codebase uses the naming format maxXAttempts (e.g., maxScaleAttempts, maxQualityAttempts in JpegSizeLimiter.kt). Consider renaming this to maxAttempts for consistency with the established convention.

Copilot uses AI. Check for mistakes.
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Feb 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #pr-thunderdome-dangerzone on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

@openclaw-barnacle openclaw-barnacle Bot closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Why Use of Magic Numbers ?

2 participants