🐛 fix(vscode): 自动审查只认本目录的 codex 主会话,不再认错别的会话;去掉 2 分钟上限,一直等到审查终端关掉

This commit is contained in:
chehongweo committed 2026-09-28 23:03:50 +08:00
1 parent bb85bbd862
commit f2b17e5389
3 files changed
+197 -139

No files matched your search

+14 -10
View File
@@ -10,7 +10,7 @@ import { loginForToken } from '../../auth/identity'
import { getToken } from '../../auth/secrets'
import { buildCcCommand } from '../../cc/ccCommand'
import { buildCodexCommandString } from '../../cc/codexCommand'
import { watchForNewCodexSession } from '../../cc/codexSessionWatcher'
import { watchForCodexSession } from '../../cc/codexSessionWatcher'
import { resolveProfilePath } from '../../cc/profiles'
import { renderBrainstormPrompt, renderImplementPlanPrompt, renderPrototypePrompt, renderReviewPrompt, renderTestPrompt } from '../../cc/prompts'
import { projectsDirFor, watchForNewSession } from '../../cc/sessionWatcher'
@@ -570,15 +570,19 @@ async function triggerAutoReviewTabUnlocked(panel: KanbanWebviewPanel, opts: {
})
}
// Start the codex session watcher BEFORE sendText so we don't race the
// rollout-*.jsonl creation. codex writes a new file under
// ~/.codex/sessions/YYYY/MM/DD/ on every run; we extract thread_id from
// its name and persist it as reviewSessionId so the detail panel's
// resume button works after the user closes this tab.
const watcherPromise = watchForNewCodexSession({
baseDir: defaultCodexSessionsDir(),
timeoutMs: 120_000,
// 先盯会话目录再发命令,免得文件在盯上之前就建好了。拿到的 id 存成
// reviewSessionId:PR 再更新时靠它往这个窗口发「再审」,窗口关了也能接着聊。
// codex 启动可能拖好几分钟,一直盯到这个终端关掉为止。
const watchAbort = new AbortController()
const closeListener = window.onDidCloseTerminal((closed) => {
if (closed === terminal)
watchAbort.abort()
})
const watcherPromise = watchForCodexSession({
baseDir: defaultCodexSessionsDir(),
cwd: effectiveCwd,
signal: watchAbort.signal,
}).finally(() => closeListener.dispose())
// Interactive TUI (`codex` without `exec`/`review` subcommands): keeps
// the terminal alive after the run so users can follow up with codex,
@@ -606,7 +610,7 @@ async function triggerAutoReviewTabUnlocked(panel: KanbanWebviewPanel, opts: {
logger.add({
level: 'warn',
source: 'review',
message: `审查会话监听超时 (#${opts.issueNumber})`,
message: `审查终端关闭前没等到会话文件 (#${opts.issueNumber})`,
})
return
}