Repository navigation
Codex/optimize wework search - #1763
Conversation
📝 WalkthroughWalkthroughThis PR adds ChangesRuntime Search Enhancements
Claude Code Timeout Increase
Also included: an unrelated test timeout adjustment in Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant WorkbenchSearchDialog
participant SearchCache
participant RuntimeWorkHandler
User->>WorkbenchSearchDialog: types query
WorkbenchSearchDialog->>SearchCache: check cache for query
alt cache hit
SearchCache-->>WorkbenchSearchDialog: cached items
else cache miss
WorkbenchSearchDialog->>RuntimeWorkHandler: onSearchRuntimeWork(query)
RuntimeWorkHandler-->>WorkbenchSearchDialog: results with address + runtimeHandle.threadId
WorkbenchSearchDialog->>SearchCache: rememberSearchResults(query, items)
end
WorkbenchSearchDialog-->>User: render results
User->>WorkbenchSearchDialog: select result
WorkbenchSearchDialog->>RuntimeWorkHandler: open full runtime address
RuntimeWorkHandler-->>WorkbenchSearchDialog: transcript / workspace context
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
executor/src/runtime_work/response.rs (1)
469-482: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate handle-building logic already exists in
handler.rs.
runtime_handle_with_thread_idreimplements the same extract-object-then-insert-threadIdlogic asruntime_handle_jsoninexecutor/src/runtime_work/handler.rs(see context snippet:fn runtime_handle_json(link: &RuntimeTaskLink) -> Value). Both build the runtimeHandle contract thatruntime_session_id_from_handleconsumes downstream. Having two independent implementations risks them silently diverging (e.g., one gets updated to fall back to another handle key and the other doesn't).Consider consolidating into a single shared helper (e.g., exposed from one module and reused by both call sites).
🤖 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 `@executor/src/runtime_work/response.rs` around lines 469 - 482, The runtime handle construction logic is duplicated between runtime_handle_with_thread_id and runtime_handle_json, which risks the two versions diverging over time. Consolidate the object-extraction-and-threadId-insertion behavior into a single shared helper and have both response.rs and handler.rs reuse it so the runtimeHandle contract stays consistent for runtime_session_id_from_handle and related callers.executor/src/runtime_work/handler.rs (1)
4024-4053: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a multi-byte/unicode test case.
The new test only uses ASCII content, where byte index and char index coincide, so it doesn't exercise the char↔byte conversion (
byte_index_for_char,chars().count()) that this code was specifically written to handle safely. A test with multi-byte characters (e.g. CJK or emoji) surrounding the match would give real coverage of the boundary-safety logic.🤖 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 `@executor/src/runtime_work/handler.rs` around lines 4024 - 4053, The new test in first_message_search_result_returns_bounded_snippet only covers ASCII, so it does not validate the char-to-byte boundary handling in first_message_search_result. Update this test to use multi-byte Unicode content around the matched text (for example, emoji or CJK characters) and keep the same assertions on snippet bounds and matchStart/matchEnd. Make sure the test still exercises the bounded snippet path and verifies the match indices against the returned snippet.
🤖 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.
Nitpick comments:
In `@executor/src/runtime_work/handler.rs`:
- Around line 4024-4053: The new test in
first_message_search_result_returns_bounded_snippet only covers ASCII, so it
does not validate the char-to-byte boundary handling in
first_message_search_result. Update this test to use multi-byte Unicode content
around the matched text (for example, emoji or CJK characters) and keep the same
assertions on snippet bounds and matchStart/matchEnd. Make sure the test still
exercises the bounded snippet path and verifies the match indices against the
returned snippet.
In `@executor/src/runtime_work/response.rs`:
- Around line 469-482: The runtime handle construction logic is duplicated
between runtime_handle_with_thread_id and runtime_handle_json, which risks the
two versions diverging over time. Consolidate the
object-extraction-and-threadId-insertion behavior into a single shared helper
and have both response.rs and handler.rs reuse it so the runtimeHandle contract
stays consistent for runtime_session_id_from_handle and related callers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4028e8e2-90c3-49f1-85c7-bea355b15e40
📒 Files selected for processing (11)
docs/en/developer-guide/runtime-local-work.mddocs/en/user-guide/ai-devices/local-device-support.mddocs/zh/developer-guide/runtime-local-work.mddocs/zh/user-guide/ai-devices/local-device-support.mdexecutor/src/agents/mod.rsexecutor/src/runtime_work/handler.rsexecutor/src/runtime_work/response.rsexecutor/tests/app_runtime_work_contract.rswework/src/components/layout/DesktopWorkbenchLayout.test.tsxwework/src/components/layout/WorkbenchSearchDialog.test.tsxwework/src/components/layout/WorkbenchSearchDialog.tsx
Summary by CodeRabbit
New Features
Bug Fixes
Documentation