fix(deepseek): fix history titles and resume conversation on ask#1153
fix(deepseek): fix history titles and resume conversation on ask#1153jackwener merged 3 commits intojackwener:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes DeepSeek adapter regressions caused by recent DeepSeek UI / workspace behavior changes, improving history title extraction and preventing unintended new conversations on repeated ask calls.
Changes:
- Update
getConversationList()to extract conversation titles fromlink.innerText(instead of the first child<div>). - Make
ensureOnDeepSeek()return whether navigation occurred, and use that inaskto attempt resuming the most recent conversation after workspace recycling. - Add tests covering conversation resume behavior and model-selection skipping.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| clis/deepseek/utils.js | Adjusts DeepSeek page detection/navigation and fixes history title scraping for updated sidebar DOM. |
| clis/deepseek/ask.js | Resumes a prior conversation after navigation and skips model selection inside existing threads. |
| clis/deepseek/ask.test.js | Updates mocks for URL evaluation and adds coverage for the new resume/skip-model behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Workspace was recycled; try to resume the most recent | ||
| // conversation instead of starting a new one. | ||
| await page.evaluate(`(() => { | ||
| var link = document.querySelector('a[href*="/a/chat/s/"]'); | ||
| if (link) link.click(); | ||
| })()`); | ||
| await page.wait(2); | ||
| } |
There was a problem hiding this comment.
The resume logic clicks the first sidebar conversation link, but it won’t find any links if the DeepSeek sidebar is collapsed (the codebase already handles this in getConversationList by clicking the sidebar toggle when no links are present). Consider expanding the sidebar before querying for the conversation link (or reusing the same “expand sidebar if no links” snippet) so resume works reliably after navigation.
| // Model selector is only available on the new-chat page, not inside | ||
| // an existing conversation. Skip it when we resumed a prior thread. | ||
| const currentUrl = await page.evaluate('window.location.href') || ''; | ||
| const inConversation = currentUrl.includes('/a/chat/s/'); | ||
|
|
||
| if (!inConversation) { | ||
| const wantModel = kwargs.model || 'instant'; | ||
| const modelResult = await withRetry(() => selectModel(page, wantModel)); | ||
| if (!modelResult?.ok) { |
There was a problem hiding this comment.
Model selection is now skipped whenever the current URL is inside an existing conversation, which means the --model flag effectively becomes a no-op in that case. Please update the CLI arg help text (or add an explicit note/error when --model is requested but cannot be applied) so users aren’t misled into thinking the model was switched.
79d7b60 to
2304f06
Compare
2304f06 to
29d9a6b
Compare
- history: use link.innerText instead of link.querySelector('div') for
title extraction. DeepSeek changed sidebar DOM; the first child div
is now an empty ds-focus-ring element, causing all titles to show as
(untitled).
- ask: when workspace is recycled (idle timeout) and --new is false
(default), click the most recent sidebar conversation link to resume
it instead of staying on the blank new-chat page. Skip model
selection when inside an existing conversation since the selector is
only rendered on the new-chat page.
- ensureOnDeepSeek: return boolean indicating whether navigation
occurred, so callers can react to workspace recycling.
Closes jackwener#1149
29d9a6b to
4a26873
Compare
Description
Fixes two bugs reported in #1149:
historyshows all titles as(untitled): DeepSeek changed their sidebar DOM. The first child<div>inside each conversation link is now an empty<div class="ds-focus-ring">, solink.querySelector('div').textContentalways returns''. Switched tolink.innerTextwhich correctly returns the title text.askcreates a new conversation every time: When the workspace is recycled after idle timeout (30s for site workspaces),ensureOnDeepSeeknavigates to the root URL which is always a blank new-chat page. Now when--newis false (default) and navigation was required, the adapter clicks the most recent sidebar conversation link to resume it. Model selection is skipped when inside an existing conversation since the selector is only rendered on the new-chat page.Fixes #1149
Type of Change
Checklist
Documentation (if adding/modifying an adapter)
N/A (existing adapter bug fix, no new commands or args added)
Screenshots / Output
Before (history titles):
After (history titles):
Conversation resume test: