Skip to content

fix(reborn): clear chat sidebar highlight off chat routes - #5592

Merged
think-in-universe merged 5 commits into
mainfrom
issue-5556-active-chat-sidebar-highlight
Jul 6, 2026
Merged

think-in-universe merged 5 commits into
mainfrom
issue-5556-active-chat-sidebar-highlight

Conversation

@italic-jinxin

Copy link
Copy Markdown
Contributor

Summary

  • Clears the active chat highlight in the WebChat v2 sidebar when the current route is no longer /chat/:threadId.
  • Derives the sidebar-selected thread from the current pathname instead of the retained global active thread state.
  • Adds focused coverage for chat routes, non-chat routes like Automations/Workspace/Settings, and nested non-chat thread paths.
iShot_2026-07-03_17 47 31

Linked Issue

Closes #5556

Validation

  • node --check crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.js
  • node --check crates/ironclaw_webui_v2/static/js/components/sidebar.js
  • node --test crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.test.mjs
  • node --test crates/ironclaw_webui_v2/static/js/hooks/useSidebar.test.mjs crates/ironclaw_webui_v2/static/js/app/routes.test.mjs
  • IRONCLAW_WEBUI_V2_DIST_DIR=/tmp/ironclaw-webui-v2-dist-check npm run build
  • git diff --check HEAD^ HEAD

Security Impact

No security-sensitive behavior changes. UI selection state only.

Database Impact

No schema or migration changes.

Blast Radius

Limited to WebChat v2 sidebar presentation and a small route parsing helper.

Rollback Plan

Revert this PR to restore the previous sidebar selection behavior.

@italic-jinxin italic-jinxin added size: M 50-199 changed lines risk: low Changes to docs, tests, or low-risk modules contributor: core 20+ merged PRs skip-regression-check Bypass regression test CI gate (tests exist but not in tests/ dir) labels Jul 3, 2026
@railway-app
railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5592 July 3, 2026 09:48 Destroyed
@github-actions github-actions Bot added size: S 10-49 changed lines and removed size: M 50-199 changed lines labels Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 584ad3ed-9f2a-4698-bd7c-2f9bc19cdf30

📥 Commits

Reviewing files that changed from the base of the PR and between 35da0c5 and 00d17b4.

📒 Files selected for processing (3)
  • crates/ironclaw_webui_v2/static/js/layout/gateway-layout.js
  • crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.js
  • crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.test.mjs

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • The app now keeps the active thread in sync with the current chat URL, so opening or refreshing a thread page highlights the correct conversation.
  • Bug Fixes

    • Improved handling of chat links with trailing slashes, query strings, hashes, and encoded thread IDs.
    • Non-chat or nested routes no longer incorrectly mark a thread as active.
    • Deleting the currently viewed thread now updates the sidebar and page state more reliably.

Walkthrough

Adds activeRouteThreadIdFromPath and routeSynchronizedThreadsState helper functions to parse the active chat thread id from a URL pathname and derive a route-synchronized threads state. GatewayLayout is updated to compute and use these values for notifications, Sidebar, PageHeader, Outlet context, and thread deletion logic. Unit tests are added for the helpers.

Changes

Route-aware sidebar active thread

Layer / File(s) Summary
Path-parsing and state-sync helpers
crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.js, crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.test.mjs
Adds activeRouteThreadIdFromPath to extract a decoded thread id from /chat/<id> pathnames (rejecting nested/query/hash paths) and routeSynchronizedThreadsState to derive an updated threads state; covered by node:test cases for direct, trailing-slash, encoded, non-chat, and nested route scenarios.
GatewayLayout wiring to route-derived active thread
crates/ironclaw_webui_v2/static/js/layout/gateway-layout.js
Computes activeRouteThreadId and routeThreadsState via useMemo from location.pathname; wires them into useNotifications, Sidebar, PageHeader, and Outlet context; updates handleDeleteThread's active-thread check and dependency list; consolidates the duplicate useLocation call.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Router
  participant GatewayLayout
  participant activeRouteThreadIdFromPath
  participant routeSynchronizedThreadsState
  participant Sidebar

  Router->>GatewayLayout: location.pathname
  GatewayLayout->>activeRouteThreadIdFromPath: parse(pathname)
  activeRouteThreadIdFromPath-->>GatewayLayout: threadId or null
  GatewayLayout->>routeSynchronizedThreadsState: (threadsState, pathname)
  routeSynchronizedThreadsState-->>GatewayLayout: routeThreadsState
  GatewayLayout->>Sidebar: threadsState=routeThreadsState
