Commit Graph

491 Commits

Author SHA1 Message Date
jimmyfraiture
601f5715c6 fix merge 2025-10-03 14:31:38 +01:00
jimmyfraiture
39cfc8465c Merge remote-tracking branch 'origin/main' into jif/parallel-tool-calls
# Conflicts:
#	codex-rs/core/src/client_common.rs
#	codex-rs/core/src/codex.rs
#	codex-rs/core/src/config.rs
#	codex-rs/core/src/lib.rs
#	codex-rs/core/src/tools/handlers/apply_patch.rs
#	codex-rs/core/src/tools/handlers/mod.rs
#	codex-rs/core/src/tools/handlers/plan.rs
#	codex-rs/core/src/tools/handlers/read_file.rs
#	codex-rs/core/src/tools/handlers/view_image.rs
#	codex-rs/core/src/tools/mod.rs
#	codex-rs/core/src/tools/registry.rs
#	codex-rs/core/src/tools/router.rs
#	codex-rs/core/src/tools/spec.rs
#	codex-rs/core/tests/suite/mod.rs
#	codex-rs/core/tests/suite/read_file.rs
#	codex-rs/core/tests/suite/view_image.rs
2025-10-03 14:00:51 +01:00
jif-oai
33d3ecbccc chore: refactor tool handling (#4510)
# Tool System Refactor

- Centralizes tool definitions and execution in `core/src/tools/*`:
specs (`spec.rs`), handlers (`handlers/*`), router (`router.rs`),
registry/dispatch (`registry.rs`), and shared context (`context.rs`).
One registry now builds the model-visible tool list and binds handlers.
- Router converts model responses to tool calls; Registry dispatches
with consistent telemetry via `codex-rs/otel` and unified error
handling. Function, Local Shell, MCP, and experimental `unified_exec`
all flow through this path; legacy shell aliases still work.
- Rationale: reduce per‑tool boilerplate, keep spec/handler in sync, and
make adding tools predictable and testable.

Example: `read_file`
- Spec: `core/src/tools/spec.rs` (see `create_read_file_tool`,
registered by `build_specs`).
- Handler: `core/src/tools/handlers/read_file.rs` (absolute `file_path`,
1‑indexed `offset`, `limit`, `L#: ` prefixes, safe truncation).
- E2E test: `core/tests/suite/read_file.rs` validates the tool returns
the requested lines.

## Next steps:
- Decompose `handle_container_exec_with_params` 
- Add parallel tool calls
2025-10-03 13:21:06 +01:00
jif-oai
69cb72f842 chore: sandbox refactor 2 (#4653)
Revert the revert and fix the UI issue
2025-10-03 11:17:39 +01:00
Ahmed Ibrahim
ed5d656fa8 Revert "chore: sanbox extraction" (#4626)
Reverts openai/codex#4286
2025-10-02 21:09:21 +00:00
pakrym-oai
4c566d484a Separate interactive and non-interactive sessions (#4612)
Do not show exec session in VSCode/TUI selector.
2025-10-02 13:06:21 -07:00
Jeremy Rose
45936f8fbd show "Viewed Image" when the model views an image (#4475)
<img width="1022" height="339" alt="Screenshot 2025-09-29 at 4 22 00 PM"
src="https://github.com/user-attachments/assets/12da7358-19be-4010-a71b-496ede6dfbbf"
/>
2025-10-02 18:36:03 +00:00
Marcus Griep
b727d3f98a fix: handle JSON Schema in additionalProperties for MCP tools (#4454)
Fixes #4176

Some common tools provide a schema (even if just an empty object schema)
as the value for `additionalProperties`. The parsing as it currently
stands fails when it encounters this. This PR updates the schema to
accept a schema object in addition to a boolean value, per the JSON
Schema spec.
2025-10-02 13:05:51 -04:00
pakrym-oai
2f6fb37d72 Support CODEX_API_KEY for codex exec (#4615)
Allows to set API key per invocation of `codex exec`
2025-10-02 09:59:45 -07:00
jif-oai
e0850b71f8 Merge branch 'jif/tool_refactors-1' into jif/parallel-tool-calls 2025-10-02 13:35:01 +01:00
jimmyfraiture
0d05d03b94 Add a bunch of tests 2025-10-02 11:07:43 +01:00
pakrym-oai
e899ae7d8a Include request ID in the error message (#4572)
To help with issue debugging
<img width="1414" height="253" alt="image"
src="https://github.com/user-attachments/assets/254732df-44ac-4252-997a-6c5e0927355b"
/>
2025-10-01 15:36:04 -07:00
iceweasel-oai
6f97ec4990 canonicalize display of Agents.md paths on Windows. (#4577)
Canonicalize path on Windows to 
- remove unattractive path prefixes such as `\\?\`
- simplify it (`../AGENTS.md` vs
`C:\Users\iceweasel\code\coded\Agents.md`)
before: <img width="1110" height="45" alt="Screenshot 2025-10-01 123520"
src="https://github.com/user-attachments/assets/48920ae6-d89c-41b8-b4ea-df5c18fb5fad"
/>

after: 
<img width="585" height="46" alt="Screenshot 2025-10-01 123612"
src="https://github.com/user-attachments/assets/70a1761a-9d97-4836-b14c-670b6f13e608"
/>
2025-10-01 14:33:19 -07:00
easong-openai
400a5a90bf Fall back to configured instruction files if AGENTS.md isn't available (#4544)
Allow users to configure an agents.md alternative to consume, but warn
the user it may degrade model performance.

Fixes #4376
2025-10-01 18:19:59 +00:00
Ahmed Ibrahim
d78d0764aa Add Updated at time in resume picker (#4468)
<img width="639" height="281" alt="image"
src="https://github.com/user-attachments/assets/92b2ad2b-9e18-4485-9b8d-d7056eb98651"
/>
2025-10-01 10:40:43 -07:00
iceweasel-oai
dde615f482 implement command safety for PowerShell commands (#4269)
Implement command safety for PowerShell commands on Windows

This change adds a new Windows-specific command-safety module under
`codex-rs/core/src/command_safety/windows_safe_commands.rs` to strictly
sanitise PowerShell invocations. Key points:

- Introduce `is_safe_command_windows()` to only allow explicitly
read-only PowerShell calls.
- Parse and split PowerShell invocations (including inline `-Command`
scripts and pipelines).
- Block unsafe switches (`-File`, `-EncodedCommand`, `-ExecutionPolicy`,
unknown flags, call operators, redirections, separators).
- Whitelist only read-only cmdlets (`Get-ChildItem`, `Get-Content`,
`Select-Object`, etc.), safe Git subcommands (`status`, `log`, `show`,
`diff`, `cat-file`), and ripgrep without unsafe options.
- Add comprehensive unit tests covering allowed and rejected command
patterns (nested calls, side effects, chaining, redirections).

This ensures Codex on Windows can safely execute discover-only
PowerShell workflows without risking destructive operations.
2025-10-01 09:56:48 -07:00
jimmyfraiture
60de27031e V3 2025-10-01 17:13:14 +01:00
jimmyfraiture
ad29d2bf39 V2 2025-10-01 17:12:29 +01:00
jimmyfraiture
a6d3e2a334 V1 2025-10-01 16:42:01 +01:00
jimmyfraiture
0a24fed30b Add some tests 2025-10-01 13:58:23 +01:00
jimmyfraiture
9921a061ed Fix few more nits 2025-10-01 13:32:18 +01:00
jimmyfraiture
0a75a69ae6 Update limit of read_file 2025-10-01 13:27:59 +01:00
jimmyfraiture
c3d2c83d0b Fix regression 2 2025-10-01 12:53:59 +01:00
jimmyfraiture
e23cbcaaf6 Fix regression 1 2025-10-01 12:37:08 +01:00
jimmyfraiture
0718b00b80 Fix merge 2 2025-10-01 12:18:37 +01:00
jimmyfraiture
d3687a7a65 Fix merge 1 2025-10-01 12:10:07 +01:00
jimmyfraiture
5305f247aa Merge remote-tracking branch 'origin/main' into jif/tool_refactors-1
# Conflicts:
#	codex-rs/core/src/codex.rs
#	codex-rs/core/src/executor/mod.rs
#	codex-rs/core/src/executor/runner.rs
2025-10-01 12:09:18 +01:00
jif-oai
b8195a17e5 chore: sanbox extraction (#4286)
# Extract and Centralize Sandboxing
- Goal: Improve safety and clarity by centralizing sandbox planning and
execution.
  - Approach:
- Add planner (ExecPlan) and backend registry (Direct/Seatbelt/Linux)
with run_with_plan.
- Refactor codex.rs to plan-then-execute; handle failures/escalation via
the plan.
- Delegate apply_patch to the codex binary and run it with an empty env
for determinism.
2025-10-01 12:05:12 +01:00
jimmyfraiture
fcbf2b6c0a Fix regression 2025-10-01 11:34:00 +01:00
jimmyfraiture
46d53a2430 Fix otel race condition 2025-10-01 09:16:27 +01:00
Michael Bolin
5881c0d6d4 fix: remove mcp-types from app server protocol (#4537)
We continue the separation between `codex app-server` and `codex
mcp-server`.

In particular, we introduce a new crate, `codex-app-server-protocol`,
and migrate `codex-rs/protocol/src/mcp_protocol.rs` into it, renaming it
`codex-rs/app-server-protocol/src/protocol.rs`.

Because `ConversationId` was defined in `mcp_protocol.rs`, we move it
into its own file, `codex-rs/protocol/src/conversation_id.rs`, and
because it is referenced in a ton of places, we have to touch a lot of
files as part of this PR.

We also decide to get away from proper JSON-RPC 2.0 semantics, so we
also introduce `codex-rs/app-server-protocol/src/jsonrpc_lite.rs`, which
is basically the same `JSONRPCMessage` type defined in `mcp-types`
except with all of the `"jsonrpc": "2.0"` removed.

Getting rid of `"jsonrpc": "2.0"` makes our serialization logic
considerably simpler, as we can lean heavier on serde to serialize
directly into the wire format that we use now.
2025-10-01 02:16:26 +00:00
jimmyfraiture
ee5f5e85cd Fix tests and clippy 2025-09-30 21:03:35 +01:00
jimmyfraiture
9e04b908e1 Add read file 2025-09-30 19:07:22 +01:00
jimmyfraiture
150765dbe3 V2 2025-09-30 17:19:23 +01:00
jimmyfraiture
dccf499850 V1 2025-09-30 17:02:58 +01:00
jimmyfraiture
3def127178 Clippy 2025-09-30 13:31:48 +01:00
jimmyfraiture
5c00e1596a Restore otel 2025-09-30 13:28:25 +01:00
jimmyfraiture
9c194dc0f9 Fix merge 2025-09-30 12:56:30 +01:00
jimmyfraiture
4533dceafa Merge remote-tracking branch 'origin/main' into jif/sandbox-1
# Conflicts:
#	codex-rs/core/src/codex.rs
2025-09-30 12:45:23 +01:00
jimmyfraiture
43c0abb31e RV 6 2025-09-30 12:42:36 +01:00
jimmyfraiture
8c09db17c3 RV 5 2025-09-30 12:04:44 +01:00
jimmyfraiture
1d87628d41 RV 4 2025-09-30 11:55:43 +01:00
jimmyfraiture
4656160e31 RV 3 2025-09-30 11:40:44 +01:00
jimmyfraiture
2dd226891a RV 2 2025-09-30 11:36:51 +01:00
jimmyfraiture
ed45f85209 RV 1 2025-09-30 11:27:23 +01:00
easong-openai
5b038135de Add cloud tasks (#3197)
Adds a TUI for managing, applying, and creating cloud tasks
2025-09-30 10:10:33 +00:00
pakrym-oai
c09e131653 Set originator for codex exec (#4485)
Distinct from the main CLI.
2025-09-29 20:59:19 -07:00
Ahmed Ibrahim
16057e76b0 [Core]: add tail in the rollout data (#4461)
This will help us show the conversation tail and last updated timestamp.
2025-09-29 14:32:26 -07:00
dedrisian-oai
83a4d4d8ed Parse out frontmatter for custom prompts (#4456)
[Cherry picked from https://github.com/openai/codex/pull/3565]

Removes the frontmatter description/args from custom prompt files and
only includes body.
2025-09-29 13:06:08 -07:00
jimmyfraiture
5b74f10a7b Sandboxing iteration 2 2025-09-29 19:34:12 +01:00