修复完整会话历史与长气泡交互并更新 CentOS 7 发布包

提交当前工作区全部源码、回归脚本、任务记录及重新构建的 Bun baseline 发布包。发布单文件 MCP 初始化及前端资源一致性验证通过。
This commit is contained in:
shiyue
2026-10-10 23:40:16 +08:00
parent 747771a048
commit 69b6db0f5b
71 changed files with 9536 additions and 503 deletions

View File

@@ -792,6 +792,40 @@ function emitPartialCapacityOutput(thread, turnId) {
});
}
// 多次延续重试夹具:正文首段超过提示及快照上限,每轮故意复用原生 item ID。
function emitRetryHistoryPart(thread, turnId, label) {
const padding = label === 'A' ? '甲'.repeat(220000) : '乙'.repeat(15000);
const text = `retry-history-${label}-begin\n${padding}\nretry-history-${label}-end`;
for (let offset = 0; offset < text.length; offset += 8192) {
send({
method: 'item/agentMessage/delta',
params: { threadId: thread.id, turnId, itemId: 'retry-history-agent', delta: text.slice(offset, offset + 8192) },
});
}
send({
method: 'item/completed',
params: { threadId: thread.id, turnId, item: { id: 'retry-history-agent', type: 'agentMessage', text } },
});
send({
method: 'item/started',
params: { threadId: thread.id, turnId, item: { id: 'retry-history-tool', type: 'commandExecution',
command: `fixture-${label}`, status: 'inProgress' } },
});
send({
method: 'item/commandExecution/outputDelta',
params: { threadId: thread.id, turnId, itemId: 'retry-history-tool', delta: `tool-${label}-full-result\n${'输出'.repeat(20000)}` },
});
if (label !== 'C') {
emitCapacityError(thread, turnId);
return;
}
send({
method: 'turn/completed',
params: { threadId: thread.id, turn: { id: turnId, status: 'completed', items: [] } },
});
thread.activeTurnId = null;
}
function completeGuidedInputTurn(thread, turnId) {
requestClient('item/tool/requestUserInput', {
threadId: thread.id,
@@ -924,6 +958,20 @@ function startTurn(params) {
return { turn: { id: turnId, status: 'running', items: [] } };
}
if (/^codexapp late completion first$/i.test(text)) {
// 保持 turn 处于运行中,直到后续 steer 到达时才结束,用于复现“发送瞬间 turn 结束”的竞态。
send({
method: 'item/agentMessage/delta',
params: {
threadId: thread.id,
turnId,
itemId: 'agent-msg',
delta: 'late completion fixture ready\n',
},
});
return { turn: { id: turnId, status: 'running', items: [] } };
}
if (/^codexapp expected turn mismatch first$/i.test(text)) {
send({
method: 'item/agentMessage/delta',
@@ -953,6 +1001,14 @@ function startTurn(params) {
}
}
if (/codexapp retry full history/i.test(text)) {
const retryKey = retryScenarioKey(text, 'codexapp retry full history');
const attempts = (thread.capacityRetryAttempts.get(retryKey) || 0) + 1;
thread.capacityRetryAttempts.set(retryKey, attempts);
emitRetryHistoryPart(thread, turnId, attempts === 1 ? 'A' : attempts === 2 ? 'B' : 'C');
return { turn: { id: turnId, status: 'running', items: [] } };
}
if (/codexapp capacity retry/i.test(text)) {
const retryKey = retryScenarioKey(text, 'codexapp capacity retry');
const attempts = (thread.capacityRetryAttempts.get(retryKey) || 0) + 1;
@@ -1028,6 +1084,21 @@ function startTurn(params) {
return { turn: { id: turnId, status: 'running', items: [] } };
}
if (text === 'slow codexapp prompt') {
// 连续插入回归由最后一条 steer 决定完成时机,不依赖保存耗时小于定时窗口。
thread.heldSteerFixture = { turnId, text };
send({
method: 'item/agentMessage/delta',
params: {
threadId: thread.id,
turnId,
itemId: 'agent-msg',
delta: 'active steer fixture ready\n',
},
});
return { turn: { id: turnId, status: 'running', items: [] } };
}
const delay = /recover/i.test(text) ? 5000 : /slow/i.test(text) ? 900 : 80;
if (/recover/i.test(text)) {
send({
@@ -1078,11 +1149,33 @@ function interruptTurn(params) {
function steerTurn(params) {
const thread = ensureThread(params.threadId, params);
if (!thread.activeTurnId) {
const text = textFromInput(params.input);
if (/^codexapp retry after completed(?:\n|$)/.test(text) && thread.activeTurnId) {
return { error: { code: -32603, message: 'temporary steer rejection' } };
}
if (/codexapp steer after completion/i.test(text) && thread.activeTurnId) {
// 模拟 steer 到达时 turn 恰好结束:先发出 turn/completed,再返回“无活动 turn”。
completeTurn(thread, thread.activeTurnId, 'codexapp late completion first');
const expectedTurnId = typeof params.expectedTurnId === 'string' ? params.expectedTurnId.trim() : '';
return {
error: {
code: -32001,
message: 'no active turn to steer',
message: expectedTurnId
? `expected active turn id \`${expectedTurnId}\`: no active turn`
: 'no active turn to steer',
},
};
}
if (!thread.activeTurnId) {
// 对齐真实 app-server:带 expectedTurnId 时返回 expected active turn id 形式,
// 不带期望 id 时才返回 no active turn to steer。
const expectedTurnId = typeof params.expectedTurnId === 'string' ? params.expectedTurnId.trim() : '';
return {
error: {
code: -32001,
message: expectedTurnId
? `expected active turn id \`${expectedTurnId}\`: no active turn`
: 'no active turn to steer',
},
};
}
@@ -1094,7 +1187,6 @@ function steerTurn(params) {
},
};
}
const text = textFromInput(params.input);
if (text) thread.steers.push(text);
send({
method: 'item/agentMessage/delta',
@@ -1105,6 +1197,11 @@ function steerTurn(params) {
delta: `\n[steer accepted: ${text}]`,
},
});
const held = thread.heldSteerFixture;
if (held?.turnId === thread.activeTurnId && text === 'runtime steer insert') {
thread.heldSteerFixture = null;
thread.timer = setTimeout(() => completeTurn(thread, held.turnId, held.text), 80);
}
return { result: {} };
}