Skip to content

fix(dashboard): read management health and link the account-mode badge - #8535

Merged
lidge-jun merged 1 commit into
devfrom
fix/dashboard-health-account-mode
Nov 11, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/dashboard-health-account-mode

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

#8506 — a healthy hub read as offline on its management origin. Home and the sidebar polled /healthz, which a Remote Hub's management ingress deliberately answers with 404, so Home said "The proxy is not answering" and the sidebar "Proxy Offline" while every other panel loaded.

  • Home and the self-update reload check now read the authenticated /api/system/health (same body: status, version, uptime, pid) — the route fetchDashboardOverview and the restart reconnect already use.
  • The sidebar picks its path by plane (machineHealthPath in gui/src/lib/proxy-health.ts): a connected Child's machine listener admits only /healthz, so it keeps that (targets.connected || isConnectedRuntime(), which also covers failed discovery); everywhere else machine and shared are one management origin and get /api/system/health.
  • readManagementHealth treats a 401/403 as "the process answered, version unknown", so a public standalone before its token prompt or a hub before pairing does not flip to Offline.
  • stop-proxy.ts and remote-link-api.ts keep reading /healthz on purpose (identity without a session); gui/classic is a frozen snapshot.

#8501 — the Direct badge did not lead to the setting that changes it. The Codex Auth Pool/Direct badge is now a button (chevron affordance, aria-label "Direct mode — Change account mode") that opens #providers?provider=openai&focus=account-mode. That deep link selects OpenAI, opens Settings and focuses the Codex account mode Select (pws-codex-account-mode; the field when the trigger is disabled during a save). The badge only navigates — switching to Pool stays the Select's confirmed choice. tab=accounts wins over focus, and choosing another provider drops the whole query. The Direct help text link now reads "Change account mode" and goes to the same place; the non-canonical row's link opens OpenAI's settings.

Closes #8506
Closes #8501

Screenshots

Hub with separate data (:18100) and management (:18101) listeners, dashboard opened on the management origin (management /healthz → 404, /api/system/health → 401 without a session, 200 with one).

Before (dev) After
before after

Codex Auth badge, before and after (cropped to the banner; the account card is omitted):

badge before
badge after

After clicking the badge in a real browser: location.hash = #providers?provider=openai&focus=account-mode, document.activeElement.id = pws-codex-account-mode (value direct).

account mode focused

Verification

  • Failing first on dev: the new/extended GUI tests failed before the fix (management-health-probe missing exports; home-management-health 2 fail; codex-account-mode-badge 4 fail; protocol-deep-links missing exports; providers-deep-link 2 fail; dashboard-contracts 1 fail; provider-settings-account-mode focus case fail).
  • After: those nine files 61 pass / 0 fail.
  • cd gui && bun run lint ✅, bun run lint:i18n ✅ (new key codexAuth.changeAccountMode in all 11 locales), bun run build ✅.
  • cd gui && bun test tests: 4379 pass / 43 fail. The same command on a pristine origin/dev export on this host: 4340 pass / 47 fail, same failing files (models-visibility-queue, kiro-device-login, codex-auto-switch-controller, …); each of those files passes alone. No new failure.
  • Root: bun run typecheck ✅, bun run privacy:scan ✅, bun run structure:check ✅ (structure/dashboard-and-usage.md updated for the probe rule and the focus deep link), test-layout + file-size ratchet guards ✅.
  • Browser: hub config above, Home/sidebar online on the management origin; badge click verified in a real browser.

NOT RUN: a connected Child (Remote Link) browser session — covered by the plane rule and its unit tests; full root bun run test (GUI-only change; CI runs test changed).

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • New Features
    • Account-mode badges and help links now open the relevant OpenAI provider settings directly, with the account-mode control brought into focus. The account-mode action is available in supported languages.
  • Bug Fixes
    • Health checks now use the appropriate endpoint for each runtime. The uptime tile appears only when the service is online and uptime is available, avoiding misleading zero values.
  • Documentation
    • Updated guidance for account-mode links and health checks.

Home and the sidebar polled /healthz, which a Remote Hub's management
ingress answers with 404, so a healthy hub read as "The proxy is not
answering" / "Proxy Offline" (#8506). Home and the self-update reload
check now read the authenticated /api/system/health; the sidebar keeps
/healthz only for a connected Child's machine listener (which admits
nothing else) and treats a 401/403 as reachable.

