让 Direct 对话遵守项目写入确认
Project CI / Backend tests (pull_request) Failing after 15s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled

Direct 回合启动前检查 conversation.write 策略

确认后复用同一 clientTurnId 重试,拒绝则不启动回合
This commit is contained in:
2026-09-05 13:30:57 +08:00
parent 38d3789f29
commit 1a08df517f
+34
View File
@@ -387,6 +387,7 @@ type ExecuteChatAgentReplyInput = {
clientTurnId?: string;
creationType?: HomeCreationType | null;
attachments?: DirectCodexTurnAttachment[];
directPolicyChecked?: boolean;
};
export function App({
@@ -5296,6 +5297,7 @@ export function App({
clientTurnId: directConversationTurnId,
creationType,
attachments,
directPolicyChecked = false,
}: ExecuteChatAgentReplyInput) {
// Product default: send the conversation directly to Codex app-server.
// The legacy Supervisor/harness path remains below for rollback and tests.
@@ -5305,6 +5307,38 @@ export function App({
if (directProjectPath && directInvoke) {
const clientTurnId =
directConversationTurnId ?? createDirectCodexConversationTurnId();
if (!directPolicyChecked) {
try {
const policyPaused = await queueProjectPolicyConfirmationIfNeeded(
directInvoke,
'conversation.write',
directProjectPath,
'写入 DirectProject 对话历史',
'DirectProject 对话写入需要确认。',
() => {
void executeChatAgentReply({
prompt,
clientTurnId,
creationType,
attachments,
directPolicyChecked: true,
});
},
);
if (policyPaused) {
return;
}
} catch (error) {
if (localProjectPathRef.current === directProjectPath) {
setProjectSupervisorRuntimeError(
`DirectProject 对话权限检查失败:${
error instanceof Error ? error.message : String(error)
}`,
);
}
return;
}
}
const directUserMessageId = directCodexConversationMessageId(
clientTurnId,
'user',