Repository navigation
Conversation
- Redirect reserved or invalid `/chat/:threadId` routes back to `/chat`. - Wait for the thread list to settle before deciding a deep-linked thread is missing. - Keep locally created/selected threads active while the thread list refetch catches up. - Add caller-level ChatPage regression coverage and regenerate the WebUI v2 bundle. - [x] Bug fix - [ ] New feature - [ ] Refactor - [ ] Documentation - [ ] CI/Infrastructure - [ ] Security - [ ] Dependencies Fixes #5077 - [ ] `cargo fmt --all -- --check` - [ ] `cargo clippy --all --benches --tests --examples --all-features -- -D warnings` - [ ] `cargo build` - [x] Relevant tests pass: - `node --test crates/ironclaw_webui_v2_static/static/js/pages/chat/chat-page.test.mjs crates/ironclaw_webui_v2_static/static/js/pages/chat/lib/useHistory.test.mjs crates/ironclaw_webui_v2_static/static/js/pages/chat/hooks/useThreads.test.mjs` - `node --check crates/ironclaw_webui_v2_static/static/js/pages/chat/chat-page.test.mjs` - `cargo test -p ironclaw_webui_v2_static` - [ ] `cargo test --features integration` if database-backed or integration behavior changed - [ ] Manual testing - [ ] If a coding agent was used and supports it, `review-pr` or `pr-shepherd --fix` was run before requesting review None. N/A. This is WebUI route-state handling only; it does not change Reborn runtime, trust-bearing types, prompts, sandboxing, command execution, auth, or persistence. None. WebUI v2 chat routing and thread selection state only. Possible impact is limited to `/chat`, `/chat/:threadId`, chat deep links, and active chat rendering while the thread list loads/refetches. Revert this commit to restore the previous ChatPage behavior and regenerated bundle. No known follow-up. Reviewer attention requested on the loading/refetch edge case: a locally selected newly created thread should not be cleared before the thread list catches up. --- **Review track**: B
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughSummary by CodeRabbitRelease Notes
Walkthrough
ChangesChat URL routing hardening
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the routing and thread selection logic in ChatPage to handle loading states, deep links, and malformed or reserved routes, supported by a new suite of unit tests and additional state flags in the useThreads hook. The review feedback highlights a potential UX issue where deep-linking to a valid thread briefly displays a blank composer while loading, and suggests preserving the thread ID during this state. Additionally, the feedback recommends removing a redundant dependency from the useEffect dependency array and updating the corresponding test assertion to align with the improved loading 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.
….test.mjs Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/ironclaw_webui_v2_static/static/js/pages/chat/chat-page.test.mjs`:
- Line 162: In the test case for the "wait for thread list" scenario in
chat-page.test.mjs, the assertion on line 162 for
result.chatProps.activeThreadId currently expects "thread-1", but this
contradicts the test scenario where isLoaded is false and no local selection
exists. Update the assertion to expect an unset value (such as undefined, null,
or empty string depending on the implementation) instead of "thread-1", as
activeThreadId should remain unset until the thread list finishes loading and
resolves the route-sync contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 621cde3a-9cb6-4e11-b7c0-84479a517265
📒 Files selected for processing (1)
crates/ironclaw_webui_v2_static/static/js/pages/chat/chat-page.test.mjs
|
|
||
| assert.deepEqual(result.navigateCalls, []); | ||
| assert.deepEqual(result.setActiveThreadIdCalls, []); | ||
| assert.equal(result.chatProps.activeThreadId, "thread-1"); |
There was a problem hiding this comment.
Expected value is inverted for the “wait for thread list” case.
Line 162 currently asserts "thread-1", but this scenario (isLoaded: false, no local selection) should keep activeThreadId unset until the list settles. This assertion contradicts the route-sync contract and the test intent.
Proposed fix
- assert.equal(result.chatProps.activeThreadId, "thread-1");
+ assert.equal(result.chatProps.activeThreadId, null);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| assert.equal(result.chatProps.activeThreadId, "thread-1"); | |
| assert.equal(result.chatProps.activeThreadId, null); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/ironclaw_webui_v2_static/static/js/pages/chat/chat-page.test.mjs` at
line 162, In the test case for the "wait for thread list" scenario in
chat-page.test.mjs, the assertion on line 162 for
result.chatProps.activeThreadId currently expects "thread-1", but this
contradicts the test scenario where isLoaded is false and no local selection
exists. Update the assertion to expect an unset value (such as undefined, null,
or empty string depending on the implementation) instead of "thread-1", as
activeThreadId should remain unset until the thread list finishes loading and
resolves the route-sync contract.
Review — REQUEST CHANGES (needs a port onto current main)The behavior is genuinely still missing on But it can't merge as-is — it's mechanically incompatible with current
Nits after the port: the Once ported onto |
ilblackdragon
left a comment
There was a problem hiding this comment.
Review — VERDICT: REQUEST CHANGES (sound idea, must be recreated on the current tree) (batch review pass)
The redirect logic itself is sound — no redirect-loop risk (post-redirect urlThreadId is undefined → no-op branch), no open-redirect (every navigate() target is a constant or an internal id, never the raw route param), and unauthorized/nonexistent ids degrade safely to a redirect.
Relevance: still relevant — main's chat-page.js retains the naive effect with no thread-id validation, so the bug (deep link to a nonexistent/malformed id leaves an "active but empty" UI) is unfixed, and the chat-page.test.mjs coverage is net-new.
Conflict is structural, not a rebuildable bundle:
- Crate renamed after this PR's merge-base:
crates/ironclaw_webui_v2_static/→crates/ironclaw_webui_v2/. Every path this PR edits is gone onmain. - Committed bundle deleted; build system replaced.
mainhas no committedstatic/dist/app.js— the frontend now bundles viafrontend/build.mjs(esbuild) intoOUT_DIR. The 5-line bundle edit is obsolete; drop it entirely. - Genuine source drift:
main'schat-page.jsaddedglobalAutoApproveEnabled;main'suseThreads.jsswappedinvalidateQueriesforupsertThreadInCache.
Resolution (recreate on crates/ironclaw_webui_v2/): re-apply the redirect effect on main's current chat-page.js (keep globalAutoApproveEnabled), add isLoaded/isFetching to main's useThreads.js (and update the existing useThreads.test.mjs), place chat-page.test.mjs in the new path, and drop the bundle edit.
Findings:
- Medium
[chat-page.js:16,26-33]— post-settle race: on the PR'sinvalidateQueries-based create, if the backend list lags, a just-created thread can be ejected vianavigate("/chat").main'supsertThreadInCachealready mitigates this — another reason to rebuild onmain'suseThreads. - Low
[chat-page.js:18]—isMalformedThreadRouteonly catches whitespace; other junk ids fall through to the safe "not in list → redirect" path (naming nit, not a hole). - Low — tests are non-vacuous (would fail pre-fix); only gap is no case asserting a valid thread stays open during a background refetch (
isFetching:true, id present).
🤖 batch PR-review pass via parallel-pr-review
Summary
/chat/:threadIdroutes back to/chat.Change Type
Linked Issue
Fixes #5077
Validation
cargo fmt --all -- --checkcargo clippy --all --benches --tests --examples --all-features -- -D warningscargo buildnode --test crates/ironclaw_webui_v2_static/static/js/pages/chat/chat-page.test.mjs crates/ironclaw_webui_v2_static/static/js/pages/chat/lib/useHistory.test.mjs crates/ironclaw_webui_v2_static/static/js/pages/chat/hooks/useThreads.test.mjsnode --check crates/ironclaw_webui_v2_static/static/js/pages/chat/chat-page.test.mjscargo test -p ironclaw_webui_v2_staticcargo test --features integrationif database-backed or integration behavior changedreview-prorpr-shepherd --fixwas run before requesting reviewSecurity Impact
None.
Reborn Trust-Boundary Checklist
N/A. This is WebUI route-state handling only; it does not change Reborn runtime, trust-bearing types, prompts, sandboxing, command execution, auth, or persistence.
Database Impact
None.
Blast Radius
WebUI v2 chat routing and thread selection state only. Possible impact is limited to
/chat,/chat/:threadId, chat deep links, and active chat rendering while the thread list loads/refetches.Rollback Plan
Revert this commit to restore the previous ChatPage behavior and regenerated bundle.
Review Follow-Through
No known follow-up. Reviewer attention requested on the loading/refetch edge case: a locally selected newly created thread should not be cleared before the thread list catches up.
Review track: B