Skip to content

Commit 07e0195

Browse files
committed
fix: format code and use self-hosted windows runner
- Run cargo fmt to fix formatting issues - Use windows-64-cli self-hosted runner for faster Windows builds
1 parent b1fe2f8 commit 07e0195

7 files changed

Lines changed: 46 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,46 @@ jobs:
3333
- run: cargo clippy --all-targets --all-features
3434

3535
test:
36-
name: Test (${{ matrix.os }})
37-
runs-on: ${{ matrix.os }}
36+
name: Test (${{ matrix.name }})
37+
runs-on: ${{ matrix.runner }}
3838
strategy:
3939
fail-fast: false
4040
matrix:
41-
os: [blacksmith-32vcpu-ubuntu-2404, blacksmith-32vcpu-windows-2025, macos-latest]
41+
include:
42+
- name: ubuntu
43+
runner: blacksmith-32vcpu-ubuntu-2404
44+
- name: macos
45+
runner: macos-latest
46+
- name: windows
47+
runner: [self-hosted, windows-64-cli]
4248
steps:
4349
- uses: actions/checkout@v4
4450
- uses: dtolnay/rust-toolchain@stable
4551
- uses: Swatinem/rust-cache@v2
4652
with:
47-
key: ${{ matrix.os }}
53+
key: ${{ matrix.name }}
4854
- name: Run tests
4955
run: cargo test --workspace --all-features
5056

5157
build-check:
52-
name: Build Check (${{ matrix.os }})
53-
runs-on: ${{ matrix.os }}
58+
name: Build Check (${{ matrix.name }})
59+
runs-on: ${{ matrix.runner }}
5460
strategy:
5561
fail-fast: false
5662
matrix:
57-
os: [blacksmith-32vcpu-ubuntu-2404, blacksmith-32vcpu-windows-2025, macos-latest]
63+
include:
64+
- name: ubuntu
65+
runner: blacksmith-32vcpu-ubuntu-2404
66+
- name: macos
67+
runner: macos-latest
68+
- name: windows
69+
runner: [self-hosted, windows-64-cli]
5870
steps:
5971
- uses: actions/checkout@v4
6072
- uses: dtolnay/rust-toolchain@stable
6173
- uses: Swatinem/rust-cache@v2
6274
with:
63-
key: ${{ matrix.os }}
75+
key: ${{ matrix.name }}
6476
- name: Check build
6577
run: cargo check --workspace --all-features
6678

cortex-common/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ pub use file_locking::{
2121
FileLockError, FileLockGuard, FileLockManager, FileLockResult, LockConfig, LockMode,
2222
acquire_lock, atomic_write, global_lock_manager, locked_read_modify_write, try_acquire_lock,
2323
};
24-
pub use model_presets::*;
2524
pub use http_client::create_default_client;
25+
pub use model_presets::*;
2626

2727
#[cfg(feature = "cli")]
2828
pub use config_override::{CliConfigOverrides, ConfigOverride};

