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
14 changes: 5 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ jobs:
workspaces: "./src-tauri -> target"
shared-key: "ci-macos"

# Clippy runs the full compiler front-end, so it subsumes `cargo check` —
# a compile error fails this step regardless of the lint level.
#
# The current develop baseline has pre-existing Clippy warnings across
# multiple crates. Keep Clippy visible and compilation-blocking without
# letting toolchain lint drift block every feature PR; restore
# `-- -D warnings` after the baseline cleanup lands.
- name: cargo clippy (advisory warnings)
# Clippy runs the full compiler front-end, so it subsumes `cargo check`.
# Check every target and reject new warnings now that the workspace
# baseline is clean.
- name: cargo clippy (all targets, warnings denied)
working-directory: src-tauri
run: cargo clippy --workspace
run: cargo clippy --workspace --all-targets -- -D warnings
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
//! #[cfg(test)] #[path = "tests_extended.rs"] mod tests_extended;
#[cfg(test)]
#[allow(clippy::module_inception)]
// This wrapper keeps the large extended suite isolated when included from resolved.rs.
mod tests_extended {
use crate::core::definitions::builtin::{
get_builtin_agent, get_builtin_agents, is_builtin_agent, ADE_MANAGER_ID,
Expand Down
12 changes: 6 additions & 6 deletions src-tauri/crates/agent-core/src/core/interaction/mode_switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ impl ModeSwitchManager {
}
}

impl Default for ModeSwitchManager {
fn default() -> Self {
Self::new()
}
}

#[cfg(test)]
mod tests {
use super::ModeSwitchManager;
Expand All @@ -283,9 +289,3 @@ mod tests {
assert!(receiver.await.is_err());
}
}

impl Default for ModeSwitchManager {
fn default() -> Self {
Self::new()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,7 @@ pub(super) fn apply_headers(
req
}
AnthropicAuthMode::AzureBearer => {
let mut req = req.header(
"Authorization",
format!("Bearer {}", &client.config.api_key),
);
let mut req = req.header("Authorization", format!("Bearer {}", client.config.api_key));
if !beta_overridden {
req = req.header(
"anthropic-beta",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ use crate::tools::names as tool_names;
///
/// Returns `Some(ToolCallRequest)` when the server has completed an MCP or
/// task tool call that ORGII should now execute.
#[allow(clippy::too_many_arguments)]
// Keep the stream reducer's mutable accumulators explicit; a relay context
// would obscure which fields this update is allowed to mutate.
pub(super) fn handle_interaction_update(
update: pb::InteractionUpdate,
content: &mut String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,9 @@ impl LLMProvider for CursorNativeProvider {
/// `tool_definitions` are the `McpToolDefinition` list we hand back when the
/// server asks via `ExecServerMessage::RequestContextArgs`. Empty when the
/// caller didn't pass tools.
#[allow(clippy::too_many_arguments)]
// A run combines owned stream state with borrowed execution callbacks. A
// one-use relay struct would add indirection without creating a reusable domain.
async fn drive_run(
mut stream: RunStream,
mut blobs: BlobStore,
Expand Down
17 changes: 8 additions & 9 deletions src-tauri/crates/agent-core/src/core/providers/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,18 +921,17 @@ fn find_api_key_for_provider(
)))
}

type AvailableModelCredential = (
&'static ProviderSpec,
String,
Option<String>,
ProviderProtocol,
);

fn find_credential_by_available_model(
model: &str,
creds: &[ModelKey],
) -> Result<
Option<(
&'static ProviderSpec,
String,
Option<String>,
ProviderProtocol,
)>,
ProviderError,
> {
) -> Result<Option<AvailableModelCredential>, ProviderError> {
let model_lower = model.to_lowercase();
for cred in creds {
if !cred.enabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ use crate::session::turn::streaming::{

use super::launch_workspace::release_work_item_execution_lock_if_present;

#[allow(clippy::too_many_arguments)]
// Failure handling deliberately receives each durable identifier and log
// message explicitly so cleanup cannot accidentally reuse stale launch state.
pub(super) async fn handle_background_launch_failure(
session_id: &str,
agent_org_run_id: Option<&str>,
Expand Down
64 changes: 32 additions & 32 deletions src-tauri/crates/agent-core/src/core/session/turn/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,38 +99,6 @@ fn expand_skill_slash_command(content: &str, workspace: Option<&std::path::Path>
}
}

#[cfg(test)]
mod tests {
use super::expand_skill_slash_command;

#[test]
fn skill_slash_command_accepts_newline_after_name() {
let workspace = tempfile::tempdir().expect("create temporary workspace");
let skill_dir = workspace.path().join(".orgii/skills/newline-skill");
std::fs::create_dir_all(&skill_dir).expect("create temporary skill directory");
std::fs::write(
skill_dir.join("SKILL.md"),
"# Newline Skill\n\nFollow the test instructions.",
)
.expect("write temporary skill");

let expanded = expand_skill_slash_command(
"/newline-skill\nrun the relevant frontend spec",
Some(workspace.path()),
);

assert!(
expanded.contains("# Newline Skill"),
"expected workspace skill content, got prefix: {:?}",
&expanded[..expanded.len().min(120)]
);
assert!(
expanded.contains("User task: run the relevant frontend spec"),
"expected newline tail to become the user task"
);
}
}

// ============================================
// Unified Process Function
// ============================================
Expand Down Expand Up @@ -246,3 +214,35 @@ pub async fn process_message(
.process(&session.id, &content, processing_context)
.await
}

#[cfg(test)]
mod tests {
use super::expand_skill_slash_command;

#[test]
fn skill_slash_command_accepts_newline_after_name() {
let workspace = tempfile::tempdir().expect("create temporary workspace");
let skill_dir = workspace.path().join(".orgii/skills/newline-skill");
std::fs::create_dir_all(&skill_dir).expect("create temporary skill directory");
std::fs::write(
skill_dir.join("SKILL.md"),
"# Newline Skill\n\nFollow the test instructions.",
)
.expect("write temporary skill");

let expanded = expand_skill_slash_command(
"/newline-skill\nrun the relevant frontend spec",
Some(workspace.path()),
);

assert!(
expanded.contains("# Newline Skill"),
"expected workspace skill content, got prefix: {:?}",
&expanded[..expanded.len().min(120)]
);
assert!(
expanded.contains("User task: run the relevant frontend spec"),
"expected newline tail to become the user task"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,8 @@ pub(super) fn with_full_result_pointer(session_id: &str, result: String) -> Stri
}

#[cfg(test)]
#[allow(clippy::field_reassign_with_default)]
// The fixture exposes each optional model field as a separate scenario input.
mod resolve_subagent_model_tests {
use super::*;
use crate::core::config::ReliabilityConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,6 @@ pub struct ModeSwitchToolContext {
pub current_mode: std::sync::Mutex<Option<String>>,
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn timeout_choice_defaults_to_skip() {
let choice = mode_switch_timeout_choice(PresencePolicy::default(), "plan");

assert!(matches!(choice, ModeSwitchChoice::Skip));
}

#[test]
fn timeout_choice_switches_to_plan_when_presence_allows_it() {
let choice = mode_switch_timeout_choice(
PresencePolicy {
mode_switch_auto_plan: true,
..PresencePolicy::default()
},
"plan",
);

match choice {
ModeSwitchChoice::Switch(mode) => assert_eq!(mode, "plan"),
ModeSwitchChoice::Skip => panic!("expected auto switch"),
}
}
}

impl ModeSwitchToolContext {
pub fn new(manager: Arc<ModeSwitchManager>) -> Self {
Self {
Expand Down Expand Up @@ -283,3 +255,31 @@ impl Tool for SuggestModeSwitchTool {
*self.context.session_id.lock().await = Some(session_key.to_string());
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn timeout_choice_defaults_to_skip() {
let choice = mode_switch_timeout_choice(PresencePolicy::default(), "plan");

assert!(matches!(choice, ModeSwitchChoice::Skip));
}

#[test]
fn timeout_choice_switches_to_plan_when_presence_allows_it() {
let choice = mode_switch_timeout_choice(
PresencePolicy {
mode_switch_auto_plan: true,
..PresencePolicy::default()
},
"plan",
);

match choice {
ModeSwitchChoice::Switch(mode) => assert_eq!(mode, "plan"),
ModeSwitchChoice::Skip => panic!("expected auto switch"),
}
}
}
4 changes: 2 additions & 2 deletions src-tauri/crates/agent-core/src/core/tools/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl ToolSchemaCacheScope {
}
}

pub fn from_str(value: &str) -> Option<Self> {
pub fn from_wire_value(value: &str) -> Option<Self> {
match value {
"stable_prefix" => Some(Self::StablePrefix),
"live_suffix" => Some(Self::LiveSuffix),
Expand All @@ -59,7 +59,7 @@ pub fn tool_schema_cache_scope(schema: &Value) -> ToolSchemaCacheScope {
schema
.get(ORGII_TOOL_SCHEMA_CACHE_SCOPE_KEY)
.and_then(Value::as_str)
.and_then(ToolSchemaCacheScope::from_str)
.and_then(ToolSchemaCacheScope::from_wire_value)
.unwrap_or(ToolSchemaCacheScope::StablePrefix)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ pub(crate) async fn execute_tool_calls(
}

#[cfg(test)]
#[allow(clippy::field_reassign_with_default)]
// Budget tests mutate the one field whose boundary behavior they exercise.
mod tests {
use super::*;
use crate::tools::traits::{Tool, ToolError};
Expand Down
4 changes: 3 additions & 1 deletion src-tauri/crates/agent-core/src/core/turn_executor/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ pub struct ToolHookIntervention {
/// Implementors handle streaming deltas, tool call/result events,
/// and persistence. Each agent type provides its own implementation.
#[async_trait]
#[allow(unused_variables)]
#[allow(unused_variables, clippy::too_many_arguments)]
// Event implementations share this callback contract across providers; keep
// its event fields explicit instead of introducing provider-specific wrappers.
pub trait TurnEventHandler: Send + Sync {
/// Called for each streaming text delta from the LLM.
fn on_message_delta(&self, session_id: &str, content: &str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ fn column_exists(conn: &Connection, table_name: &str, column_name: &str) -> Sqli
Ok(false)
}

#[allow(clippy::too_many_arguments)]
// The column identifiers describe one dynamic SQL projection and remain
// explicit so callers can audit every selected column at the call site.
fn query_session_file_tool_rows(
conn: &Connection,
table_name: &str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct ResolvedRef {
content: String,
}

type SkillLoader<'a> = dyn Fn(&str) -> Option<String> + 'a;

/// Expand pill references in a user message, returning the enriched message.
///
/// - `message`: the raw user message containing `[type:path]` references
Expand All @@ -42,7 +44,7 @@ pub fn expand_pill_references(
workspace: &Path,
ide_repo_path: Option<&str>,
workspace_folders: &[String],
skill_loader: Option<&dyn Fn(&str) -> Option<String>>,
skill_loader: Option<&SkillLoader<'_>>,
) -> String {
let mut resolved: Vec<ResolvedRef> = Vec::new();

Expand Down Expand Up @@ -201,10 +203,7 @@ fn resolve_project_ref(slug: &str) -> Option<String> {
/// The leading `/` is stripped to get the bare skill name. The actual loading
/// is delegated to `skill_loader` to avoid a downward dependency from the
/// foundation layer into the intelligence layer.
fn resolve_skill_ref(
path: &str,
skill_loader: Option<&dyn Fn(&str) -> Option<String>>,
) -> Option<String> {
fn resolve_skill_ref(path: &str, skill_loader: Option<&SkillLoader<'_>>) -> Option<String> {
let skill_name = path.trim_start_matches('/');
if skill_name.is_empty() {
return None;
Expand Down
Loading
Loading