fix: 实时上报 Codex 工具事件

This commit is contained in:
Codex
2026-06-02 03:23:16 +08:00
parent 9b2c637b64
commit 5544db96fb
5 changed files with 73 additions and 19 deletions
+8 -1
View File
@@ -141,7 +141,14 @@ async function executeCommand(api: RunnerManagerApi, options: RunnerOnceOptions,
const stopBackendProgress = startBackendProgress(api, options.runId, command.id, attemptId, runner.id, options.backendProfile ?? null);
try {
const latestRun = await api.getRun(options.runId);
const backendOptions = { ...options, ...(workspacePath ? { workspacePath } : {}), abortSignal: abortController.signal };
const backendOptions = {
...options,
...(workspacePath ? { workspacePath } : {}),
abortSignal: abortController.signal,
onEvent: async (event: BackendEvent) => {
await appendBestEffort(api, options.runId, annotateCommandEvent(event, command.id, attemptId, runner.id));
},
};
const result = backendSession ? await backendSession.runTurn(latestRun, command, backendOptions) : await runBackendTurn(latestRun, command, backendOptions);
for (const event of result.events) {
await api.appendEvent(options.runId, annotateCommandEvent(event, command.id, attemptId, runner.id));