Skip to content
Open
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
2 changes: 1 addition & 1 deletion 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 @@ -304,7 +304,7 @@ version-compare = "0.1"
vte = { git = "https://github.com/warpdotdev/vte.git", rev = "4b399c87b63ba88f45709edaa6383fc519f6c900", default-features = false }
walkdir = "2"
warp-workflows = { git = "https://github.com/warpdotdev/workflows", rev = "793a98ddda6ef19682aed66364faebd2829f0e01" }
warp_multi_agent_api = { git = "https://github.com/warpdotdev/warp-proto-apis.git", rev = "78a78f21a75432bf0141e396fb318bf1694e47f0" }
warp_multi_agent_api = { git = "https://github.com/warpdotdev/warp-proto-apis.git", rev = "aa2f9cde164a5b48ac01087d417d1188771f9b6d" }
wasm-bindgen = "0.2.89"
wasm-bindgen-futures = "0.4.42"
web-sys = { version = "0.3.69", features = [
Expand Down
1 change: 1 addition & 0 deletions app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ hoa_remote_control = []
codex_notifications = []
cloud_mode_setup_v2 = ["cloud_mode"]
cloud_mode_input_v2 = ["cloud_mode"]
configurable_context_window = []

[package.metadata.bundle.bin.warp-oss]
category = "public.app-category.developer-tools"
Expand Down
8 changes: 8 additions & 0 deletions app/src/ai/agent/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::{

use super::{AIAgentInput, MCPContext, MCPServer, RequestMetadata, Suggestions};
use crate::ai::blocklist::{BlocklistAIPermissions, RequestInput};
use crate::ai::execution_profiles::profiles::AIExecutionProfilesModel;
use crate::ai::mcp::templatable_manager::TemplatableMCPServerInfo;
use crate::ai::mcp::TemplatableMCPServerManager;
use crate::settings::AISettings;
Expand Down Expand Up @@ -109,6 +110,7 @@ pub struct RequestParams {
pub computer_use_model: LLMId,
pub is_memory_enabled: bool,
pub warp_drive_context_enabled: bool,
pub context_window_limit: Option<u32>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u32 makes sense. this is coming from the server so we need it to explicitly be 32-bit rather than machine-dependent (usize).

pub mcp_context: Option<MCPContext>,
pub planning_enabled: bool,
should_redact_secrets: bool,
Expand Down Expand Up @@ -279,13 +281,19 @@ impl RequestParams {
.as_ref()
.is_none_or(|t| matches!(t, crate::terminal::model::session::SessionType::Local));

let context_window_limit = AIExecutionProfilesModel::as_ref(app)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] This pulls the persisted limit directly into RequestParams without validating it against the active base model's advertised range/configurability. A stale or corrupted cloud profile can still send an out-of-range limit even though the UI clamps user input; derive this through the context-window helper and clamp or clear before sending.

.active_profile(terminal_view_id, app)
.data()
.context_window_limit;
Comment thread
coolcom200 marked this conversation as resolved.

Self {
input: request_input.all_inputs().cloned().collect(),
conversation_token: conversation.server_conversation_token,
forked_from_conversation_token: conversation.forked_from_conversation_token,
ambient_agent_task_id: conversation.ambient_agent_task_id,
tasks: conversation.tasks,
existing_suggestions: conversation.existing_suggestions,
context_window_limit,
metadata,
session_context,
model: request_input.model_id.clone(),
Expand Down
7 changes: 7 additions & 0 deletions app/src/ai/agent/api/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ pub async fn generate_multi_agent_output(
base: params.model.into(),
cli_agent: params.cli_agent_model.into(),
computer_use_agent: params.computer_use_model.into(),
base_model_context_window_limit: if FeatureFlag::ConfigurableContextWindow
.is_enabled()
{
params.context_window_limit.unwrap_or(0)
} else {
0
},
..Default::default()
}),
rules_enabled: params.is_memory_enabled,
Expand Down
1 change: 1 addition & 0 deletions app/src/ai/agent/api/impl_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fn request_params_with_ask_user_question_enabled(ask_user_question_enabled: bool
computer_use_model: model,
is_memory_enabled: false,
warp_drive_context_enabled: false,
context_window_limit: None,
mcp_context: None,
planning_enabled: true,
should_redact_secrets: false,
Expand Down
1 change: 1 addition & 0 deletions app/src/ai/blocklist/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ impl BlocklistAIPermissions {
coding_model: profile_data.coding_model.clone(),
cli_agent_model: profile_data.cli_agent_model.clone(),
computer_use_model: profile_data.computer_use_model.clone(),
context_window_limit: profile_data.context_window_limit,
autosync_plans_to_warp_drive: profile_data.autosync_plans_to_warp_drive,
web_search_enabled: profile_data.web_search_enabled,
}
Expand Down
Loading
Loading