让 Direct 对话遵守项目写入确认
Direct 回合启动前检查 conversation.write 策略 确认后复用同一 clientTurnId 重试,拒绝则不启动回合
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user