Commit Graph

2105 Commits

Author SHA1 Message Date
Michael Bolin
f5d3cb0dd6 merge commit for archive created by Sapling 2025-07-20 20:09:58 -07:00
Michael Bolin
24a80cf9d7 fix: integration test for MCP server 2025-07-20 20:09:52 -07:00
Michael Bolin
12c516f7ba merge commit for archive created by Sapling 2025-07-20 19:56:42 -07:00
Michael Bolin
111bab0a61 fix: integration test for MCP server 2025-07-20 19:56:19 -07:00
Michael Bolin
d7e6ba42d8 merge commit for archive created by Sapling 2025-07-20 19:44:22 -07:00
Michael Bolin
4640946c05 fix: integration test for MCP server 2025-07-20 19:44:17 -07:00
Michael Bolin
547342b2e1 merge commit for archive created by Sapling 2025-07-20 19:41:26 -07:00
Michael Bolin
69bdec9824 fix: integration test for MCP server 2025-07-20 19:41:20 -07:00
Michael Bolin
0022eeeee5 merge commit for archive created by Sapling 2025-07-20 19:23:30 -07:00
Michael Bolin
78ad35a6a9 fix: integration test for MCP server 2025-07-20 19:23:05 -07:00
Michael Bolin
20d74a9562 merge commit for archive created by Sapling 2025-07-20 19:16:20 -07:00
Michael Bolin
cfd24302bb fix: integration test for MCP server 2025-07-20 19:16:15 -07:00
Michael Bolin
6c9a411cc8 merge commit for archive created by Sapling 2025-07-20 19:15:47 -07:00
Michael Bolin
58bcc91c7f fix: integration test for MCP server 2025-07-20 19:13:33 -07:00
Michael Bolin
62fe3fc4db Merge 96092108b1 into sapling-pr-archive-bolinfest 2025-07-20 17:42:23 -04:00
Michael Bolin
96092108b1 fix: integration test for MCP server 2025-07-20 14:42:17 -07:00
Michael Bolin
8a6c6cee88 fix: address review feedback on #1621 and #1623 (#1631)
- formalizes `ExecApprovalElicitRequestParams`
- adds some defensive logic when messages fail to parse
- fixes a typo in a comment
2025-07-20 14:42:11 -07:00
Michael Bolin
9bce460754 merge commit for archive created by Sapling 2025-07-20 14:37:13 -07:00
Michael Bolin
1a608d680b fix: integration test for MCP server 2025-07-20 14:36:51 -07:00
Michael Bolin
96343988f2 fix: address review feedback on #1621 and #1623 2025-07-20 14:36:51 -07:00
Gabriel Peal
8b590105de Don't drop sessions on elicitation responses (#1629) 2025-07-20 13:31:19 -04:00
Michael Bolin
e3827fcb43 Merge 900509d12c into sapling-pr-archive-bolinfest 2025-07-20 11:15:06 -04:00
Michael Bolin
900509d12c fix: address review feedback on #1621 and #1623 2025-07-20 11:14:52 -04:00
Michael Bolin
4c6c7addda merge commit for archive created by Sapling 2025-07-19 12:31:30 -04:00
Michael Bolin
45b0b67c10 fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in a timely manner 2025-07-19 12:31:21 -04:00
Michael Bolin
adcad5b1de merge commit for archive created by Sapling 2025-07-19 12:01:21 -04:00
Michael Bolin
b9a18b9a24 fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in a timely manner 2025-07-19 12:01:16 -04:00
Michael Bolin
e7741647bd merge commit for archive created by Sapling 2025-07-19 11:24:00 -04:00
Michael Bolin
0c9247556a fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in a timely manner 2025-07-19 11:23:55 -04:00
Michael Bolin
34fbfe59c9 merge commit for archive created by Sapling 2025-07-19 11:17:14 -04:00
Michael Bolin
32767b7ee1 fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in a timely manner 2025-07-19 11:17:09 -04:00
Michael Bolin
4f97301423 Merge 3d782880e3 into sapling-pr-archive-bolinfest 2025-07-19 11:12:13 -04:00
Michael Bolin
3d782880e3 fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in a timely manner 2025-07-19 11:12:06 -04:00
Michael Bolin
018003e52f feat: leverage elicitations in the MCP server (#1623)
This updates the MCP server so that if it receives an
`ExecApprovalRequest` from the `Codex` session, it in turn sends an [MCP
elicitation](https://modelcontextprotocol.io/specification/draft/client/elicitation)
to the client to ask for the approval decision. Upon getting a response,
it forwards the client's decision via `Op::ExecApproval`.

Admittedly, we should be doing the same thing for
`ApplyPatchApprovalRequest`, but this is our first time experimenting
with elicitations, so I'm inclined to defer wiring that code path up
until we feel good about how this one works.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1623).
* __->__ #1623
* #1622
* #1621
* #1620
2025-07-19 01:32:03 -04:00
Michael Bolin
d704b83b03 merge commit for archive created by Sapling 2025-07-19 01:08:05 -04:00
Michael Bolin
5724b3bf58 feat: leverage elicitations in the MCP server 2025-07-19 01:06:40 -04:00
Michael Bolin
170aa5f9ca Merge 7d7d3084bc into sapling-pr-archive-bolinfest 2025-07-19 00:31:28 -04:00
Michael Bolin
7d7d3084bc feat: leverage elicitations in the MCP server 2025-07-19 00:31:04 -04:00
Michael Bolin
11fd3123be chore: introduce OutgoingMessageSender (#1622)
Previous to this change, `MessageProcessor` had a
`tokio::sync::mpsc::Sender<JSONRPCMessage>` as an abstraction for server
code to send a message down to the MCP client. Because `Sender` is cheap
to `clone()`, it was straightforward to make it available to tasks
scheduled with `tokio::task::spawn()`.

This worked well when we were only sending notifications or responses
back down to the client, but we want to add support for sending
elicitations in #1623, which means that we need to be able to send
_requests_ to the client, and now we need a bit of centralization to
ensure all request ids are unique.

To that end, this PR introduces `OutgoingMessageSender`, which houses
the existing `Sender<OutgoingMessage>` as well as an `AtomicI64` to mint
out new, unique request ids. It has methods like `send_request()` and
`send_response()` so that callers do not have to deal with
`JSONRPCMessage` directly, as having to set the `jsonrpc` for each
message was a bit tedious (this cleans up `codex_tool_runner.rs` quite a
bit).

We do not have `OutgoingMessageSender` implement `Clone` because it is
important that the `AtomicI64` is shared across all users of
`OutgoingMessageSender`. As such, `Arc<OutgoingMessageSender>` must be
used instead, as it is frequently shared with new tokio tasks.

As part of this change, we update `message_processor.rs` to embrace
`await`, though we must be careful that no individual handler blocks the
main loop and prevents other messages from being handled.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1622).
* #1623
* __->__ #1622
* #1621
* #1620
2025-07-19 00:30:56 -04:00
Michael Bolin
24c0c2985a Merge 4a70da083e into sapling-pr-archive-bolinfest 2025-07-19 00:18:31 -04:00
Michael Bolin
4a70da083e feat: leverage elicitations in the MCP server 2025-07-19 00:10:47 -04:00
Michael Bolin
3fe0feabbc chore: introduce OutgoingMessageSender 2025-07-19 00:10:47 -04:00
Michael Bolin
e78ec00e73 chore: support MCP schema 2025-06-18 (#1621)
This updates the schema in `generate_mcp_types.py` from `2025-03-26` to
`2025-06-18`, regenerates `mcp-types/src/lib.rs`, and then updates all
the code that uses `mcp-types` to honor the changes.

Ran

```
npx @modelcontextprotocol/inspector just codex mcp
```

and verified that I was able to invoke the `codex` tool, as expected.


---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1621).
* #1623
* #1622
* __->__ #1621
2025-07-19 00:09:34 -04:00
Michael Bolin
471f185b0a merge commit for archive created by Sapling 2025-07-18 23:44:00 -04:00
Michael Bolin
d7676ec022 feat: leverage elicitations in the MCP server 2025-07-18 23:43:46 -04:00
Michael Bolin
bd223a2a10 chore: introduce OutgoingMessageSender 2025-07-18 23:43:46 -04:00
Michael Bolin
888326403d chore: support MCP schema 2025-06-18 2025-07-18 23:43:46 -04:00
Michael Bolin
85a8f7c167 Merge f9ad2814d6 into sapling-pr-archive-bolinfest 2025-07-18 23:30:59 -04:00
Michael Bolin
f9ad2814d6 feat: leverage elicitations in the MCP server 2025-07-18 23:30:47 -04:00
Michael Bolin
db02c0134f chore: introduce OutgoingMessageSender 2025-07-18 23:30:47 -04:00