openairev 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/agents/claude-code.js +7 -1
- package/src/agents/codex.js +20 -7
package/package.json
CHANGED
|
@@ -130,12 +130,18 @@ export function parseClaudeStreamOutput(stdout, { progress = [], fallbackSession
|
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
const returnValue = {
|
|
134
134
|
result: verdict || finalText,
|
|
135
135
|
raw_output: stdout,
|
|
136
136
|
progress,
|
|
137
137
|
session_id: sessionId,
|
|
138
138
|
};
|
|
139
|
+
|
|
140
|
+
if (!verdict && !finalText) {
|
|
141
|
+
returnValue.error = 'Claude produced no output. Check .openairev/logs/ for the raw session output.';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return returnValue;
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
function extractAssistantText(event) {
|
package/src/agents/codex.js
CHANGED
|
@@ -42,6 +42,8 @@ export class CodexAdapter {
|
|
|
42
42
|
const lines = result.stdout.trim().split('\n');
|
|
43
43
|
let agentMessage = null;
|
|
44
44
|
let sessionId = null;
|
|
45
|
+
let lastTurn = null;
|
|
46
|
+
let lastError = null;
|
|
45
47
|
|
|
46
48
|
for (const line of lines) {
|
|
47
49
|
try {
|
|
@@ -52,12 +54,13 @@ export class CodexAdapter {
|
|
|
52
54
|
if (event.type === 'item.completed' && event.item?.type === 'agent_message') {
|
|
53
55
|
agentMessage = event.item.text;
|
|
54
56
|
}
|
|
57
|
+
if (event.type === 'turn.completed') {
|
|
58
|
+
lastTurn = event;
|
|
59
|
+
}
|
|
55
60
|
if (event.type === 'error' || event.type === 'turn.failed') {
|
|
56
|
-
|
|
57
|
-
throw new Error(`Codex error: ${errMsg}`);
|
|
61
|
+
lastError = event.message || event.error?.message || JSON.stringify(event);
|
|
58
62
|
}
|
|
59
|
-
} catch
|
|
60
|
-
if (e.message?.startsWith('Codex error:')) throw e;
|
|
63
|
+
} catch {
|
|
61
64
|
// skip non-JSON lines
|
|
62
65
|
}
|
|
63
66
|
}
|
|
@@ -76,9 +79,19 @@ export class CodexAdapter {
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
// No verdict — report what actually happened
|
|
83
|
+
const cmdCount = lines.filter(l => { try { return JSON.parse(l).type === 'item.completed' && JSON.parse(l).item?.type === 'command_execution'; } catch { return false; } }).length;
|
|
84
|
+
let error = lastError
|
|
85
|
+
? `Codex error: ${lastError}`
|
|
86
|
+
: `Codex exited after ${cmdCount} commands without producing a verdict or turn completion event.`;
|
|
87
|
+
if (lastTurn?.usage) {
|
|
88
|
+
const { input_tokens, output_tokens } = lastTurn.usage;
|
|
89
|
+
error += ` Tokens: ${input_tokens} in / ${output_tokens} out.`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { raw: result.stdout, raw_output: result.stdout, progress, session_id: this.sessionId, error };
|
|
93
|
+
} catch (e) {
|
|
94
|
+
return { raw: result.stdout, raw_output: result.stdout, error: `Failed to parse Codex output: ${e.message}` };
|
|
82
95
|
}
|
|
83
96
|
}
|
|
84
97
|
}
|