Commit Graph
138 Commits
Author SHA1 Message Date
James Peter e293560dd6 fix(core/git_worktree): gate cache copying behind env 2025-10-05 11:32:59 +10:00
James Peter 3fbc0c9e7b fix(core/git-worktree): gate target cache mirroring 2025-10-05 10:38:55 +10:00
James Peter 224af74fc0 chore(workspace): sync codex tree and finish reset plan 2025-10-05 09:04:09 +10:00
James Peter 43ffb858a9 docs(plan): record snapshot and pruning strategy 2025-10-05 04:57:59 +10:00
James Peter 220a6b3b9c feat(code-rs): add forked workspace and dual build support 2025-10-05 04:27:49 +10:00
James Peter c323a434f7 docs(plan): reset strategy for code/core refactor 2025-10-04 22:34:23 +10:00
James Peter a674871f82 Merge upstream/main: adopt CLI stdin login and TUI fixes 2025-10-03 23:11:53 +10:00
Michael BolinandGitHub c20f670bfb fix: replace --api-key with --with-api-key in codex login (#4646)
Previously, users could supply their API key directly via:

```shell
codex login --api-key KEY
```

but this has the drawback that `KEY` is more likely to end up in shell
history, can be read from `/proc`, etc.

This PR removes support for `--api-key` and replaces it with
`--with-api-key`, which reads the key from stdin, so either of these are
better options:

```
printenv OPENAI_API_KEY | codex login --with-api-key
codex login --with-api-key < my_key.txt
```

Other CLIs, such as `gh auth login --with-token`, follow the same
practice.
2025-10-03 06:17:31 +00:00
James Peter 9f4221ec4a feat(protocol): add MCP shim and sync tool stack 2025-10-03 14:36:00 +10:00
James Peter 05cf8e3924 merge(upstream): add automation prompts and exec docs 2025-10-03 14:26:48 +10:00
James Peter c6ca1ee6be merge code-branch-20251002-131120 via /merge 2025-10-03 09:47:25 +10:00
James Peter 4287c91a40 fix(tui/order): enforce ticketed background events 2025-10-03 08:32:36 +10:00
pakrym-oaiandGitHub 1bc66af362 Add a separate exec doc (#4583)
More/better docs.
2025-10-02 13:33:08 -07:00
James Peter db582085b5 feat(core/agents): add 'cloud' agent support across run_agent, /plan, /solve; docs and examples; basic tests
- core/agent_tool: recognize "cloud" model and append prompt positionally; honor per‑mode args
- core/codex(agent_run): include "cloud" in command resolution + PATH check
- core/slash_commands: default /plan,/solve models now include "cloud"; test asserts prompt includes it
- core/agent_defaults: add cloud case (no default flags); unit test ensures empty defaults
- docs: note default agent set includes "cloud"; add config example

Build passes via ./build-fast.sh. Full test suite currently fails on unrelated preexisting test drift (protocol/test-support imports, enum shapes).
2025-10-02 23:53:36 +10:00
James Peter 8d12d91970 feat(tui/review): add persistent auto resolve workflow 2025-10-02 22:10:37 +10:00
James Peter 81c6b943ce refactor(history): centralize running tool bookkeeping 2025-10-02 14:00:44 +10:00
James Peter 00e2cc6f69 feat(tui/history): consolidate history state and spinner cadence 2025-10-02 09:46:04 +10:00
easong-openaiandGitHub 2bf7607c2c 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
James Peter 080563be2d feat(tui/cloud): add /cloud command for cloud task management 2025-10-01 18:58:27 +10:00
James Peter b0e445a4ef chore(merge): prepare workspace for vitual cherry-pick 2025-10-01 04:11:40 +10:00
Michael BolinandGitHub 56e664c6d6 fix: separate codex mcp into codex mcp-server and codex app-server (#4471)
This is a very large PR with some non-backwards-compatible changes.

Historically, `codex mcp` (or `codex mcp serve`) started a JSON-RPC-ish
server that had two overlapping responsibilities:

- Running an MCP server, providing some basic tool calls.
- Running the app server used to power experiences such as the VS Code
extension.

This PR aims to separate these into distinct concepts:

- `codex mcp-server` for the MCP server
- `codex app-server` for the "application server"

Note `codex mcp` still exists because it already has its own subcommands
for MCP management (`list`, `add`, etc.)

The MCP logic continues to live in `codex-rs/mcp-server` whereas the
refactored app server logic is in the new `codex-rs/app-server` folder.
Note that most of the existing integration tests in
`codex-rs/mcp-server/tests/suite` were actually for the app server, so
all the tests have been moved with the exception of
`codex-rs/mcp-server/tests/suite/mod.rs`.

Because this is already a large diff, I tried not to change more than I
had to, so `codex-rs/app-server/tests/common/mcp_process.rs` still uses
the name `McpProcess` for now, but I will do some mechanical renamings
to things like `AppServer` in subsequent PRs.

While `mcp-server` and `app-server` share some overlapping functionality
(like reading streams of JSONL and dispatching based on message types)
and some differences (completely different message types), I ended up
doing a bit of copypasta between the two crates, as both have somewhat
similar `message_processor.rs` and `outgoing_message.rs` files for now,
though I expect them to diverge more in the near future.

One material change is that of the initialize handshake for `codex
app-server`, as we no longer use the MCP types for that handshake.
Instead, we update `codex-rs/protocol/src/mcp_protocol.rs` to add an
`Initialize` variant to `ClientRequest`, which takes the `ClientInfo`
object we need to update the `USER_AGENT_SUFFIX` in
`codex-rs/app-server/src/message_processor.rs`.

One other material change is in
`codex-rs/app-server/src/codex_message_processor.rs` where I eliminated
a use of the `send_event_as_notification()` method I am generally trying
to deprecate (because it blindly maps an `EventMsg` into a
`JSONNotification`) in favor of `send_server_notification()`, which
takes a `ServerNotification`, as that is intended to be a custom enum of
all notification types supported by the app server. So to make this
update, I had to introduce a new variant of `ServerNotification`,
`SessionConfigured`, which is a non-backwards compatible change with the
old `codex mcp`, and clients will have to be updated after the next
release that contains this PR. Note that
`codex-rs/app-server/tests/suite/list_resume.rs` also had to be update
to reflect this change.

I introduced `codex-rs/utils/json-to-toml/src/lib.rs` as a small utility
crate to avoid some of the copying between `mcp-server` and
`app-server`.
2025-09-30 07:06:18 +00:00
Gabriel PealandGitHub 1f2a050ecb Update MCP docs to reference experimental RMCP client (#4422) 2025-09-30 02:44:16 -04:00
dedrisian-oaiandGitHub 7b91550b6f Custom prompt args (numeric) (#4470)
[Cherry picked from /pull/3565]

Adds $1, $2, $3, $ARGUMENTS param parsing for custom prompts.
2025-09-29 16:14:37 -07:00
vishnu-oaiandGitHub 00e9385e78 OpenTelemetry events (#2103)
### Title

## otel

Codex can emit [OpenTelemetry](https://opentelemetry.io/) **log events**
that
describe each run: outbound API requests, streamed responses, user
input,
tool-approval decisions, and the result of every tool invocation. Export
is
**disabled by default** so local runs remain self-contained. Opt in by
adding an
`[otel]` table and choosing an exporter.

```toml
[otel]
environment = "staging"   # defaults to "dev"
exporter = "none"          # defaults to "none"; set to otlp-http or otlp-grpc to send events
log_user_prompt = false    # defaults to false; redact prompt text unless explicitly enabled
```

Codex tags every exported event with `service.name = "codex-cli"`, the
CLI
version, and an `env` attribute so downstream collectors can distinguish
dev/staging/prod traffic. Only telemetry produced inside the
`codex_otel`
crate—the events listed below—is forwarded to the exporter.

### Event catalog

Every event shares a common set of metadata fields: `event.timestamp`,
`conversation.id`, `app.version`, `auth_mode` (when available),
`user.account_id` (when available), `terminal.type`, `model`, and
`slug`.

With OTEL enabled Codex emits the following event types (in addition to
the
metadata above):

- `codex.api_request`
  - `cf_ray` (optional)
  - `attempt`
  - `duration_ms`
  - `http.response.status_code` (optional)
  - `error.message` (failures)
- `codex.sse_event`
  - `event.kind`
  - `duration_ms`
  - `error.message` (failures)
  - `input_token_count` (completion only)
  - `output_token_count` (completion only)
  - `cached_token_count` (completion only, optional)
  - `reasoning_token_count` (completion only, optional)
  - `tool_token_count` (completion only)
- `codex.user_prompt`
  - `prompt_length`
  - `prompt` (redacted unless `log_user_prompt = true`)
- `codex.tool_decision`
  - `tool_name`
  - `call_id`
- `decision` (`approved`, `approved_for_session`, `denied`, or `abort`)
  - `source` (`config` or `user`)
- `codex.tool_result`
  - `tool_name`
  - `call_id`
  - `arguments`
  - `duration_ms` (execution time for the tool)
  - `success` (`"true"` or `"false"`)
  - `output`

### Choosing an exporter

Set `otel.exporter` to control where events go:

- `none` – leaves instrumentation active but skips exporting. This is
the
  default.
- `otlp-http` – posts OTLP log records to an OTLP/HTTP collector.
Specify the
  endpoint, protocol, and headers your collector expects:

  ```toml
  [otel]
  exporter = { otlp-http = {
    endpoint = "https://otel.example.com/v1/logs",
    protocol = "binary",
    headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" }
  }}
  ```

- `otlp-grpc` – streams OTLP log records over gRPC. Provide the endpoint
and any
  metadata headers:

  ```toml
  [otel]
  exporter = { otlp-grpc = {
    endpoint = "https://otel.example.com:4317",
    headers = { "x-otlp-meta" = "abc123" }
  }}
  ```

If the exporter is `none` nothing is written anywhere; otherwise you
must run or point to your
own collector. All exporters run on a background batch worker that is
flushed on
shutdown.

If you build Codex from source the OTEL crate is still behind an `otel`
feature
flag; the official prebuilt binaries ship with the feature enabled. When
the
feature is disabled the telemetry hooks become no-ops so the CLI
continues to
function without the extra dependencies.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2025-09-29 11:30:55 -07:00
James Peter 15c4668028 merge code-branch-20250929-011511 via /merge 2025-09-29 12:11:43 +10:00
James Peter 67bf7fb260 feat(auto-drive): add observer thread and telemetry 2025-09-29 12:09:06 +10:00
James Peter 611e2f2954 merge code-branch-20250928-230546 via /merge 2025-09-29 10:08:08 +10:00
James Peter 8921a9c359 merge code-branch-20250927-071430 via /merge 2025-09-27 18:56:48 +10:00
James Peter b3e057f0a6 Merge branch 'issue-263' into main 2025-09-27 16:32:44 +10:00
James Peter 4b517f941a merge local main into code-branch-20250926-220945 before merge 2025-09-27 09:43:56 +10:00
James Peter 188cdf39f7 fix(mcp-server/acp): expose model selection to Zed 2025-09-27 09:01:03 +10:00
James Peter 55af690074 feat(tui/notifications): add OSC toggle and slash command 2025-09-27 06:37:31 +10:00
James Peter 5ad7b37769 refactor: remove pro mode infrastructure 2025-09-27 05:55:53 +10:00
just-every-code 7138268b81 Auto: address issue #263 - Using sub-agents to collect context for coding agents. 2025-09-26 12:19:10 +00:00
iceweasel-oaiandGitHub 4145ee6be3 fix typo in sandbox doc (#4256)
just fixes a simple typo I noticed.
2025-09-25 16:03:44 -07:00
James Peter 6e57ee4737 fix(core/config): allow overriding OpenAI wire API via env
Fixes #234
2025-09-25 15:28:39 +10:00
James Peter ff1e82b476 fix(tui/slash): restrict /pro to dev and pref builds 2025-09-25 11:52:42 +10:00
James Peter 0de6fe1800 feat(tui/slash): add /demo history generator 2025-09-25 09:31:21 +10:00
James Peter a5638672a0 merge code-branch-20250924-064406 via /merge 2025-09-25 07:46:02 +10:00
James Peter 13e55be8fc Merge upstream-merge: bring pro observer and readiness updates 2025-09-24 09:47:07 +10:00
James Peter 10aded5cb9 feat(tui/undo): add snapshot picker for slash undo 2025-09-24 08:11:36 +10:00
James Peter ed1b792fe4 merge local main into code-branch-20250923-121118 before merge 2025-09-24 06:03:53 +10:00
James Peter 22401f9c8e feat(tui/git-tooling): add workspace snapshot undo flow 2025-09-24 06:01:51 +10:00
James Peter 4ec497e492 feat(review): add scoped picker and metadata flow 2025-09-24 05:31:41 +10:00
James Peter ebe43c593c merge local main into code-branch-20250922-233455 before merge 2025-09-23 14:32:12 +10:00
James Peter 281ce5b301 feat(login): support multi-account auth without resets 2025-09-23 14:32:01 +10:00
James Peter 1fb539be98 merge code-branch-20250922-231915 via /merge 2025-09-23 14:15:35 +10:00
James Peter ff782c166e feat(validation): expand functional checks 2025-09-23 14:06:03 +10:00
James Peter d2731b8b66 Merge origin/upstream-merge: adopt upstream dependency updates 2025-09-23 14:00:06 +10:00
just-every-code 83d48aa8a4 merge(upstream): by-bucket merge upstream/main into upstream-merge\n\n- Keep ours for TUI fixtures; purge binary-size-log.jsonl\n- Adopt upstream MCP typed config tests (GetUserSavedConfigResponse)\n- Sync defaults to gpt-5-codex where applicable\n\nverify.sh: PASS; build-fast.sh: PASS 2025-09-23 03:40:47 +00:00