The Codex Auth Pool/Direct badge is now a button that opens
#providers?provider=openai&focus=account-mode, which selects OpenAI,
opens Settings and focuses the Codex account mode control (#8501).
Changing the mode stays the control's confirmed choice.

Closes #8506
Closes #8501
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 11, 2026 09:56
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T09:58:06.788923Z 18c1d9e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the bug Something isn't working label Nov 11, 2026
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The dashboard now uses management health endpoints for status, uptime, and update checks. Codex Auth account-mode navigation now opens OpenAI provider settings and can focus the account-mode control.

Changes: Management health probes

Layer / File(s) Summary
Management health response and parsing
gui/src/lib/proxy-health.ts, gui/tests/management-health-probe.test.ts
The shared probe selects /healthz for connected runtimes and /api/system/health otherwise. It parses valid version and uptime values, treats 401/403 as a responding process with unknown values, and returns null for other non-OK responses. Tests cover path selection and response parsing.
Dashboard health callers
gui/src/App.tsx, gui/src/pages/Home.tsx, gui/src/pages/use-dashboard-data.ts, gui/tests/dashboard-contracts.test.ts, gui/tests/home-management-health.test.tsx, structure/dashboard-and-usage.md
The sidebar selects its health path based on connection state. Home and update checks use /api/system/health. Home preserves missing uptime as null and displays the uptime tile only when online with a value. Tests cover endpoint use and Home response handling.

Account-mode deep links

Layer / File(s) Summary
Account-mode deep-link protocol
gui/src/protocol-deep-links.ts, gui/tests/protocol-deep-links.test.ts
The protocol supports focus=account-mode, builds and reads account-mode links, and announces a hash change when the target link is already active.
Provider settings focus handoff
gui/src/pages/providers-deep-link.ts, gui/src/pages/Providers.tsx, gui/src/components/provider-workspace/ProviderDetails.tsx, gui/src/components/provider-workspace/ProviderSettings.tsx, gui/tests/providers-deep-link.test.tsx, gui/tests/provider-settings-account-mode.test.tsx, structure/dashboard-and-usage.md
The Providers route passes the requested focus field to provider settings. ProviderSettings scrolls to and focuses the account-mode control, or its containing field if the select is unavailable. Accounts-tab links take precedence, and changing providers clears the field focus.
Codex Auth navigation entry points
gui/src/pages/codex-set-multiauth.tsx, gui/src/i18n/*.ts, gui/tests/codex-account-mode-badge.test.tsx
The account-mode badge and help link open the focused account-mode setting. The invalid-provider link opens OpenAI provider settings without the account-mode focus parameter. The new action label is translated across the listed catalogs.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant OpenAiAccountModeBanner
  participant openProviderAccountMode
  participant ProvidersDeepLink
  participant ProviderDetails
  participant ProviderSettingsForm
  OpenAiAccountModeBanner->>openProviderAccountMode: Open account-mode deep link
  openProviderAccountMode->>ProvidersDeepLink: Set or announce target hash
  ProvidersDeepLink->>ProviderDetails: Pass provider and account-mode focus
  ProviderDetails->>ProviderSettingsForm: Pass focus token
  ProviderSettingsForm->>ProviderSettingsForm: Scroll to and focus account-mode control
Loading

Possibly related issues

  • lidge-jun/opencodex#8246 — The update check now probes /api/system/health and compares its reported version, which is also the update-verification path described in this issue.

Possibly related PRs

  • lidge-jun/opencodex#8105 — That PR changes the account-mode control in ProviderSettings; this PR adds focus behavior and an ID for that control.

Suggested labels: bug

Suggested reviewers: robin-bially

Merge Risk: Minimal · up to 18c1d

The change moves the dashboard health checks to the management endpoint and makes the account-mode badge link to the focused setting. No concrete merge-blocking risk was found. The connected Child browser flow and the full root test suite were not run by the author.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies both primary changes: reading management health and linking the account-mode badge. It is specific and matches the pull request objectives.
Linked Issues check Passed The PR meets the coding requirements for [#8506] and [#8501]. For [#8506], gui/src/lib/proxy-health.ts defines machineHealthPath() and readManagementHealth(). The probe uses /healthz for a con…
Out of Scope Changes check Passed The changes stay within [#8506] and [#8501]. The health helper, dashboard callers, restart check, and related tests implement the management-health behavior. The provider deep-link, focus plumbing, lo…
Full details: Linked Issues check

Explanation

The PR meets the coding requirements for [#8506] and [#8501]. For [#8506], gui/src/lib/proxy-health.ts defines machineHealthPath() and readManagementHealth(). The probe uses /healthz for a connected Child and /api/system/health elsewhere. It treats 401 and 403 as a responding process with unknown health details. gui/src/App.tsx uses the selected path for the sidebar poll. gui/src/pages/Home.tsx and gui/src/pages/use-dashboard-data.ts use authenticated management health. gui/tests/management-health-probe.test.ts, gui/tests/home-management-health.test.tsx, and gui/tests/dashboard-contracts.test.ts cover the route selection and response handling. For [#8501], gui/src/pages/codex-set-multiauth.tsx makes the settled mode badge keyboard-accessible and opens the account-mode deep link. gui/src/protocol-deep-links.ts, gui/src/pages/providers-deep-link.ts, gui/src/components/provider-workspace/ProviderDetails.tsx, and gui/src/components/provider-workspace/ProviderSettings.tsx implement provider selection, focus handling, and control focus without changing the selected mode. The Direct help link uses the same destination. gui/tests/codex-account-mode-badge.test.tsx, gui/tests/protocol-deep-links.test.ts, gui/tests/providers-deep-link.test.tsx, and gui/tests/provider-settings-account-mode.test.tsx cover the navigation and focus behavior. The reported lint, build, typecheck, and focused test results provide additional verification.

Full details: Out of Scope Changes check

Explanation

The changes stay within [#8506] and [#8501]. The health helper, dashboard callers, restart check, and related tests implement the management-health behavior. The provider deep-link, focus plumbing, localized label, documentation, and tests implement account-mode discovery. The retained /healthz calls in stop-proxy.ts and remote-link-api.ts are documented as identity checks without a session, so they are not unrelated changes. No unrelated feature, cleanup, or broad refactor is established by the reviewed summary.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 15 functions across 22 files. (7 skipped: 1 unsupported, 6 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5cc64ae and 18c1d9e.

Files selected for processing: 29

  • gui/src/App.tsx
  • gui/src/components/provider-workspace/ProviderDetails.tsx
  • gui/src/components/provider-workspace/ProviderSettings.tsx
  • gui/src/i18n/de.ts
  • gui/src/i18n/en.ts
  • gui/src/i18n/fr.ts
  • gui/src/i18n/ja.ts
  • gui/src/i18n/ko.ts
  • gui/src/i18n/pt.ts
  • gui/src/i18n/ru.ts
  • gui/src/i18n/tr.ts
  • gui/src/i18n/vi.ts
  • gui/src/i18n/zh-TW.ts
  • gui/src/i18n/zh.ts
  • gui/src/lib/proxy-health.ts
  • gui/src/pages/Home.tsx
  • gui/src/pages/Providers.tsx
  • gui/src/pages/codex-set-multiauth.tsx
  • gui/src/pages/providers-deep-link.ts
  • gui/src/pages/use-dashboard-data.ts
  • gui/src/protocol-deep-links.ts
  • gui/tests/codex-account-mode-badge.test.tsx
  • gui/tests/dashboard-contracts.test.ts
  • gui/tests/home-management-health.test.tsx
  • gui/tests/management-health-probe.test.ts
  • gui/tests/protocol-deep-links.test.ts
  • gui/tests/provider-settings-account-mode.test.tsx
  • gui/tests/providers-deep-link.test.tsx
  • structure/dashboard-and-usage.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer judgment

Value: #8506 is a false outage on every hub opened through its management origin: Home says "The proxy is not answering", the sidebar "Proxy Offline", while the proxy serves traffic. #8501 removes a dead end: the mode badge now goes straight to the one control that changes it.

UX change scope: Home/sidebar status now reflects the authenticated management health route; the Codex Auth Pool/Direct badge becomes a button (chevron, same badge look) that opens Providers → OpenAI → Settings with the account mode control focused. Mode switching itself is unchanged (still the Select's confirmed dialog).

Regression evidence for existing users:

  • Standalone loopback: /api/system/health is the same origin and already used by the Dashboard overview; screenshots show Online.
  • Connected Child: the sidebar keeps /healthz because the machine listener admits only that (targets.connected || isConnectedRuntime(), so failed discovery is covered).
  • Public standalone before the token prompt / hub before pairing: 401/403 counts as reachable, so they do not flip to Offline.
  • Existing #providers?provider=… and &tab=accounts links behave as before (tests); tab=accounts wins over focus.
  • Full GUI suite on this host: same pre-existing cross-file failures as a pristine dev export (43 vs 47), nothing new.

Windows impact: none specific; browser-side only, no path or process change.

Verification: failing-first GUI tests (12 failing on dev, 0 at head), gui lint / lint:i18n / build, root typecheck, privacy:scan, structure:check, layout and ratchet guards; real hub with separate data (:18100) and management (:18101) listeners, before/after captures; badge click verified in a real browser (hash + document.activeElement). Fresh independent review at 18c1d9e: PASS. Low residuals from that review, accepted: focus falls back to the field label (no role) when the Select is disabled mid-save; the sidebar plane choice is guarded by a source contract plus the helper's unit tests rather than an App render test.

NOT RUN: a connected Child browser session; full root bun run test locally (GUI-only change, CI test changed green).

@lidge-jun
lidge-jun merged commit 0873b5c into dev Nov 11, 2026
32 checks passed
@lidge-jun
lidge-jun deleted the fix/dashboard-health-account-mode branch November 11, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

1 participant