[PR #31] [MERGED] fix(qwen-code): correct storage path, tool classification, and gemini feature parity #31

Closed
opened 2026-03-04 01:39:20 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/yigitkonur/cli-continues/pull/31
Author: @yigitkonur
Created: 3/2/2026
Status: Merged
Merged: 3/2/2026
Merged by: @yigitkonur

Base: mainHead: fix/qwen-code-audit-fixes


📝 Commits (3)

  • cf2315e fix: invalidate session index cache when env vars change (#18)
  • 56e2946 fix: address pr review — simplify readStoredFingerprint, rewrite tests
  • 4ea76c6 fix(qwen-code): correct storage path, tool names, and feature parity with gemini parser

📊 Changes

7 files changed (+436 additions, -63 deletions)

View changed files

src/__tests__/env-cache-invalidation.test.ts (+136 -0)
📝 src/__tests__/fixtures/index.ts (+27 -5)
📝 src/__tests__/unit-conversions.test.ts (+1 -1)
📝 src/parsers/qwen-code.ts (+161 -35)
📝 src/parsers/registry.ts (+17 -14)
📝 src/types/tool-names.ts (+45 -4)
📝 src/utils/index.ts (+49 -4)

📄 Description

fixes critical bugs found during source code audit against QwenLM/qwen-code:

critical fixes:

  • storage path was wrong (~/.qwen/tmp/<sha256>~/.qwen/projects/<sanitized-cwd>) — parser would never find real sessions
  • nativeResumeArgs now uses --resume <sessionId> for specific session resume (not just --continue)
  • toolCallResult.resultDisplay field names corrected (fileName not filePath, union type discrimination)

feature parity with gemini parser:

  • thought/reasoning extraction (separate thought: true parts from output text)
  • pending tasks extraction from thought parts
  • isError tracking from toolCallResult.status and functionResponse
  • diffStat fallback: count +/- lines from fileDiff when diffStat absent
  • extractRepoFromCwd for repo field (was hardcoded to '')
  • resultStr extraction for shell/fetch/mcp categories
  • agentType extraction for task category

tool name classification:

  • added all qwen-code tool names: run_shell_command, grep_search, edit, Shell, ListFiles
  • added skip tools: todo_write, exit_plan_mode, save_memory, skill, lsp
  • added legacy migrations: search_file_content, replace, SearchFiles, FindFiles, ReadFolder

fixture:

  • storage structure updated to match real format
  • added tool_result record with toolCallResult metadata
  • added thought parts and thoughtsTokenCount

all 694 tests pass

ref #12 cc @karatechopping


Open with Devin

Review all of them with eye of John Carmack-like simplicity with elegeance approach and apply the one only if required

Greptile Summary

Fixes critical bugs in qwen-code parser: corrected storage path from ~/.qwen/tmp/<sha256> to ~/.qwen/projects/<sanitized-cwd>, fixed nativeResumeArgs to use --resume <sessionId>, and corrected toolCallResult.resultDisplay field names (fileName not filePath). Achieves full feature parity with gemini parser by adding thought/reasoning extraction, pending task detection, isError tracking, diffStat fallback counting, extractRepoFromCwd, resultStr extraction, and agentType extraction. Tool name classification correctly expanded with all qwen-code tool names and legacy migrations.

  • Critical fixes verified: storage path now matches actual qwen-code structure, parser will find real sessions
  • Registry: complete registration with all required ToolAdapter fields, uses mapGeminiFlags for consistency
  • Tool classification: comprehensive coverage of qwen-code tool names across all canonical sets (SHELL_TOOLS, READ_TOOLS, EDIT_TOOLS, GREP_TOOLS, GLOB_TOOLS, SKIP_TOOLS)
  • Fixture: realistic test data with correct storage structure, thought parts, toolCallResult metadata
  • Env cache invalidation: properly invalidates index when QWEN_HOME changes

Minor style deviations from stated rules (consistent with existing JSONL parsers): raw JSON casts instead of Zod validation, direct slice instead of trimMessages() helper, naive diff line counting. None introduce bugs.

Confidence Score: 4/5

  • Safe to merge with minor style improvements recommended
  • All critical bugs fixed correctly (storage path, resume args, field names). Feature parity implementation matches gemini parser patterns. Tool classification complete. Tests pass (694). Three minor style deviations from rules but consistent with existing codebase patterns (no Zod validation for JSONL, no trimMessages helper, naive diff counting). No logic errors or correctness issues found.
  • No files require special attention — all changes follow established patterns

Important Files Changed

Filename Overview
src/parsers/qwen-code.ts Fixed critical storage path, added thought extraction, pending tasks, diffStat fallback, and full gemini feature parity
src/parsers/registry.ts Registered qwen-code adapter with correct nativeResumeArgs and mapGeminiFlags
src/types/tool-names.ts Added qwen-code to TOOL_NAMES and all qwen-code tool name mappings to canonical sets
src/utils/index.ts Added env fingerprint tracking to invalidate cache when QWEN_HOME or other env vars change
src/tests/fixtures/index.ts Added qwen-code fixture with correct storage structure, thought parts, and toolCallResult metadata

Last reviewed commit: 4ea76c6


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/yigitkonur/cli-continues/pull/31 **Author:** [@yigitkonur](https://github.com/yigitkonur) **Created:** 3/2/2026 **Status:** ✅ Merged **Merged:** 3/2/2026 **Merged by:** [@yigitkonur](https://github.com/yigitkonur) **Base:** `main` ← **Head:** `fix/qwen-code-audit-fixes` --- ### 📝 Commits (3) - [`cf2315e`](https://github.com/yigitkonur/cli-continues/commit/cf2315e4ac13604dbaf07c5507e9d5de5cec8303) fix: invalidate session index cache when env vars change (#18) - [`56e2946`](https://github.com/yigitkonur/cli-continues/commit/56e29460def7d48c5fa99e8033d3234a7f86985b) fix: address pr review — simplify readStoredFingerprint, rewrite tests - [`4ea76c6`](https://github.com/yigitkonur/cli-continues/commit/4ea76c6a8f4e45d2f2c9d4430c585ceb2ac03426) fix(qwen-code): correct storage path, tool names, and feature parity with gemini parser ### 📊 Changes **7 files changed** (+436 additions, -63 deletions) <details> <summary>View changed files</summary> ➕ `src/__tests__/env-cache-invalidation.test.ts` (+136 -0) 📝 `src/__tests__/fixtures/index.ts` (+27 -5) 📝 `src/__tests__/unit-conversions.test.ts` (+1 -1) 📝 `src/parsers/qwen-code.ts` (+161 -35) 📝 `src/parsers/registry.ts` (+17 -14) 📝 `src/types/tool-names.ts` (+45 -4) 📝 `src/utils/index.ts` (+49 -4) </details> ### 📄 Description fixes critical bugs found during source code audit against [QwenLM/qwen-code](https://github.com/QwenLM/qwen-code): **critical fixes:** - storage path was wrong (`~/.qwen/tmp/<sha256>` → `~/.qwen/projects/<sanitized-cwd>`) — parser would never find real sessions - `nativeResumeArgs` now uses `--resume <sessionId>` for specific session resume (not just `--continue`) - `toolCallResult.resultDisplay` field names corrected (`fileName` not `filePath`, union type discrimination) **feature parity with gemini parser:** - thought/reasoning extraction (separate `thought: true` parts from output text) - pending tasks extraction from thought parts - `isError` tracking from `toolCallResult.status` and `functionResponse` - `diffStat` fallback: count +/- lines from `fileDiff` when `diffStat` absent - `extractRepoFromCwd` for repo field (was hardcoded to `''`) - `resultStr` extraction for shell/fetch/mcp categories - `agentType` extraction for task category **tool name classification:** - added all qwen-code tool names: `run_shell_command`, `grep_search`, `edit`, `Shell`, `ListFiles` - added skip tools: `todo_write`, `exit_plan_mode`, `save_memory`, `skill`, `lsp` - added legacy migrations: `search_file_content`, `replace`, `SearchFiles`, `FindFiles`, `ReadFolder` **fixture:** - storage structure updated to match real format - added `tool_result` record with `toolCallResult` metadata - added thought parts and `thoughtsTokenCount` all 694 tests pass ✅ ref #12 cc @karatechopping <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/yigitkonur/cli-continues/pull/31" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> <!-- greptile_comment --> # Review all of them with eye of John Carmack-like simplicity with elegeance approach and apply the one only if required <h3>Greptile Summary</h3> Fixes critical bugs in qwen-code parser: corrected storage path from `~/.qwen/tmp/<sha256>` to `~/.qwen/projects/<sanitized-cwd>`, fixed `nativeResumeArgs` to use `--resume <sessionId>`, and corrected `toolCallResult.resultDisplay` field names (`fileName` not `filePath`). Achieves full feature parity with gemini parser by adding thought/reasoning extraction, pending task detection, `isError` tracking, `diffStat` fallback counting, `extractRepoFromCwd`, `resultStr` extraction, and `agentType` extraction. Tool name classification correctly expanded with all qwen-code tool names and legacy migrations. - **Critical fixes verified**: storage path now matches actual qwen-code structure, parser will find real sessions - **Registry**: complete registration with all required `ToolAdapter` fields, uses `mapGeminiFlags` for consistency - **Tool classification**: comprehensive coverage of qwen-code tool names across all canonical sets (SHELL_TOOLS, READ_TOOLS, EDIT_TOOLS, GREP_TOOLS, GLOB_TOOLS, SKIP_TOOLS) - **Fixture**: realistic test data with correct storage structure, thought parts, `toolCallResult` metadata - **Env cache invalidation**: properly invalidates index when `QWEN_HOME` changes Minor style deviations from stated rules (consistent with existing JSONL parsers): raw JSON casts instead of Zod validation, direct slice instead of `trimMessages()` helper, naive diff line counting. None introduce bugs. <details><summary><h3>Confidence Score: 4/5</h3></summary> - Safe to merge with minor style improvements recommended - All critical bugs fixed correctly (storage path, resume args, field names). Feature parity implementation matches gemini parser patterns. Tool classification complete. Tests pass (694). Three minor style deviations from rules but consistent with existing codebase patterns (no Zod validation for JSONL, no trimMessages helper, naive diff counting). No logic errors or correctness issues found. - No files require special attention — all changes follow established patterns </details> <details open><summary><h3>Important Files Changed</h3></summary> | Filename | Overview | |----------|----------| | src/parsers/qwen-code.ts | Fixed critical storage path, added thought extraction, pending tasks, diffStat fallback, and full gemini feature parity | | src/parsers/registry.ts | Registered qwen-code adapter with correct nativeResumeArgs and mapGeminiFlags | | src/types/tool-names.ts | Added qwen-code to TOOL_NAMES and all qwen-code tool name mappings to canonical sets | | src/utils/index.ts | Added env fingerprint tracking to invalidate cache when QWEN_HOME or other env vars change | | src/__tests__/fixtures/index.ts | Added qwen-code fixture with correct storage structure, thought parts, and toolCallResult metadata | </details> </details> <sub>Last reviewed commit: 4ea76c6</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 01:39:20 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cli-continues#31
No description provided.