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
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ are chosen per session in a box in the right-hand panel's footer, reachable
from the collapsed rail; a provider change needs the native confirmation, and
each turn re-checks the session's recorded endpoint (ADR-0071,
[ADR-0089](docs/adr/0089-choose-the-provider-and-model-in-the-side-panel-footer.md)).
An **Effort** dropdown in the same box records a per-session reasoning effort,
which the CLI sets with `chat --reasoning-effort`; it is sent only to endpoints
whose provider documents the field, nothing is sent by default, and no
request with an effort was made to a real provider
([ADR-0102](docs/adr/0102-choose-a-reasoning-effort-per-session.md)).
A status bar at the bottom of the `main`
window shows the open session's workspace and Git branch, read from `HEAD`
without a Git process, and the approvals count; it offers no connection choice
Expand Down
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,35 @@ Changes are recorded here before a release version is assigned.

### Added

- Version 0.67.0 adds a per-session reasoning effort (ADR-0102). The desktop
model box has an **Effort** dropdown under **Model** with "Default", which
sends nothing, and None, Minimal, Low, Medium, High, Extra high, and Max. It
is recorded per session by the new `main` command `session_effort_select`,
without a dialog but as one settings change (`settings_change_running`
while another runs), as an optional `reasoning_effort` in
`session-connections.json` (still version 1); a provider choice clears it
and a model choice keeps it. The desktop shell has 63 commands: 31 in
`main`, 3 in `approvals`, and 29 in `settings`. `connection_status`
reports the session's effort and `reasoning_efforts`, the values its
connection takes, and
`chat_send` takes `reasoning_effort` in its settings. The CLI adds
`chat --reasoning-effort`. Chat Completions requests carry it as
`reasoning_effort`, and the ChatGPT plan route as
`"reasoning": {"effort": ...}`; the field's bytes count in the client's
checks, the pre-turn compaction trigger, and the **Context** tab's framing
part, and compaction summary requests send none. Core allows it only for
loopback endpoints, a typed `openai_compatible` address, and the fixed
Ollama Cloud, OpenAI, Google, Moonshot, MiniMax, OpenRouter, Z.ai, and xAI
endpoints; Anthropic, DeepSeek, Tencent, Meta, and Thinking Machines Lab
refuse it before any request, and the dropdown is disabled there with a
note. The endpoint decides, not the profile kind, so a typed address that
is exactly one of those refusing endpoints refuses it too. A version-3
`request.manifest` records the effort that was sent as an optional
`reasoning_effort`; 0.66.0 and earlier refuse a journal that has
it, and a version 1 or 2 session refuses an effort before anything is
recorded. Values are not adjusted per model, so a model that refuses one
answers with its provider's HTTP error. No request with an effort was made
to a real provider.
- Version 0.66.0 makes every section divider in the desktop windows movable
(ADR-0101). The `approvals` queue, 300 pixels wide, now widens or narrows
from 200 to 640 beside the review pane, and below 720 pixels wide, where
Expand Down Expand Up @@ -285,6 +314,12 @@ Changes are recorded here before a release version is assigned.

### Fixed

- The CLI test `a_filtered_listing_is_truncated_when_newer_calls_fill_the_search_window`
no longer fails now and then on Linux with `action journal: Busy`. It
dropped the seeded action journal's writer and opened it again, and a
sibling test's CLI child, between fork and exec, could still share the
descriptor and its `flock`. The test now appends with the seeding writer.
Tests only; no application code changed.
- Version 0.61.0 opens the ChatGPT sign-in page in the default browser on
Windows (ADR-0094). Sign-in ran `explorer.exe` with the authorization
address, which opened a File Explorer window instead of a browser. A new
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "3"
members = ["crates/omgcode-core", "crates/omgcode-cli", "crates/omgcode-platform", "crates/omgcode-app", "crates/omgcode-desktop"]

[workspace.package]
version = "0.66.0"
version = "0.67.0"
edition = "2024"
rust-version = "1.99.1"
license = "Apache-2.0"
Expand Down
46 changes: 36 additions & 10 deletions crates/omgcode-app/src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::path::Path;

