Skip to content

refactor(gui): react-doctor cleanup for App, Logs, Subagents#471

Merged
Wibias merged 5 commits into
lidge-jun:devfrom
Wibias:fix/react-doctor-logs-subagents-app
Jul 26, 2026
Merged

refactor(gui): react-doctor cleanup for App, Logs, Subagents#471
Wibias merged 5 commits into
lidge-jun:devfrom
Wibias:fix/react-doctor-logs-subagents-app

Conversation

@Wibias

@Wibias Wibias commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • App: client-resource polling + status-checked fetches.
  • Logs/Subagents: fetch status checks, busy/loading guards, Logs tab keydown helper.
  • Keeps current viewMode / SubagentsWorkspace integration.

Stack

Test plan

  • bun x tsc -b in gui/
  • Smoke App nav health/claude toggle, Logs tabs/refresh, Subagents save (incl. double-click)

Summary by CodeRabbit

  • New Features

    • Logs and Debug tabs now support keyboard navigation and persist the selected tab in the URL hash.
    • Runtime version refreshes automatically, showing a fallback when health info is unavailable.
  • Bug Fixes

    • Claude connection toggle is more reliable under rapid clicking, with optimistic UI updates and rollback on errors.
    • Subagent “Save” now blocks concurrent edits during in-flight requests, with improved handling of invalid payloads and server error messages.
  • Tests

    • Added/expanded tests covering Claude toggle race conditions, Subagent busy behavior, and logs tab keyboard/hash logic.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Wibias, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7627a4e3-365e-43f4-8375-9e4e7168e5fa

📥 Commits

Reviewing files that changed from the base of the PR and between 3c75294 and c9ba752.

📒 Files selected for processing (2)
  • gui/src/pages/Subagents.tsx
  • gui/tests/subagents-busy-race.test.tsx
📝 Walkthrough

Walkthrough

The GUI now uses client-resource polling for runtime and Claude state, shared helpers for Logs tab navigation, and guarded JSON/error handling with busy-state protection for Subagents saves.

Changes

GUI state and interaction updates

Layer / File(s) Summary
App client-resource polling and Claude toggle
gui/src/App.tsx, gui/tests/claude-toggle-race.test.tsx
Health and Claude state use keyed client resources; Claude toggles update optimistically, serialize requests, and revert on failure.
Shared Logs tab navigation
gui/src/pages/logs-tab-keydown.ts, gui/src/pages/Logs.tsx, gui/tests/logs-tab-keydown.test.ts
Tab hash parsing, selection, keyboard handling, and focus management are centralized and tested.
Subagents request validation and save state
gui/src/pages/Subagents.tsx, gui/tests/subagents-classic.test.tsx, gui/tests/subagents-busy-race.test.tsx
Model responses use stricter JSON parsing, saves block concurrent edits, error bodies are parsed, controls are disabled while saving, and server-applied state is tested.

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

Possibly related PRs

Suggested labels: bug

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main refactor scope and names the affected GUI areas.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions github-actions Bot added the chore label Jul 25, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Wibias added 2 commits July 26, 2026 03:46
Harden fetch status checks, loading/busy guards, and extract Logs tab keydown helper while keeping viewMode wiring.
Guard readJsonOrThrow undefined bodies and align the classic Subagents fetch mock with text()-based status checks.
@Wibias
Wibias force-pushed the fix/react-doctor-logs-subagents-app branch from 03e0d3b to e664956 Compare July 26, 2026 01:50
@Wibias

Wibias commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto upstream/dev (dropped foundations stack; #466 already landed).

  • gui/src/api.ts is no longer in this PR diff — Codex token-storage security thread should clear as outdated.
  • Kept App client-resource polling, Logs logs-tab-keydown helper + silent refresh, Subagents busy/status-checked load/save; dropped deleted SubagentsWorkspace / viewMode wiring during conflict resolution.
  • Follow-up: empty-body guard for readJsonOrThrow + Subagents test mock aligned to text()-based fetch helpers.

Tip: e6649563. Verified: bun x tsc -b in gui/; logs/subagents/client-resource tests green (17).

coderabbitai[bot]

This comment was marked as resolved.

…y, logs keydown tests

Serialize Claude toggle PUTs with an in-flight guard, disable Subagents mutations while saving, and cover logs tab keyboard helpers.
@Wibias

Wibias commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

CodeRabbit review fixes (7dad03ca)

Addressed the three open CodeRabbit findings on this PR:

  1. gui/src/App.tsx — Serialize Claude toggle
    Guarded toggleClaude with an in-flight ref + pending state; Switch is disabled while the PUT is in flight so overlapping optimistic updates cannot race.

  2. gui/src/pages/logs-tab-keydown.ts — Focused tests
    Added gui/tests/logs-tab-keydown.test.ts covering ArrowLeft/ArrowRight/Home/End, unrelated keys, hash parsing (readTabFromHash / selectLogsTab), and focus targets.

  3. gui/src/pages/Subagents.tsx — Busy-state consistency
    Disabled reorder/remove/toggle controls while busy; handlers also no-op when busy; reconcile chosen from d.applied after a successful save.

Skipped the outdated Codex comment on gui/src/api.ts token storage (foundations; not in this PR).

Verification

  • bun test tests/logs-tab-keydown.test.ts tests/subagents-classic.test.ts tests/subagents-classic.test.tsx — 11 pass
  • bun x tsc -b — pass
  • bun run lint (gui) — pass

Add focused regressions for serialized Claude toggle PUTs and Subagents edit-blocking plus applied reconciliation while a save is in flight.
@Wibias

Wibias commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Verify / fix status (Claude toggle + Subagents busy races)

Baseline: origin tip was already 7dad03ca (CodeRabbit pass). Behavior was already complete — no production code changes.

Verified behavior (unchanged):

  1. Claude toggle PUTs serialized via claudeToggleInFlight + switch disabled while pending (gui/src/App.tsx)
  2. Subagents blocks toggle/remove/reorder while busy, then reconciles chosen from d.applied after successful save

Added tests (new SHA 3c75294b):

  • gui/tests/claude-toggle-race.test.tsx — rapid-click issues one PUT until settle
  • gui/tests/subagents-busy-race.test.tsx — edits blocked during save; applied reconciliation

Verification run:

  • bun run typecheck (root) — pass
  • bun x tsc -b --noEmit (gui) — pass
  • bun test tests (gui, 176 tests) — pass
  • bun run test (root suite) — pass

Result: behavior already complete at 7dad03ca; tests-only follow-up pushed as 3c75294b.

coderabbitai[bot]

This comment was marked as resolved.

Mirror the Claude toggle in-flight pattern so rapid Save clicks cannot race before busy re-renders, and reuse readJsonOrThrow for PUT error/success parsing.
@Wibias
Wibias merged commit 7e2cee4 into lidge-jun:dev Jul 26, 2026
8 of 9 checks passed
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.

1 participant