Loading

Possibly related issues

Possibly related PRs

  • nearai/ironclaw#5491: Both PRs touch how activeThreadId is derived/synchronized from location.pathname in GatewayLayout, feeding downstream consumers that rely on this value.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Conventional-commit style title clearly matches the sidebar route-synchronization fix.
Description check ✅ Passed The description covers summary, linked issue, validation, security, database, rollback, and blast radius; missing sections are non-critical.
Linked Issues check ✅ Passed The route-derived sidebar state and tests address #5556 by clearing the chat highlight when leaving /chat/:threadId.
Out of Scope Changes check ✅ Passed The changes stay focused on sidebar route syncing, helper extraction, and coverage for the reported issue.

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.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a utility function activeSidebarThreadIdFromPath to extract the active thread ID from the current location pathname, updating the Sidebar component to use it. Feedback suggests robustifying this utility by stripping query parameters and hash fragments from the path before parsing, along with adding corresponding test cases to verify this behavior.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.js Outdated
Comment thread crates/ironclaw_webui_v2/static/js/lib/sidebar-active-thread.test.mjs Outdated
@railway-app
railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5592 July 3, 2026 09:54 Destroyed
@italic-jinxin

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

This comment was marked as resolved.

@railway-app
railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5592 July 3, 2026 10:04 Destroyed
@github-actions github-actions Bot added size: M 50-199 changed lines and removed size: S 10-49 changed lines labels Jul 3, 2026
@railway-app

railway-app Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the ironclaw-pr-5592 environment in ironclaw-ci-preview

Service Status Web Updated (UTC)
ironclaw ✅ Success (View Logs) Web Jul 4, 2026 at 2:29 am

@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ 3 Reborn crate(s) have 0 int-tier coverage (target: 0) — ironclaw_reborn_identity, ironclaw_reborn_traces, ironclaw_webui_v2

Reborn integration-tier coverage

Line coverage (Reborn crates): 16.85% — 10833 / 64279 lines

Per-crate breakdown (11 crates, lowest-covered first)
Crate Line % Covered / Total
ironclaw_reborn_identity 0% 0 / 230
ironclaw_reborn_traces 0% 0 / 6769
ironclaw_webui_v2 0% 0 / 2785
ironclaw_reborn_event_store 0.73% 6 / 825
ironclaw_reborn_config 1.31% 15 / 1142
ironclaw_product_adapter_registry 5.12% 25 / 488
ironclaw_product_workflow 7.22% 715 / 9905
ironclaw_product_adapters 12.55% 283 / 2255
ironclaw_reborn 23.38% 2036 / 8707
ironclaw_reborn_composition 24.85% 7742 / 31159
ironclaw_product_context 78.57% 11 / 14

This signal is informational: coverage never gates the PR — not the percentage, not the per-crate holes, not the 0-coverage callout.

@railway-app
railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5592 July 3, 2026 10:31 Destroyed
@italic-jinxin italic-jinxin self-assigned this Jul 3, 2026
@italic-jinxin
italic-jinxin requested a review from serrrfirat July 3, 2026 12:53
@ironloopai

ironloopai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

IronLoop Review Status

Head: ad315f958dce474e32883b14451e695177c944df
Updated: 2026-07-04T02:22:57.440Z
Admission: webhook accepted the request and IronLoop persisted review state before this projection.

Current reviewers:

Reviewer State What it means Last update
none Queued No reviewer jobs scheduled yet. n/a

Recent activity:

Time Reviewer State Detail
n/a n/a Waiting No progress events recorded yet.

Commands:

  • @ironloop review
  • @ironloop review <agent-alias>
  • @ironloop status

@railway-app
railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-5592 July 4, 2026 02:22 Destroyed
@italic-jinxin italic-jinxin added the human-verified Manually tested and verified label Jul 6, 2026
@think-in-universe
think-in-universe added this pull request to the merge queue Jul 6, 2026
Merged via the queue into main with commit f02e8d4 Jul 6, 2026
108 checks passed
@think-in-universe
think-in-universe deleted the issue-5556-active-chat-sidebar-highlight branch July 6, 2026 09:04

This branch was successfully deployed

No deployments
ironclaw-ci-preview / ironclaw-pr-5592 — ad315f95 Deployed Jul 4, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs human-verified Manually tested and verified risk: low Changes to docs, tests, or low-risk modules size: M 50-199 changed lines skip-regression-check Bypass regression test CI gate (tests exist but not in tests/ dir)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Active chat remains highlighted in sidebar after navigating away

3 participants