chore: pin Rust version to 1.86 and use io::Error::other to prepare for 1.87 (#947)

Previously, our GitHub actions specified the Rust toolchain as
`dtolnay/rust-toolchain@stable`, which meant the version could change
out from under us. In this case, the move from 1.86 to 1.87 introduced
new clippy warnings, causing build failures.

Because it will take a little time to fix all the new clippy warnings,
this PR pins things to 1.86 for now to unbreak the build.

It also replaces `io::Error::new(io::ErrorKind::Other)` with
`io::Error::other()` in preparation for 1.87.
This commit is contained in:
Michael Bolin
2025-05-15 14:07:16 -07:00
committed by GitHub
parent 5fc9fc3e3e
commit ec5e82b77c
6 changed files with 30 additions and 35 deletions

View File

@@ -26,7 +26,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@1.86
with:
components: rustfmt
- name: cargo fmt - name: cargo fmt
run: cargo fmt -- --config imports_granularity=Item --check run: cargo fmt -- --config imports_granularity=Item --check
@@ -58,9 +60,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@1.86
with: with:
targets: ${{ matrix.target }} targets: ${{ matrix.target }}
components: clippy
- uses: actions/cache@v4 - uses: actions/cache@v4
with: with:

View File

@@ -74,7 +74,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@1.86
with: with:
targets: ${{ matrix.target }} targets: ${{ matrix.target }}

View File

@@ -349,14 +349,12 @@ pub(crate) async fn consume_truncated_output(
// we treat it as an exceptional I/O error // we treat it as an exceptional I/O error
let stdout_reader = child.stdout.take().ok_or_else(|| { let stdout_reader = child.stdout.take().ok_or_else(|| {
CodexErr::Io(io::Error::new( CodexErr::Io(io::Error::other(
io::ErrorKind::Other,
"stdout pipe was unexpectedly not available", "stdout pipe was unexpectedly not available",
)) ))
})?; })?;
let stderr_reader = child.stderr.take().ok_or_else(|| { let stderr_reader = child.stderr.take().ok_or_else(|| {
CodexErr::Io(io::Error::new( CodexErr::Io(io::Error::other(
io::ErrorKind::Other,
"stderr pipe was unexpectedly not available", "stderr pipe was unexpectedly not available",
)) ))
})?; })?;

View File

@@ -51,10 +51,9 @@ pub fn exec_linux(
match tool_call_output { match tool_call_output {
Ok(Ok(output)) => Ok(output), Ok(Ok(output)) => Ok(output),
Ok(Err(e)) => Err(e), Ok(Err(e)) => Err(e),
Err(e) => Err(CodexErr::Io(io::Error::new( Err(e) => Err(CodexErr::Io(io::Error::other(format!(
io::ErrorKind::Other, "thread join failed: {e:?}"
format!("thread join failed: {e:?}"), )))),
))),
} }
} }

View File

@@ -6,7 +6,6 @@
use std::fs::File; use std::fs::File;
use std::fs::{self}; use std::fs::{self};
use std::io::Error as IoError; use std::io::Error as IoError;
use std::io::ErrorKind;
use serde::Serialize; use serde::Serialize;
use time::OffsetDateTime; use time::OffsetDateTime;
@@ -64,9 +63,9 @@ impl RolloutRecorder {
let timestamp_format: &[FormatItem] = format_description!( let timestamp_format: &[FormatItem] = format_description!(
"[year]-[month]-[day]T[hour]:[minute]:[second].[subsecond digits:3]Z" "[year]-[month]-[day]T[hour]:[minute]:[second].[subsecond digits:3]Z"
); );
let timestamp = timestamp.format(timestamp_format).map_err(|e| { let timestamp = timestamp
IoError::new(ErrorKind::Other, format!("failed to format timestamp: {e}")) .format(timestamp_format)
})?; .map_err(|e| IoError::other(format!("failed to format timestamp: {e}")))?;
let meta = SessionMeta { let meta = SessionMeta {
timestamp, timestamp,
@@ -131,19 +130,13 @@ impl RolloutRecorder {
async fn record_item(&self, item: &impl Serialize) -> std::io::Result<()> { async fn record_item(&self, item: &impl Serialize) -> std::io::Result<()> {
// Serialize the item to JSON first so that the writer thread only has // Serialize the item to JSON first so that the writer thread only has
// to perform the actual write. // to perform the actual write.
let json = serde_json::to_string(item).map_err(|e| { let json = serde_json::to_string(item)
IoError::new( .map_err(|e| IoError::other(format!("failed to serialize response items: {e}")))?;
ErrorKind::Other,
format!("failed to serialize response items: {e}"),
)
})?;
self.tx.send(json).await.map_err(|e| { self.tx
IoError::new( .send(json)
ErrorKind::Other, .await
format!("failed to queue rollout item: {e}"), .map_err(|e| IoError::other(format!("failed to queue rollout item: {e}")))
)
})
} }
} }
@@ -165,7 +158,7 @@ fn create_log_file(config: &Config, session_id: Uuid) -> std::io::Result<LogFile
fs::create_dir_all(&dir)?; fs::create_dir_all(&dir)?;
let timestamp = OffsetDateTime::now_local() let timestamp = OffsetDateTime::now_local()
.map_err(|e| IoError::new(ErrorKind::Other, format!("failed to get local time: {e}")))?; .map_err(|e| IoError::other(format!("failed to get local time: {e}")))?;
// Custom format for YYYY-MM-DDThh-mm-ss. Use `-` instead of `:` for // Custom format for YYYY-MM-DDThh-mm-ss. Use `-` instead of `:` for
// compatibility with filesystems that do not allow colons in filenames. // compatibility with filesystems that do not allow colons in filenames.
@@ -173,7 +166,7 @@ fn create_log_file(config: &Config, session_id: Uuid) -> std::io::Result<LogFile
format_description!("[year]-[month]-[day]T[hour]-[minute]-[second]"); format_description!("[year]-[month]-[day]T[hour]-[minute]-[second]");
let date_str = timestamp let date_str = timestamp
.format(format) .format(format)
.map_err(|e| IoError::new(ErrorKind::Other, format!("failed to format timestamp: {e}")))?; .map_err(|e| IoError::other(format!("failed to format timestamp: {e}")))?;
let filename = format!("rollout-{date_str}-{session_id}.jsonl"); let filename = format!("rollout-{date_str}-{session_id}.jsonl");

View File

@@ -99,12 +99,14 @@ impl McpClient {
.kill_on_drop(true) .kill_on_drop(true)
.spawn()?; .spawn()?;
let stdin = child.stdin.take().ok_or_else(|| { let stdin = child
std::io::Error::new(std::io::ErrorKind::Other, "failed to capture child stdin") .stdin
})?; .take()
let stdout = child.stdout.take().ok_or_else(|| { .ok_or_else(|| std::io::Error::other("failed to capture child stdin"))?;
std::io::Error::new(std::io::ErrorKind::Other, "failed to capture child stdout") let stdout = child
})?; .stdout
.take()
.ok_or_else(|| std::io::Error::other("failed to capture child stdout"))?;
let (outgoing_tx, mut outgoing_rx) = mpsc::channel::<JSONRPCMessage>(CHANNEL_CAPACITY); let (outgoing_tx, mut outgoing_rx) = mpsc::channel::<JSONRPCMessage>(CHANNEL_CAPACITY);
let pending: Arc<Mutex<HashMap<i64, PendingSender>>> = Arc::new(Mutex::new(HashMap::new())); let pending: Arc<Mutex<HashMap<i64, PendingSender>>> = Arc::new(Mutex::new(HashMap::new()));