jackwener / jackwener/OpenCLI

deepseek ask --new 不保证新会话:DeepSeek 首页自动恢复上一会话,连续采样会串进同一线程

Open
#2,401 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
29.3k
Forks
2.9k
Avg merge
15h 36m
Merged PRs (30d)
70

Description

## 环境

- OpenCLI 1.8.7(npm 全局安装),Browser Bridge 扩展 v1.0.23
- macOS(Darwin 25),Chrome 151;DeepSeek 网页版 2026-08 当前线上版本

## 现象

`opencli deepseek ask --new true` 并不能保证开启新会话:DeepSeek 首页(`chat.deepseek.com/`)当前会**自动恢复到上一条会话**(URL 直接落到 `/a/chat/s/`),`--new` 分支只做了 `goto` 首页 + 等 composer,随后的发送就追加进了旧会话线程。

连续多次 `ask --new` 的实测结果:多轮问答堆在**同一个会话**里,后面的回答带着前面问题的上下文。对「独立重复采样」类场景(例如 GEO 提及率监测,要求每个样本无上下文污染)是正确性问题,而且很难被发现——每次 ask 都「成功」返回。

## 复现

1. `opencli --profile

deepseek ask --new true "问题A" --timeout 120 -f json`
2. 紧接着 `opencli --profile

deepseek ask --new true "问题B" --timeout 120 -f json`
3. 打开 DeepSeek 网页版查看:问题 A、B 在同一个会话线程里(各自没有独立的 `/a/chat/s/`)。

## 我们验证过的修法(供参考)

在 `clis/deepseek/ask.js` 的 `--new` 分支里,goto 首页后若发现仍落在会话 URL,就点一下「开启新对话」按钮:

```js
const onThread = String(await page.evaluate('window.location.pathname') || '').includes('/a/chat/s/');
if (onThread) {
await page.evaluate(`(() => {
const els = [...document.querySelectorAll('div,button,a')];
const btn = els.find((el) => {
const t = (el.innerText || '').trim();
return t === '开启新对话' || t.startsWith('开启新对话') || t === 'New chat';
});
if (btn) btn.click();
})()`);
await page.wait(2);
}
```

打上后连续 ask 各自独立成会话,已在真实采样任务里跑通(每样本独立线程)。文本匹配按钮偏脆,仅供参考——也许有更稳的选择器或快捷键(DeepSeek 网页版「开启新对话」带 ⌘J 快捷键提示)。

## 顺带反馈

同一轮排查里我们还发现:正式版 Chrome 137+ 已禁用 `--load-extension` 命令行参数,依赖它加载 Browser Bridge 扩展的安装脚本会静默失败(扩展看似下载安装、实际从未注册)。我们的绕过方式是启动加 `--enable-unsafe-extension-debugging` 后用 CDP `Extensions.loadUnpacked` 注入,且每次启动需重做。如果官方安装文档/脚本依赖 `--load-extension`,可能需要跟进。

---
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

Research direction

Start in clis/deepseek/ask.js at the --new branch and reproduce the issue with two consecutive `deepseek ask --new true` commands. Check how the page URL and new-conversation control behave after navigating to the DeepSeek homepage. Done means each command creates an independent conversation thread without carrying earlier context; verify this through the reported CLI flow and the DeepSeek web UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.