Commit Graph
95 Commits
Author SHA1 Message Date
Ahmed Ibrahim 3b90ca959b fmt 2025-08-11 00:11:30 -07:00
Ahmed Ibrahim c6cfdf705c feedback 2025-08-11 00:10:08 -07:00
Ahmed Ibrahim 622a84f4ba rebase 2025-08-05 02:03:11 -07:00
aibrahim-oai 34704ff055 Merge branch 'main' into stream-conversation 2025-08-05 01:58:05 -07:00
easong-openaiandAhmed Ibrahim e0303dbac0 Rescue chat completion changes (#1846)
https://github.com/openai/codex/pull/1835 has some messed up history.

This adds support for streaming chat completions, which is useful for ollama. We should probably take a very skeptical eye to the code introduced in this PR.

---------

Co-authored-by: Ahmed Ibrahim <aibrahim@openai.com>
2025-08-05 08:56:13 +00:00
Ahmed Ibrahim 0bf33f7359 log error 2025-08-04 22:48:44 -07:00
Ahmed Ibrahim 4259e5787f we don't need to error on submit while turn is running 2025-08-04 22:40:49 -07:00
Ahmed Ibrahim c1e9083cbd use arc instead of overusing mutex 2025-08-04 19:17:44 -07:00
Ahmed Ibrahim e38ce39c51 Revert to 3f13ebce10 without rewriting history. Wrong merge 2025-08-04 17:03:24 -07:00
Ahmed Ibrahim bd171e5206 add raw reasoning 2025-08-04 16:49:42 -07:00
Ahmed Ibrahim e054715bea verbose comments 2025-08-04 15:17:16 -07:00
Ahmed Ibrahim 7dec04ae4f deadlock 2025-08-04 15:12:53 -07:00
Ahmed Ibrahim a362ad00ce restructure 2025-08-04 13:44:45 -07:00
Ahmed Ibrahim c515d2869e restructure 2025-08-04 13:40:22 -07:00
Ahmed Ibrahim 95423b26d7 initialize struct for conversation 2025-08-04 13:07:26 -07:00
aibrahim-oai 5bab2bd2f8 Merge branch 'main' into stream-conversation 2025-08-04 10:29:35 -07:00
Gabriel Peal 1f3318c1c5 Add a TurnDiffTracker to create a unified diff for an entire turn (#1770)
This lets us show an accumulating diff across all patches in a turn.
Refer to the docs for TurnDiffTracker for implementation details.

There are multiple ways this could have been done and this felt like the
right tradeoff between reliability and completeness:
*Pros*
* It will pick up all changes to files that the model touched including
if they prettier or another command that updates them.
* It will not pick up changes made by the user or other agents to files
it didn't modify.

*Cons*
* It will pick up changes that the user made to a file that the model
also touched
* It will not pick up changes to codegen or files that were not modified
with apply_patch
2025-08-04 11:57:04 -04:00
aibrahim-oai 1294def888 Merge branch 'main' into stream-conversation 2025-08-03 13:56:51 -07:00
Ahmed Ibrahim ab70497539 move running session inside the conversation loop 2025-08-03 13:51:16 -07:00
Gabriel Peal 4c9f7b6bcc Fix flaky test_shell_command_approval_triggers_elicitation test (#1802)
This doesn't flake very often but this should fix it.
2025-08-03 10:19:12 -04:00
Ahmed Ibrahim 2a40d07a06 dry 2025-08-02 19:13:00 -07:00
Ahmed Ibrahim 2e07f4b033 fmt 2025-08-02 19:12:27 -07:00
Ahmed Ibrahim 324926e240 review 2025-08-02 19:09:13 -07:00
Ahmed Ibrahim 792efc990c ci 2025-08-02 15:17:22 -07:00
Ahmed Ibrahim ec6a4f9e2a restructure 2025-08-02 13:54:13 -07:00
Ahmed Ibrahim c01b9d2d2a restructure 2025-08-02 13:37:31 -07:00
Ahmed Ibrahim d5efc45869 comments 2025-08-02 13:20:51 -07:00
Ahmed Ibrahim dbcb9e7ca6 restructure 2025-08-02 13:00:35 -07:00
Ahmed Ibrahim 8d413194f3 edit timeout 2025-08-01 20:21:51 -07:00
Ahmed Ibrahim 19d3e17572 clippy 2025-08-01 18:45:42 -07:00
Ahmed Ibrahim a5b3c151ac improve test readability 2025-08-01 18:42:25 -07:00
Ahmed Ibrahim 0110749efa improve readability 2025-08-01 18:09:42 -07:00
Ahmed Ibrahim bea4a5358a fix test 2025-08-01 17:56:57 -07:00
Ahmed Ibrahim 4c13829e8b clippy 2025-08-01 17:41:14 -07:00
Ahmed Ibrahim 5ccd02b0fe cut some lines 2025-08-01 17:40:10 -07:00
Ahmed Ibrahim 66ea94f723 fix args 2025-08-01 17:32:02 -07:00
Ahmed Ibrahim 3a456c1fbb stream init 2025-08-01 17:25:50 -07:00
aibrahim-oaiandGabriel Peal 97ab8fb610 MCP: add conversation.create tool [Stack 2/2] (#1783)
Introduce conversation.create handler (handle_create_conversation) and
wire it in MessageProcessor.

Stack:
Top: #1783 
Bottom: #1784

---------

Co-authored-by: Gabriel Peal <gpeal@users.noreply.github.com>
2025-08-01 22:18:36 +00:00
aibrahim-oai fe62f859a6 Add Error variant to ConversationCreateResult [Stack 1/2] (#1784)
Switch ConversationCreateResult from a struct to a tagged enum (Ok |
Error)

Stack:
Top: #1783 
Bottom: #1784
2025-08-01 15:13:53 -07:00
aibrahim-oai f20de21cb6 collabse stdout and stderr delta events into one (#1787) 2025-08-01 14:00:19 -07:00
aibrahim-oai bc7beddaa2 feat: stream exec stdout events (#1786)
## Summary
- stream command stdout as `ExecCommandStdout` events
- forward streamed stdout to clients and ignore in human output
processor
- adjust call sites for new streaming API
2025-08-01 13:04:34 -07:00
aibrahim-oai f918198bbb Introduce a new function to just send user message [Stack 3/3] (#1686)
- MCP server: add send-user-message tool to send user input to a running
Codex session
- Added an integration tests for the happy and sad paths

Changes:
•	Add tool definition and schema.
•	Expose tool in capabilities.
•	Route and handle tool requests with validation.
•	Tests for success, bad UUID, and missing session.


follow‑ups
• Listen path not implemented yet; the tool is present but marked “don’t
use yet” in code comments.
• Session run flag reset: clear running_session_id_set appropriately
after turn completion/errors.

This is the third PR in a stack.
Stack:
Final: #1686
Intermediate: #1751
First: #1750
2025-08-01 17:04:12 +00:00
aibrahim-oai ad0295b893 MCP server: route structured tool-call requests and expose mcp_protocol [Stack 2/3] (#1751)
- Expose mcp_protocol from mcp-server for reuse in tests and callers.
- In MessageProcessor, detect structured ToolCallRequestParams in
tools/call and forward to a new handler.
- Add handle_new_tool_calls scaffold (returns error for now).
- Test helper: add send_send_user_message_tool_call to McpProcess to
send ConversationSendMessage requests;

This is the second PR in a stack.
Stack:
Final: #1686
Intermediate: #1751
First: #1750
2025-08-01 02:46:04 +00:00
aibrahim-oai d3aa5f46b7 MCP Protocol: Align tool-call response with CallToolResult [Stack 1/3] (#1750)
# Summary
- Align MCP server responses with mcp_types by emitting [CallToolResult,
RequestId] instead of an object.
Update send-message result to a tagged enum: Ok or Error { message }.

# Why
Protocol compliance with current MCP schema.

# Tests
- Updated assertions in mcp_protocol.rs for create/stream/send/list and
error cases.

This is the first PR in a stack.
Stack:
Final: #1686
Intermediate: #1751
First: #1750
2025-08-01 02:30:03 +00:00
Michael Bolin 5a0ad5ab8f chore: refactor exec.rs: create separate seatbelt.rs and spawn.rs files (#1762)
At 550 lines, `exec.rs` was a bit large. In particular, I found it hard
to locate the Seatbelt-related code quickly without a file with
`seatbelt` in the name, so this refactors things so:

- `spawn_command_under_seatbelt()` and dependent code moves to a new
`seatbelt.rs` file
- `spawn_child_async()` and dependent code moves to a new `spawn.rs`
file
2025-07-31 13:11:47 -07:00
pakrym-oai 51b6bdefbe Auto format toml (#1745)
Add recommended extension and configure it to auto format prompt.
2025-07-30 18:37:00 -07:00
aibrahim-oai 2f5557056d moving input item from MCP Protocol back to core Protocol (#1740)
- Currently we have duplicate input item. Let's have one source of truth
in the core.
- Used Requestid type
2025-07-30 13:43:08 -07:00
aibrahim-oai 93341797c4 fix ci (#1739)
I think this commit broke the CI because it changed the
`McpToolCallBeginEvent` type:
https://github.com/openai/codex/commit/347c81ad0049103c84e0aa2c0d7e2988db18218a
2025-07-30 11:32:38 -07:00
aibrahim-oai 3823b32b7a Mcp protocol (#1715)
- Add typed MCP protocol surface in
`codex-rs/mcp-server/src/mcp_protocol.rs` for `requests`, `responses`,
and `notifications`
- Requests: `NewConversation`, `Connect`, `SendUserMessage`,
`GetConversations`
- Message content parts: `Text`, `Image` (`ImageUrl`/`FileId`, optional
`ImageDetail`), File (`Url`/`Id`/`inline Data`)
- Responses: `ToolCallResponseEnvelope` with optional `isError` and
`structuredContent` variants (`NewConversation`, `Connect`,
`SendUserMessageAccepted`, `GetConversations`)
- Notifications: `InitialState`, `ConnectionRevoked`, `CodexEvent`,
`Cancelled`
- Uniform `_meta` on `notifications` via `NotificationMeta`
(`conversationId`, `requestId`)
- Unit tests validate JSON wire shapes for key
`requests`/`responses`/`notifications`
2025-07-29 20:14:41 -07:00
Gabriel Peal 8828f6f082 Add an experimental plan tool (#1726)
This adds a tool the model can call to update a plan. The tool doesn't
actually _do_ anything but it gives clients a chance to read and render
the structured plan. We will likely iterate on the prompt and tools
exposed for planning over time.
2025-07-29 14:22:02 -04:00