Commit Graph
5112 Commits
Author SHA1 Message Date
Michael Bolin 04d32f5b9d merge commit for archive created by Sapling 2025-11-20 18:00:09 -08:00
Michael Bolin 80c772c9b8 feat: codex-shell-tool-mcp 2025-11-20 18:00:04 -08:00
Michael Bolin ab4c6224d4 merge commit for archive created by Sapling 2025-11-20 17:54:32 -08:00
Michael Bolin 8c0fb0978a feat: codex-shell-tool-mcp 2025-11-20 17:54:27 -08:00
Michael Bolin c124fd3bcd merge commit for archive created by Sapling 2025-11-20 17:47:53 -08:00
Michael Bolin 596b330bb4 feat: codex-shell-tool-mcp 2025-11-20 17:47:17 -08:00
Michael Bolin 94ab901a34 merge commit for archive created by Sapling 2025-11-20 17:39:17 -08:00
Michael Bolin 43fb007bbc feat: codex-shell-tool-mcp 2025-11-20 17:39:05 -08:00
Michael Bolin 4a5b8b20a2 merge commit for archive created by Sapling 2025-11-20 17:14:55 -08:00
Michael Bolin dece24b467 feat: codex-shell-tool-mcp 2025-11-20 17:14:47 -08:00
Michael Bolin 23a753bb86 Merge 591f0ee2a0 into sapling-pr-archive-bolinfest 2025-11-20 16:47:33 -08:00
Michael Bolin 591f0ee2a0 feat: codex-shell-tool-mcp 2025-11-20 16:45:46 -08:00
Michael Bolin 8e5f38c0f0 feat: waiting for an elicitation should not count against a shell tool timeout (#6973)
Previously, we were running into an issue where we would run the `shell`
tool call with a timeout of 10s, but it fired an elicitation asking for
user approval, the time the user took to respond to the elicitation was
counted agains the 10s timeout, so the `shell` tool call would fail with
a timeout error unless the user is very fast!

This PR addresses this issue by introducing a "stopwatch" abstraction
that is used to manage the timeout. The idea is:

- `Stopwatch::new()` is called with the _real_ timeout of the `shell`
tool call.
- `process_exec_tool_call()` is called with the `Cancellation` variant
of `ExecExpiration` because it should not manage its own timeout in this
case
- the `Stopwatch` expiration is wired up to the `cancel_rx` passed to
`process_exec_tool_call()`
- when an elicitation for the `shell` tool call is received, the
`Stopwatch` pauses
- because it is possible for multiple elicitations to arrive
concurrently, it keeps track of the number of "active pauses" and does
not resume until that counter goes down to zero

I verified that I can test the MCP server using
`@modelcontextprotocol/inspector` and specify `git status` as the
`command` with a timeout of 500ms and that the elicitation pops up and I
have all the time in the world to respond whereas previous to this PR,
that would not have been possible.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/6973).
* #7005
* __->__ #6973
* #6972
2025-11-20 16:45:38 -08:00
Ahmed Ibrahim 1388e99674 fix flaky tool_call_output_exceeds_limit_truncated_chars_limit (#7043)
I am suspecting this is flaky because of the wall time can become 0,
0.1, or 1.
2025-11-20 16:36:29 -08:00
Michael Bolin 1bc4ab1a89 Merge c33e2de3e6 into sapling-pr-archive-bolinfest 2025-11-20 16:30:46 -08:00
Michael Bolin c33e2de3e6 feat: codex-shell-tool-mcp 2025-11-20 16:30:18 -08:00
Michael Bolin f5ee3ee637 feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 16:30:18 -08:00
Michael Bolin f56d1dc8fc feat: update process_exec_tool_call() to take a cancellation token (#6972)
This updates `ExecParams` so that instead of taking `timeout_ms:
Option<u64>`, it now takes a more general cancellation mechanism,
`ExecExpiration`, which is an enum that includes a
`Cancellation(tokio_util::sync::CancellationToken)` variant.

If the cancellation token is fired, then `process_exec_tool_call()`
returns in the same way as if a timeout was exceeded.

This is necessary so that in #6973, we can manage the timeout logic
external to the `process_exec_tool_call()` because we want to "suspend"
the timeout when an elicitation from a human user is pending.








---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/6972).
* #7005
* #6973
* __->__ #6972
2025-11-20 16:29:57 -08:00
Michael Bolin 0d1b4dd643 merge commit for archive created by Sapling 2025-11-20 16:22:56 -08:00
Michael Bolin a3821f1904 feat: codex-shell-tool-mcp 2025-11-20 16:22:49 -08:00
Michael Bolin 5f4459948f feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 16:22:49 -08:00
Michael Bolin fa83591049 merge commit for archive created by Sapling 2025-11-20 16:16:25 -08:00
Michael Bolin 8d3473b229 feat: update process_exec_tool_call() to take a cancellation token 2025-11-20 16:16:17 -08:00
Michael Bolin 3c3bedc8bb feat: codex-shell-tool-mcp 2025-11-20 16:16:17 -08:00
Michael Bolin 24e97ab3c4 feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 16:16:17 -08:00
Michael Bolin 0b30f833d3 merge commit for archive created by Sapling 2025-11-20 16:14:17 -08:00
Michael Bolin 35075b2f0e feat: codex-shell-tool-mcp 2025-11-20 16:14:10 -08:00
Michael Bolin 50ab543dea feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 16:14:10 -08:00
Michael Bolin 3892e0b578 merge commit for archive created by Sapling 2025-11-20 16:07:13 -08:00
Michael Bolin 6e37a602f7 feat: update process_exec_tool_call() to take a cancellation token 2025-11-20 16:07:07 -08:00
Michael Bolin 0bb0c48415 feat: codex-shell-tool-mcp 2025-11-20 16:07:07 -08:00
Michael Bolin 0401532bec feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 16:07:07 -08:00
Ahmed Ibrahim 9be310041b migrate collect_tool_identifiers_for_model to test_codex (#7041)
Maybe it solved flakiness
2025-11-20 16:02:50 -08:00
Michael Bolin d25a07c6c3 merge commit for archive created by Sapling 2025-11-20 16:02:18 -08:00
Michael Bolin f0cc39b131 feat: codex-shell-tool-mcp 2025-11-20 16:02:08 -08:00
Michael Bolin 45586d7bbf feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 16:02:08 -08:00
Michael Bolin 4c158b05ce feat: update process_exec_tool_call() to take a cancellation token 2025-11-20 16:02:08 -08:00
Xiao-Yong Jin 0fbcdd77c8 core: make shell behavior portable on FreeBSD (#7039)
- Use /bin/sh instead of /bin/bash on FreeBSD/OpenBSD in the process
group timeout test to avoid command-not-found failures.

- Accept /usr/local/bin/bash as a valid SHELL path to match common
FreeBSD installations.

- Switch the shell serialization duration test to /bin/sh for improved
portability across Unix platforms.

With this change, `cargo test -p codex-core --lib` runs and passes on
FreeBSD.
2025-11-20 16:01:35 -08:00
Michael Bolin 4c4c5b5803 merge commit for archive created by Sapling 2025-11-20 15:44:54 -08:00
Michael Bolin c975c3d60f feat: codex-shell-tool-mcp 2025-11-20 15:44:43 -08:00
Michael Bolin 88c03b24b2 feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 15:44:43 -08:00
Michael Bolin e38be129a7 feat: update process_exec_tool_call() to take a cancellation token 2025-11-20 15:44:43 -08:00
Michael Bolin 2538a5fd23 merge commit for archive created by Sapling 2025-11-20 15:23:13 -08:00
Michael Bolin 781e03664c feat: codex-shell-tool-mcp 2025-11-20 15:23:05 -08:00
Michael Bolin 782ed9af2e feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 15:23:05 -08:00
Michael Bolin 208863fdd6 feat: update process_exec_tool_call() to take a cancellation token 2025-11-20 15:23:04 -08:00
Celia Chen 9bce050385 [app-server & core] introduce new codex error code and v2 app-server error events (#6938)
This PR does two things:
1. populate a new `codex_error_code` protocol in error events sent from
core to client;
2. old v1 core events `codex/event/stream_error` and `codex/event/error`
will now both become `error`. We also show codex error code for
turncompleted -> error status.

new events in app server test:
```
< {
<   "method": "codex/event/stream_error",
<   "params": {
<     "conversationId": "019aa34c-0c14-70e0-9706-98520a760d67",
<     "id": "0",
<     "msg": {
<       "codex_error_code": {
<         "response_stream_disconnected": {
<           "http_status_code": 401
<         }
<       },
<       "message": "Reconnecting... 2/5",
<       "type": "stream_error"
<     }
<   }
< }

 {
<   "method": "error",
<   "params": {
<     "error": {
<       "codexErrorCode": {
<         "responseStreamDisconnected": {
<           "httpStatusCode": 401
<         }
<       },
<       "message": "Reconnecting... 2/5"
<     }
<   }
< }

< {
<   "method": "turn/completed",
<   "params": {
<     "turn": {
<       "error": {
<         "codexErrorCode": {
<           "responseTooManyFailedAttempts": {
<             "httpStatusCode": 401
<           }
<         },
<         "message": "exceeded retry limit, last status: 401 Unauthorized, request id: 9a1b495a1a97ed3e-SJC"
<       },
<       "id": "0",
<       "items": [],
<       "status": "failed"
<     }
<   }
< }
```
2025-11-20 23:06:55 +00:00
Michael Bolin 4d03259976 merge commit for archive created by Sapling 2025-11-20 15:05:45 -08:00
Michael Bolin 9fb1355710 feat: codex-shell-tool-mcp 2025-11-20 15:05:30 -08:00
Michael Bolin a0e90b219c feat: waiting for an elicitation should not count against a shell tool timeout 2025-11-20 15:05:30 -08:00