Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ passing on its own is enough: a cherry-pick does not move the base.
| — | `wire_api = "chat"`: Chat Completions client restored for providers whose Responses path drops tool calls (grok via theclawbay/LiteLLM, WI-1139). New files only, plus one dispatch arm: `core/src/chat_request.rs` (request conversion; namespaced tools flattened to `ns__name`, freeform tools such as apply_patch exposed as a function taking one `input` string, calls restored by `ChatToolMap`), `codex-api/src/{endpoint,sse}/chat.rs` (client and SSE parser, fixture tests in `sse/chat_tests.rs`). Reasoning, web search and tool search are not sent over chat. Branch `fork/wi-1286-chat-wire`. | fork-only; upstream removed the chat client |
| — | Headless MCP startup (issue #26, WI-1514): `codex exec` defaults `mcp_optional_startup_grace_ms` to 0 unless set, so every enabled server's startup is awaited (each bounded by its `startup_timeout_sec`) before the first request; a failed or timed-out server is printed as a warning and the run continues. Tool dispatch resolves un-namespaced `mcp__<server>__<tool>` names and bare names unique across MCP servers, and answers a call to a server still handshaking with "MCP server `x` is still starting" instead of "unsupported call". `exec/src/lib.rs`, `core/src/tools/registry.rs`, `codex-mcp` `pending_startup_servers`. Branch `fix/issue-26-mcp-startup`. | fork-only |
| — | Auto-compaction loop guard (WI-2832): after a context-limit compaction (pre-turn or mid-turn), if the first request's prompt alone is still at or over `model_auto_compact_token_limit` (body after prefix for that scope) or the usable window, the turn ends with a warning and a `ContextWindowExceeded` error instead of compacting again. Before this, a fixed prefix (tool specs) over the limit looped compaction -> one tool call -> compaction (235 compactions in one turn). `core/src/session/turn.rs`; tests `turn_tests.rs` `prompt_over_limit_*`, `suite::compact::auto_compact_stops_when_compaction_cannot_get_below_limit`. Branch `wi-2832-compaction-thrash-guard`. | fork-only; upstream has the same loop |
| — | Auto-review audit trail (issue #34, WI-4410): `codex-rollout` `policy.rs` now persists terminal `GuardianAssessment` events (approved, denied, timed out, aborted) in the rollout; the in-progress marker stays transient. Before, no verdict was recorded in the parent rollout. Pinned by `policy_tests.rs::guardian_assessment_verdicts_are_persisted_but_in_progress_is_not`. Findings: the reviewer runs on the parent's own model provider (`guardian_session_inherits_parent_http_fallback` has a custom-provider case; not exercised against a live LiteLLM here). Under `approvals_reviewer=auto_review` an action is decided by the reviewer, not escalated as a user prompt: a denial reaches the model as a rejection and the client as a `GuardianAssessment` (Denied) event, and only `approvals_reviewer=user` raises `ExecApprovalRequest`. Pinned end to end by `core/tests/suite/auto_review.rs` `auto_review_denial_surfaces_as_guardian_assessment_and_is_persisted`: the client sees `GuardianAssessment` `InProgress` then `Denied` with no `ExecApprovalRequest`, and the `Denied` verdict is in the rollout. Vogt's detector must watch `GuardianAssessment` `Denied` (Vogt-side follow-up; not a fork change). Branch `fix/issue-34-auto-review`. | fork-only |
| — | Per-session provider (issue #39, WI-4409): no code change. `-c model_provider=<id> -c model_context_window=<n> -c model_auto_compact_token_limit=<n>` already override the global `config.toml` for one session; pinned by `cli_overrides_select_session_provider_and_context_limits` in `core/src/config/config_loader_tests.rs`. Branch `fix/issue-39-session-provider`. | fork-only (test + note) |
| — | TUI mouse (issues #43, #44, WI-4408): wheel events scroll the transcript wherever the pointer is on screen (`tui/src/transcript_view/input.rs`; selection still respects the rect), and `tui.mouse_capture = false` (or `-c tui.mouse_capture=false`, or env `CODEX_TUI_MOUSE_CAPTURE=0`; env wins) stops the TUI requesting mouse reporting in the alternate screen so browser/mobile/multi-viewer front ends keep text selection while the fullscreen transcript stays. For append-only output use `tui.alternate_screen = "never"` / `--no-alt-screen`. `config/src/types.rs`, `tui/src/tui.rs` `MouseCapture::captures_mouse`. Branch `fix/wi-tui-43-44`. | fork-only |

## External adapters

Expand Down
5 changes: 5 additions & 0 deletions codex-rs/config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,11 @@ pub struct Tui {
#[schemars(schema_with = "crate::tui_mouse_scroll::schema")]
pub mouse_scroll_speed: Option<f64>,

/// Let the TUI capture mouse events in the alternate screen. Defaults to `true`.
/// Set `false` for browser, mobile or multi-viewer terminals whose front end owns text
/// selection. Overridden by the `CODEX_TUI_MOUSE_CAPTURE` environment variable.
pub mouse_capture: Option<bool>,

/// Copy selected transcript, footer, or composer text when the mouse button is released.
/// Defaults to `auto`: enabled except in direct terminals known to forward their native
/// copy shortcut (Ghostty 1.2+, Kitty on macOS, Windows Terminal, and VS Code on Windows).
Expand Down
4 changes: 4 additions & 0 deletions codex-rs/core/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5537,6 +5537,10 @@
"default": {},
"description": "Startup tooltip availability NUX state persisted by the TUI."
},
"mouse_capture": {
"description": "Let the TUI capture mouse events in the alternate screen. Defaults to `true`. Set `false` for browser, mobile or multi-viewer terminals whose front end owns text selection. Overridden by the `CODEX_TUI_MOUSE_CAPTURE` environment variable.",
"type": "boolean"
},
"mouse_scroll_speed": {
"default": null,
"description": "Mouse wheel speed multiplier for transcript scrolling, based on one row per event. Defaults to `1.0`. Positive fractional values slow scrolling; values above `1.0` speed it up.",
Expand Down
51 changes: 51 additions & 0 deletions codex-rs/core/src/config/config_loader_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4940,3 +4940,54 @@ async fn async_compaction_config() {
assert_eq!(actual, expected, "{settings}");
}
}

/// Fork issue #39: a session picks its provider and context limits with `-c`
/// overrides, without touching the global default in config.toml.
#[tokio::test]
async fn cli_overrides_select_session_provider_and_context_limits() {
let tmp = tempdir().expect("tempdir");
std::fs::write(
tmp.path().join(CONFIG_TOML_FILE),
r#"
model_provider = "global"
model_context_window = 850000
model_auto_compact_token_limit = 800000

[model_providers.global]
name = "global"
base_url = "http://localhost:1/v1"

[model_providers.session]
name = "session"
base_url = "http://localhost:2/v1"
"#,
)
.expect("write config");

let config = ConfigBuilder::default()
.codex_home(tmp.path().to_path_buf())
.fallback_cwd(Some(tmp.path().to_path_buf()))
.loader_overrides(LoaderOverrides::without_managed_config_for_tests())
.cli_overrides(vec![
(
"model_provider".to_string(),
TomlValue::String("session".to_string()),
),
(
"model_context_window".to_string(),
TomlValue::Integer(128000),
),
(
"model_auto_compact_token_limit".to_string(),
TomlValue::Integer(100000),
),
])
.build()
.await
.expect("config with provider override");

assert_eq!(config.model_provider_id, "session");
assert_eq!(config.model_provider.name, "session");
assert_eq!(config.model_context_window, Some(128000));
assert_eq!(config.model_auto_compact_token_limit, Some(100000));
}
2 changes: 2 additions & 0 deletions codex-rs/core/src/config/config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ fn config_toml_deserializes_model_availability_nux() {
collapse_turn_details: false,
sidebar_width_percent: None,
mouse_scroll_speed: None,
mouse_capture: None,
copy_on_select: Default::default(),
copy_on_select_clear_selection: false,
right_click_paste: Default::default(),
Expand Down Expand Up @@ -4778,6 +4779,7 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() {
collapse_turn_details: false,
sidebar_width_percent: None,
mouse_scroll_speed: None,
mouse_capture: None,
copy_on_select: Default::default(),
copy_on_select_clear_selection: false,
right_click_paste: Default::default(),
Expand Down
4 changes: 4 additions & 0 deletions codex-rs/core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,9 @@ pub struct Config {
/// Mouse wheel speed multiplier for transcript scrolling; defaults to one row per event.
pub tui_mouse_scroll_speed: Option<f64>,

/// Whether the TUI may capture the mouse in the alternate screen (`tui.mouse_capture`).
pub tui_mouse_capture: Option<bool>,

/// Override the terminal default for copying transcript, footer, and composer selections.
pub tui_copy_on_select: codex_config::types::CopyOnSelect,

Expand Down Expand Up @@ -4896,6 +4899,7 @@ impl Config {
.is_none_or(|tui| tui.fullscreen_transcript),
tui_sidebar_width_percent: cfg.tui.as_ref().and_then(|tui| tui.sidebar_width_percent),
tui_mouse_scroll_speed: cfg.tui.as_ref().and_then(|tui| tui.mouse_scroll_speed),
tui_mouse_capture: cfg.tui.as_ref().and_then(|tui| tui.mouse_capture),
tui_copy_on_select: cfg
.tui
.as_ref()
Expand Down
Loading
Loading