cortex-engine/src/tools/handlers/fetch_url.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ impl FetchUrlHandler {
3535
/// Create a new FetchUrlHandler with default SSRF protection.
3636
pub fn new() -> Self {
3737
let ssrf_protection = SsrfProtection::new();
38-
let client = ssrf_protection
39-
.create_http_client()
40-
.expect("HTTP client");
38+
let client = ssrf_protection.create_http_client().expect("HTTP client");
4139

4240
Self {
4341
ssrf_protection,
@@ -49,9 +47,7 @@ impl FetchUrlHandler {
4947
pub fn with_allowed_domains(domains: impl IntoIterator<Item = impl Into<String>>) -> Self {
5048
let config = SsrfConfig::new().allow_domains(domains);
5149
let ssrf_protection = SsrfProtection::with_config(config);
52-
let client = ssrf_protection
53-
.create_http_client()
54-
.expect("HTTP client");
50+
let client = ssrf_protection.create_http_client().expect("HTTP client");
5551

5652
Self {
5753
ssrf_protection,
@@ -62,9 +58,7 @@ impl FetchUrlHandler {
6258
/// Create a new FetchUrlHandler with custom SSRF config.
6359
pub fn with_config(config: SsrfConfig) -> Self {
6460
let ssrf_protection = SsrfProtection::with_config(config);
65-
let client = ssrf_protection
66-
.create_http_client()
67-
.expect("HTTP client");
61+
let client = ssrf_protection.create_http_client().expect("HTTP client");
6862

6963
Self {
7064
ssrf_protection,

cortex-mcp-client/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use anyhow::Result;
2-
use cortex_mcp_types::{Tool, CallToolParams, CallToolResult, InitializeParams, Implementation};
31
use crate::transport::Transport;
2+
use anyhow::Result;
3+
use cortex_mcp_types::{CallToolParams, CallToolResult, Implementation, InitializeParams, Tool};
44

55
pub struct McpClient {
66
transport: Box<dyn Transport>,

cortex-mcp-client/src/discovery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use cortex_mcp_types::Tool;
2-
use serde_json::{json, Value};
2+
use serde_json::{Value, json};
33
use std::collections::HashMap;
44

55
pub struct ToolDiscovery {

cortex-mcp-client/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! MCP Client implementation for Cortex
22
33
pub mod client;
4-
pub mod transport;
54
pub mod discovery;
5+
pub mod transport;
66

77
pub use client::McpClient;
8-
pub use transport::Transport;
98
pub use discovery::ToolDiscovery;
9+
pub use transport::Transport;

cortex-mcp-client/src/transport.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use async_trait::async_trait;
1313
use cortex_common::create_default_client;
1414
use cortex_mcp_types::{
1515
CallToolParams, CallToolResult, GetPromptParams, GetPromptResult, InitializeParams,
16-
InitializeResult, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse,
17-
ListPromptsResult, ListResourcesResult, ListToolsResult, ReadResourceParams,
18-
ReadResourceResult, RequestId, methods,
16+
InitializeResult, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, ListPromptsResult,
17+
ListResourcesResult, ListToolsResult, ReadResourceParams, ReadResourceResult, RequestId,
18+
methods,
1919
};
2020
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
2121
use tokio::process::{Child, Command};
@@ -172,7 +172,8 @@ impl StdioTransport {
172172
}
173173
}
174174
// Try to parse as notification
175-
else if let Ok(notification) = serde_json::from_str::<JsonRpcNotification>(trimmed)
175+
else if let Ok(notification) =
176+
serde_json::from_str::<JsonRpcNotification>(trimmed)
176177
{
177178
debug!(method = %notification.method, "Received notification");
178179
}
@@ -209,7 +210,11 @@ impl StdioTransport {
209210

210211
while attempt < self.reconnect_config.max_attempts {
211212
attempt += 1;
212-
info!(attempt, max = self.reconnect_config.max_attempts, "Attempting reconnection");
213+
info!(
214+
attempt,
215+
max = self.reconnect_config.max_attempts,
216+
"Attempting reconnection"
217+
);
213218

214219
match self.connect().await {
215220
Ok(()) => {
@@ -473,7 +478,8 @@ impl HttpTransport {
473478
));
474479
}
475480

476-
let json_response: JsonRpcResponse = response.json().await.context("Failed to parse response")?;
481+
let json_response: JsonRpcResponse =
482+
response.json().await.context("Failed to parse response")?;
477483
Ok(json_response)
478484
}
479485

@@ -500,7 +506,11 @@ impl HttpTransport {
500506

501507
while attempt < self.reconnect_config.max_attempts {
502508
attempt += 1;
503-
info!(attempt, max = self.reconnect_config.max_attempts, "Attempting HTTP reconnection");
509+
info!(
510+
attempt,
511+
max = self.reconnect_config.max_attempts,
512+
"Attempting HTTP reconnection"
513+
);
504514

505515
match self.test_connection().await {
506516
Ok(()) => {

0 commit comments

Comments
 (0)