use omgcode_core::context::DEFAULT_COMPACT_THRESHOLD;
use omgcode_core::prompt::{self, BASE_PROMPT, BASE_PROMPT_VERSION, SkillPrompt};
use omgcode_core::provider::{LocalModelClient, LocalModelConfig};
use omgcode_core::provider::{LocalModelClient, LocalModelConfig, ReasoningEffort};
use omgcode_core::session::{ManifestSkill, RequestManifest, SessionJournal};
use omgcode_core::skills::SkillName;
use omgcode_core::turn::{
Expand Down Expand Up @@ -67,6 +67,10 @@ pub struct ChatSettings {
pub compact_threshold: u64,
/// Whether to compact at the effective trigger before a turn.
pub auto_compact: bool,
/// The reasoning effort every chat request of the turn sends, or `None`
/// for none (ADR-0102). Compaction requests never send one. A connection
/// that takes no effort refuses a turn that names one before any request.
pub reasoning_effort: Option<ReasoningEffort>,
}

impl ChatSettings {
Expand All @@ -82,6 +86,7 @@ impl ChatSettings {
instructions: String::new(),
compact_threshold: DEFAULT_COMPACT_THRESHOLD,
auto_compact: false,
reasoning_effort: None,
}
}
}
Expand Down Expand Up @@ -193,9 +198,12 @@ pub struct ChatClients {
impl ChatClients {
/// Validate `settings` and build the chat client and the summary client.
///
/// Only the chat client sends the settings' reasoning effort; the summary
/// client sends none (ADR-0102).
///
/// Returns `configuration` for an out-of-range turn budget and
/// `provider` for an unusable endpoint, model budget, or token. No network
/// request is made.
/// `provider` for an unusable endpoint, model budget, or token, or for an
/// effort the endpoint does not take. No network request is made.
pub fn new(settings: &ChatSettings, token: Option<&str>) -> Result<Self, AppError> {
validate_turn_budgets(settings.max_tool_calls, settings.turn_timeout_seconds)
.map_err(|message| AppError::new(ErrorKind::Configuration, message))?;
Expand All @@ -209,6 +217,7 @@ impl ChatClients {
// The client owns its header; the caller keeps one copy for redaction.
token.map(str::to_owned),
)
.and_then(|client| client.with_reasoning_effort(settings.reasoning_effort))
.map_err(AppError::provider)?;
let summary = LocalModelClient::new(
LocalModelConfig {
Expand Down Expand Up @@ -240,7 +249,7 @@ impl ChatClients {
};
validate_turn_budgets(settings.max_tool_calls, settings.turn_timeout_seconds)
.map_err(|message| AppError::new(ErrorKind::Configuration, message))?;
let build = |max_output_tokens| {
let build = |max_output_tokens, reasoning_effort| {
LocalModelClient::chatgpt(
LocalModelConfig {
base_url: settings.endpoint.clone(),
Expand All @@ -250,11 +259,13 @@ impl ChatClients {
},
plan.tokens(),
)
.and_then(|client| client.with_reasoning_effort(reasoning_effort))
.map_err(AppError::provider)
};
Ok(Self {
chat: build(settings.max_output_tokens)?,
summary: build(summary_output_tokens(settings.context_tokens))?,
chat: build(settings.max_output_tokens, settings.reasoning_effort)?,
// Compaction sends no effort (ADR-0102 decision 6).
summary: build(summary_output_tokens(settings.context_tokens), None)?,
})
}
}
Expand Down Expand Up @@ -340,6 +351,14 @@ pub fn run_chat_turn_with_clients(
tools::ACTIVE_TURN_MESSAGE,
));
}
// An older journal cannot record an effort in its manifest (ADR-0102), so
// a turn that would send one is refused before anything is recorded.
if clients.chat.reasoning_effort().is_some() && !journal.supports_reasoning_effort() {
return Err(AppError::new(
ErrorKind::Session,
"A reasoning effort can be chosen only in a version 3 session",
));
}
// The front end can cancel from here on, which covers the compaction
// requests below as well as the turn's own requests.
if let Some(hook) = hooks.on_cancel_token.as_deref_mut() {
Expand All @@ -352,14 +371,19 @@ pub fn run_chat_turn_with_clients(
turn.skills = &loaded_skills;
let tools_enabled = matches!(mode, ToolMode::Enabled { .. });
let skill_extra = skills::context_bytes(&loaded_skills);
let tool_extra = skill_extra
+ if tools_enabled {
// The effort field is sent with every request of the turn, so the trigger
// counts it as the client's own checks do (ADR-0102).
let fixed_extra = skill_extra
.saturating_add(if tools_enabled {
TOOL_SCHEMA_ESTIMATE_BYTES
} else {
0
};
})
.saturating_add(preflight::effort_extra_bytes(
clients.chat.reasoning_effort(),
));
let meter =
preflight::preflight_context(journal, &turn, &clients.summary, tool_extra, tools_enabled)?;
preflight::preflight_context(journal, &turn, &clients.summary, fixed_extra, tools_enabled)?;
// Compaction requests can take long; a selection withdrawn meanwhile
// stops the turn before its first request.
skills::recheck(data_root, journal, &loaded_skills)?;
Expand All @@ -382,6 +406,8 @@ pub fn run_chat_turn_with_clients(
skill_md_sha256: skill.skill_md_sha256.clone(),
})
.collect(),
// What the chat client sends, not what was asked for.
reasoning_effort: clients.chat.reasoning_effort(),
Comment thread
James-Chapman marked this conversation as resolved.
Resolved
};
// Live settings decide whether this turn offers the workspace tools.
match mode {
Expand Down
Loading