Repository navigation
feat(ai-vault): surface Qwen Code sessions in AI Vault - #11419
pythonstrup wants to merge 5 commits into
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Merge Risk:
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 13 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
-
Check name Status Explanation Title check ✅ Passed The title clearly summarizes the primary change: adding Qwen Code sessions to AI Vault. Description check ✅ Passed The description explains the problem, implementation, scope, visual result, linked issue, testing, security, compatibility, and performance considerations. It does not reproduce every template heading… Linked Issues check ✅ Passed The changes satisfy issue #11418by registering Qwen Code, discovering and parsing its JSONL sessions, supporting incremental parsing, exposing metadata and previews, and generating a functional resum…Out of Scope Changes check ✅ Passed The changes remain focused on Qwen Code session discovery, parsing, resume support, integration, and related tests and fixtures. No unrelated code changes are identified.
Full details: Description check
-
Explanation
The description explains the problem, implementation, scope, visual result, linked issue, testing, security, compatibility, and performance considerations. It does not reproduce every template heading or checklist item, but it contains the required information and is mostly complete.
Full details: Linked Issues check
-
Explanation
The changes satisfy issue
#11418by registering Qwen Code, discovering and parsing its JSONL sessions, supporting incremental parsing, exposing metadata and previews, and generating a functional resume command. Live agent-status hooks are correctly excluded as separate scope.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e2509c10-2753-4249-bc20-6c0f41081c61
📥 Commits
Reviewing files that changed from the base of the PR and between b21f978 and d5563a9384ef007dccab62593e15fd53666a257b.
📒 Files selected for processing (11)
src/main/ai-vault/session-scanner-agent-parser.tssrc/main/ai-vault/session-scanner-codex-workers.test.tssrc/main/ai-vault/session-scanner-parse-cache.tssrc/main/ai-vault/session-scanner-qwen-parser.test.tssrc/main/ai-vault/session-scanner-qwen-parser.tssrc/main/ai-vault/session-scanner-qwen-sources.tssrc/main/ai-vault/session-scanner-source-discovery.tssrc/main/ai-vault/session-scanner-test-fixtures.tssrc/main/ai-vault/session-scanner-types.tssrc/main/ai-vault/session-scanner.test.tssrc/shared/ai-vault-types.ts
Greptile SummaryThis PR wires Qwen Code into the AI Vault by registering it in
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/main/ai-vault/session-scanner-qwen-parser.ts | New Qwen Code parser following the Gemini-shaped transcript format. The parsing logic, model extraction, thought-part filtering, and incremental resume state are all correct, but parseQwenSessionFile is missing the finally { lines.close(); input.destroy() } teardown that every other gated-stream parser in the codebase requires to prevent handle leaks on error. |
| src/main/ai-vault/session-scanner-agent-sources.ts | Adds qwen-code source entry pointing to ~/.qwen/projects, filtering .jsonl files inside chats/ directories and pruning subagents/ trees. Follows the same conventions as Cursor and other append-only JSONL agents. |
| src/shared/ai-vault-resume-command.ts | Adds qwen-code to the --resume <id> fall-through case in buildAgentResumeInvocation. Placement and comment are clear. |
| src/main/ai-vault/session-scanner-parse-cache.ts | Routes qwen-code to createQwenSessionResumeState in the resumable-state factory, enabling incremental append parsing. Correct placement and consistent with all other JSONL-fold parsers. |
| src/main/ai-vault/session-scanner-qwen-parser.test.ts | Thorough unit tests covering full parse, thought-part exclusion, resume command, system-reminder stripping, empty transcript, preview truncation, and thought-only turns. The one gap is that session-scanner-parser-stream-cleanup.test.ts does not include qwen-code, which is a consequence of the missing teardown in the parser. |
| src/shared/ai-vault-types.ts | Adds qwen-code to AI_VAULT_AGENTS and AI_VAULT_AGENT_LABELS with the label 'Qwen Code'. Clean addition. |
Sequence Diagram
sequenceDiagram
participant Scanner as scanAiVaultSessions
participant Sources as AI_VAULT_AGENT_SOURCES['qwen-code']
participant Cache as parseAgentSessionFileCached
participant Parser as parseQwenSessionFile
participant Resume as createQwenSessionResumeState
participant FS as openTranscriptReadStream
Scanner->>Sources: "rootDirs → ~/.qwen/projects/<project>/chats/*.jsonl"
Sources-->>Scanner: candidate files (filePredicate: includes('chats'))
Scanner->>Cache: parseAgentSessionFileCached(candidate)
Cache->>Resume: resumableStateFactoryFor → createQwenSessionResumeState
Cache->>FS: consumeCompleteJsonlLines (incremental from byteOffset)
FS-->>Cache: new lines only
Cache->>Resume: state.consumeLine(line) for each record
Note over Resume: updateTimeline, updateLatestLocation,<br/>qwenMessagePartsText (excludeThought=true for assistant)
Cache->>Resume: state.finalize(platform)
Resume-->>Cache: AiVaultSession (sessionId, title, cwd, branch, model, resumeCommand)
Cache-->>Scanner: "session with resumeCommand = "cd '<cwd>' && qwen --resume '<id>'""
Reviews (3): Last reviewed commit: "fix(ai-vault): route Qwen transcript rea..." | Re-trigger Greptile
e7ab58a to
d4692d1
Compare
d4692d1 to
c5c14cf
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e5d21c31-0895-4477-9c54-3409cec165c4
📥 Commits
Reviewing files that changed from the base of the PR and between 56b6d84 and c5c14cfeb36304c4a1abba91195d2362d5c143c6.
📒 Files selected for processing (11)
src/main/ai-vault/session-scanner-agent-parser.tssrc/main/ai-vault/session-scanner-agent-sources.tssrc/main/ai-vault/session-scanner-codex-workers.test.tssrc/main/ai-vault/session-scanner-parse-cache.tssrc/main/ai-vault/session-scanner-qwen-parser.test.tssrc/main/ai-vault/session-scanner-qwen-parser.tssrc/main/ai-vault/session-scanner-test-fixtures.tssrc/main/ai-vault/session-scanner-types.tssrc/main/ai-vault/session-scanner.test.tssrc/shared/ai-vault-resume-command.tssrc/shared/ai-vault-types.ts
🚧 Files skipped from review as they are similar to previous changes (9)
- src/main/ai-vault/session-scanner-types.ts
- src/main/ai-vault/session-scanner-agent-parser.ts
- src/main/ai-vault/session-scanner-codex-workers.test.ts
- src/shared/ai-vault-types.ts
- src/main/ai-vault/session-scanner-test-fixtures.ts
- src/main/ai-vault/session-scanner-qwen-parser.test.ts
- src/main/ai-vault/session-scanner-qwen-parser.ts
- src/main/ai-vault/session-scanner.test.ts
- src/main/ai-vault/session-scanner-parse-cache.ts
c5c14cf to
d156dae
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
d156dae to
ed21303
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
A thought-only or tool-only assistant turn carries record.model but no visible reply text, so the model was dropped by the early return on empty text. Capture the model first; the turn still adds no preview/message. Addresses CodeRabbit review feedback on stablyai#11419.
ed21303 to
2aa3d97
Compare
|
Confirming this is still missing on the latest release and that the on-disk layout this PR targets still matches current Qwen Code.
Qoder session history landed in #24614, and this PR looks like the same shape of change for Qwen Code. It has had no maintainer review since it was opened. Could a maintainer take a look when there is time? Happy to test a build against real Qwen Code data if that helps. |
Qwen Code launched and ran in Orca but its sessions never appeared in the AI Vault (Agent Session History): qwen-code was absent from AI_VAULT_AGENTS, so the scanner never discovered or parsed its transcripts. Wire Qwen Code into the vault the same way other agents are wired: - register qwen-code in AI_VAULT_AGENTS / labels and the resume invocation (`qwen --resume <id>`) - discover ~/.qwen/projects/<cwd>/chats/*.jsonl, pruning subagent transcripts - parse the Gemini-shaped append-only transcript, dropping `thought` parts from previews and reading cwd/gitBranch from each record - enable incremental append parsing via the shared accumulator fold Live agent-status hooks for Qwen remain out of scope (separate installer).
A thought-only or tool-only assistant turn carries record.model but no visible reply text, so the model was dropped by the early return on empty text. Capture the model first; the turn still adds no preview/message. Addresses CodeRabbit review feedback on stablyai#11419.
The STA-4049 import guard on main forbids raw node:fs reads in scanner parsers; read via openTranscriptReadStream and rethrow gate refusals so a partial session is never cached, matching the sibling JSONL parsers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
readline.close() leaves its input open, so a mid-read throw stranded the gated transcript handle until the gate deadline and delayed later scans. Mirror the other JSONL parsers: keep the stream reference and destroy it in a finally block. Pinned by the shared stream-cleanup regression test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Rebasing onto main surfaced per-agent contracts the branch predates: - Port the parser from addPreviewMessage to addSessionText (stablyai#32086). - Pass the transcript sink to the Qwen resume state so cached parses publish messages like every other agent. - Read scope cwd from the first record, matching the parser's first-cwd rule. - Mark Qwen transcripts self-contained for the search index. - Expect qwen-code to stay out of legacy-host search projections; old hosts only see it through their supportedAgents catalog. - Resolve the Qwen roots in the Qwen module, as Kimi and Muse do, so the shared source table stays within max-lines. - Pin the parser test's mtime instead of reading the wall clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52ceb81 to
539c0f9
Compare
Summary
Qwen Code could be launched in Orca but its sessions never appeared in the AI Vault (Agent Session History).
qwen-codewas missing fromAI_VAULT_AGENTS, so the scanner never discovered or parsed Qwen transcripts. This wires Qwen Code into the vault the same way other agents (e.g. Kimi, #5376) are wired.Closes #11418
Changes
qwen-codeinAI_VAULT_AGENTS/AI_VAULT_AGENT_LABELSand the resume invocation (qwen --resume <id>, verified againstqwen --help).~/.qwen/projects/<encoded-cwd>/chats/*.jsonl(newsession-scanner-qwen-sources.ts), pruningsubagents/subtrees and ignoring non-chatsfiles.session-scanner-qwen-parser.ts: parses the Gemini-shaped append-only transcript, readscwd/gitBranchfrom each record (no sidecar index needed, unlike Kimi), and dropsthought: trueparts so previews/titles show only real replies.createQwenSessionResumeState).qwen-codein the agent parser and parse-cache; add aqwenProjectsDirscan option.Out of scope: live agent-status hooks for Qwen (a separate hook installer), matching the scope note in #11186.
Screenshots
The AI Vault now lists Qwen Code sessions with title, preview, model, and a working resume command. Verified locally by running the dev app against real
~/.qwen/projectsdata.Testing
pnpm lintpnpm typecheckpnpm testpnpm build(build:electron-vitedesktop bundle)~/.qwen.pnpm test: 39957 passed. The only 2 failures are pre-existing and environmental insrc/relay/agent-exec-handler.test.ts— the local shell exportsGIT_CONFIG_COUNT=2(credential keys), which the spawned-command env snapshot double-counts to 4. Unrelated to this change (no relay files touched) and passes in a clean CI environment.AI Review Report
AI-assisted review explicitly checked:
path.join/homedir()and the sharedsessionRootDirs(WSL-home aware); resume commands use the existing platform-aware quoting (quoteShellArg/ cmd). No hardcoded path separators.qwen-codeagent id; no changes to other agents' parsing or routing behavior.subagents/subtree up front.AI_VAULT_AGENTS(label + existing Qwen favicon).docs/STYLEGUIDE.mdis not applicable to this backend change.Security Audit
parseJsonObject/asRecordguards; malformed/partial JSON is skipped, never thrown. Text extraction reuses the existing normalization that strips injected<system-reminder>/hidden blocks from titles and previews.homedir()/path.join; thechats/subagentspredicates only filter within the discovered root. No user-supplied paths are executed.buildAiVaultResumeCommandquoting helpers and the agent's configureddetectCmd; session ids are shell-quoted. No new shell spawning.Notes
cd '<cwd>' && qwen --resume '<id>'command.