修复 Codex App MCP 跨线程假就绪

This commit is contained in:
shiyue
2026-09-14 17:42:05 +08:00
parent e785e3c5dd
commit b1cd820819
4 changed files with 385 additions and 55 deletions

View File

@@ -1155,6 +1155,15 @@ function handleRequest(message) {
threadId: 'mock-reload-unrelated-thread',
},
});
// 全局通知可能不带线程;服务端只有在单个重载窗口内才允许安全归属。
send({
method: 'mcpServer/startupStatus/updated',
params: {
name: 'ccweb',
status: 'ready',
message: 'ccweb MCP ready without thread id CC_WEB_MCP_TOKEN=mock-secret-token',
},
});
}
send({ id, result: { reloaded: true, reloadCount: mcpReloadCount } });
return;
@@ -1165,6 +1174,20 @@ function handleRequest(message) {
id,
result: {
data: [
{
name: 'ccweb',
authStatus: 'unsupported',
resources: [],
resourceTemplates: [],
serverInfo: { name: 'ccweb', version: '1.0.0' },
tools: {
ccweb_list_conversations: {
name: 'ccweb_list_conversations',
description: 'Regression ccweb MCP tool.',
inputSchema: { type: 'object' },
},
},
},
{
name: 'reg-app-project',
authStatus: 'unsupported',
@@ -1206,6 +1229,16 @@ function handleRequest(message) {
send({ id, result: { thread: threadPayload(thread), model: params.model || 'gpt-5.5', cwd: thread.cwd, modelProvider: 'mock', approvalPolicy: params.approvalPolicy || 'never', approvalsReviewer: 'user', sandbox: params.sandbox || 'danger-full-access' } });
return;
}
if (method === 'thread/fork') {
const source = ensureThread(params.threadId, params);
const thread = ensureThread(null, params);
thread.forkedFromId = source.id;
thread.lastForkTurnId = params.lastTurnId || params.beforeTurnId || null;
thread.lastThreadConfigMethod = 'thread/fork';
thread.lastForkConfig = params.config || {};
send({ id, result: { thread: threadPayload(thread), model: params.model || 'gpt-5.5', cwd: thread.cwd, modelProvider: 'mock', approvalPolicy: params.approvalPolicy || 'never', approvalsReviewer: 'user', sandbox: params.sandbox || 'danger-full-access' } });
return;
}
if (method === 'thread/resume') {
if (params.threadId && resumeMismatchThreads.delete(params.threadId)) {
const thread = ensureThread(null, params);