Rewrite Qwen analyzer#191
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Qwen Code analyzer is refactored to parse JSONL session logs instead of a JSON session-blob format. New structs model JSONL records, parts, function calls, and usage metadata. Cost calculation, tool stats, path detection, glob patterns, discovery, and deduplication are all updated accordingly. A public ChangesQwen Code JSONL Migration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 4
🤖 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 `@src/analyzers/qwen_code.rs`:
- Around line 250-260: The is_qwen_code_chat_path function currently accepts
files with any ancestor named "chats", which is too permissive and allows nested
files like .../chats/archive/foo.jsonl to pass validation. Instead of using
ancestors().skip(1).any() to check if "chats" exists anywhere in the path
hierarchy, verify that the direct parent directory of the file is named "chats"
by checking path.parent() and its file_name(). This ensures only files directly
under a "chats" directory are accepted, matching the intended glob pattern of
projects/*/chats/*.
- Around line 209-213: In the edit statistics handling block within qwen_code.rs
(lines 209-213), the current code uses max operations to set lines_added and
lines_deleted, which replaces existing values from write_file operations instead
of accumulating them. Change the logic to add (accumulate) the edit-derived
estimates to the existing stats.lines_added and stats.lines_deleted values
rather than taking the maximum. This ensures that when a turn contains both
write_file and edit/replace operations, both contributions are retained in the
final statistics.
- Around line 276-291: The fallback hash for UUID-less QwenCodeRecord entries
uses only file path and timestamp, causing collisions when multiple records
share the same timestamp. To fix this, modify the loop that iterates through
content.lines() to use enumerate() to capture the line index, then update the
None branch of the global_hash match statement to include the line index as a
stable per-line discriminator in the hash formula (e.g., combine file_path_str,
the current line index, and the timestamp when uuid is absent).
- Around line 237-247: In the calculate_qwen_cost function, the
thoughtsTokenCount (usage.thoughts) is incorrectly being billed at the input
token rate. Remove usage.thoughts from the total_input_tokens calculation on
line 241 so it only includes non_cached_input, then modify the
calculate_output_cost call on line 244 to include both usage.candidates and
usage.thoughts combined, since Qwen bills reasoning tokens at the output rate
not the input rate.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 01a3f1da-b8f9-4329-b0f1-698b50e5b580
📒 Files selected for processing (3)
src/analyzers/qwen_code.rssrc/analyzers/tests/qwen_code.rssrc/analyzers/tests/source_data/qwen_code.jsonl
Closes #190.
Summary by CodeRabbit
Release Notes
New Features
~/.qwen/projects/*/chats/for both JSONL and JSON, with improved deduplication.Tests