Skip to content

refactor(ui): extract reconnect timing constants in GatewayBrowserClient#30414

Closed
liuxiaopai-ai wants to merge 1 commit intoopenclaw:mainfrom
liuxiaopai-ai:codex/issue-30402-reconnect-constants
Closed

refactor(ui): extract reconnect timing constants in GatewayBrowserClient#30414
liuxiaopai-ai wants to merge 1 commit intoopenclaw:mainfrom
liuxiaopai-ai:codex/issue-30402-reconnect-constants

Conversation

@liuxiaopai-ai
Copy link

@liuxiaopai-ai liuxiaopai-ai commented Mar 1, 2026

Summary

  • extract reconnect/backoff magic numbers in ui/src/ui/gateway.ts into named constants
  • replace inline values in backoff initialization/reset, exponential growth cap, and connect queue delay
  • add short comments explaining reconnect tuning intent

Fixes #30402.

Testing

  • pnpm --dir ui exec vitest run --config vitest.config.ts src/ui/app-gateway.node.test.ts
  • pnpm exec oxlint ui/src/ui/gateway.ts
  • pnpm exec oxfmt --check ui/src/ui/gateway.ts

Notes

  • pnpm --dir ui test currently reports existing unrelated failures in cron/config-form view suites on upstream main; this PR does not touch those areas.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 1, 2026

Greptile Summary

Extracted four magic numbers into well-named constants (RECONNECT_INITIAL_BACKOFF_MS, RECONNECT_BACKOFF_MULTIPLIER, RECONNECT_MAX_BACKOFF_MS, CONNECT_QUEUE_DELAY_MS) in GatewayBrowserClient, improving code readability and maintainability. All values match their original counterparts, preserving existing behavior.

  • Replaced hardcoded reconnection timing values with descriptive constants
  • Added clear comments explaining reconnection strategy (conservative initial retry with bounded exponential backoff)
  • No functional changes, purely a code quality improvement

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - purely a code quality refactoring with no behavioral changes
  • Score of 5 reflects a straightforward refactoring that extracts magic numbers into named constants without changing any logic. All constant values match their original hardcoded counterparts exactly, the tests pass, and the changes improve code maintainability
  • No files require special attention

Last reviewed commit: a777d85

@steipete
Copy link
Contributor

steipete commented Mar 2, 2026

Thanks for the PR! Multiple PRs address the same gateway reconnect magic-numbers refactor (#30407, #30414, #30435, #30498, #31587). Keeping #30407 as the earliest submission. Closing this one to reduce noise. This is an AI-assisted triage review. If we got this wrong, feel free to reopen or start a new PR — happy to revisit.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: Extract magic numbers in GatewayBrowserClient reconnect logic into named constants

2 participants