mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Fix codex-mcp command exit codes
This commit is contained in:
@@ -1055,20 +1055,29 @@ class CodexMcpAgentSession implements AgentSession {
|
||||
const exitCodeRaw = (event as { exit_code?: unknown; exitCode?: unknown }).exit_code ??
|
||||
(event as { exitCode?: unknown }).exitCode;
|
||||
const exitCode = typeof exitCodeRaw === "number" ? exitCodeRaw : undefined;
|
||||
const output = (event as { output?: string; stdout?: string }).output ??
|
||||
(event as { stdout?: string }).stdout ??
|
||||
(event as { stderr?: string }).stderr ??
|
||||
"";
|
||||
const structuredOutput =
|
||||
const output = (event as { output?: unknown; stdout?: unknown }).output ??
|
||||
(event as { stdout?: unknown }).stdout ??
|
||||
(event as { stderr?: unknown }).stderr;
|
||||
const outputRecord =
|
||||
output && typeof output === "object" ? (output as Record<string, unknown>) : undefined;
|
||||
const outputText =
|
||||
typeof output === "string"
|
||||
? output
|
||||
: typeof outputRecord?.stdout === "string"
|
||||
? outputRecord.stdout
|
||||
: typeof outputRecord?.stderr === "string"
|
||||
? outputRecord.stderr
|
||||
: undefined;
|
||||
const structuredOutput =
|
||||
outputText !== undefined || typeof exitCode === "number"
|
||||
? {
|
||||
type: "command" as const,
|
||||
command: extractCommandText(command) ?? "command",
|
||||
output,
|
||||
output: outputText ?? "",
|
||||
exitCode,
|
||||
cwd,
|
||||
}
|
||||
: undefined;
|
||||
: outputRecord;
|
||||
const emitEvent = () => {
|
||||
if (typeof exitCode === "number" && exitCode !== 0) {
|
||||
this.turnState && (this.turnState.sawError = true);
|
||||
@@ -1249,12 +1258,13 @@ class CodexMcpAgentSession implements AgentSession {
|
||||
? (commandValue as string[]).join(" ")
|
||||
: "command";
|
||||
|
||||
const outputText = typeof aggregatedOutput === "string" ? aggregatedOutput : undefined;
|
||||
const structuredOutput =
|
||||
typeof aggregatedOutput === "string"
|
||||
outputText !== undefined || typeof exitCode === "number"
|
||||
? {
|
||||
type: "command" as const,
|
||||
command,
|
||||
output: aggregatedOutput,
|
||||
output: outputText ?? "",
|
||||
exitCode: typeof exitCode === "number" ? exitCode : undefined,
|
||||
cwd,
|
||||
}
|
||||
|
||||
3
plan.md
3
plan.md
@@ -115,7 +115,8 @@ Build a new Codex MCP provider side‑by‑side with the existing Codex SDK prov
|
||||
- [x] **Test (E2E)**: Run tests and verify fixes work.
|
||||
- **Done (2025-12-24 19:32)**: Ran `npm run test --workspace=@paseo/server`; 9 failures (1 in `codex-agent.test.ts` missing persisted shell_command entry, 8 in `codex-mcp-agent.test.ts` for exit code, thread/item events, error timeline, persistence metadata, and permission requests).
|
||||
|
||||
- [ ] **Fix**: Codex MCP command output should include exit codes for command tool calls.
|
||||
- [x] **Fix**: Codex MCP command output should include exit codes for command tool calls.
|
||||
- **Done (2025-12-24 19:36)**: Ensured command tool outputs include exit codes even when output text is missing.
|
||||
|
||||
- [ ] **Fix**: Codex MCP thread/item event mapping should capture file_change, mcp_tool_call, web_search, and todo_list.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user