Worked example
Raise a default timeout, 10 s → 30 s
A session with ByteCLI, written down in full. The task is deliberately dull: the shape of the answer is the thing being shown.
Worked example — illustrative
Illustrative sample. This build records no model call, so the patch and the test output are a worked example written by hand — the patch is applied for real when you press Apply, and the file it produces is shown below the diff.
1 · The request
The operator typed one sentence. It names the file, the old value and the new value. Nothing is guessed.
$ byten "Raise the default timeout from 10 seconds to 30 seconds in src/config.rs."
2 · What the model was told
You are ByteCLI, a coding agent in a terminal.
Task: Raise the default timeout from 10 seconds to 30 seconds in src/config.rs.
Rules:
- Change the constant, its doc comment and the test that names the behaviour.
- Do not touch anything else.
- Run the test that covers the constant and report the result.
Repository: byten (Rust 2021). File in context: src/config.rs (18 lines).3 · The patch
Two hunks: the constant and its comment, the test's name and its expectation. 3 steps · 1 file · 14 lines touched (+7 −7).
--- a/src/config.rs
+++ b/src/config.rs
@@ -3,8 +3,8 @@
-/// Default network timeout for outbound requests.
-pub const REQUEST_TIMEOUT_SECS: u64 = 10;
+/// Default network timeout for outbound requests: 30 s, enough for a cold compiler.
+pub const REQUEST_TIMEOUT_SECS: u64 = 30;
pub fn request_timeout() -> Duration {
Duration::from_secs(REQUEST_TIMEOUT_SECS)
@@ -14,8 +14,8 @@ mod tests {
use super::*;
#[test]
- fn timeout_is_ten_seconds() {
- assert_eq!(request_timeout(), Duration::from_secs(10));
+ fn timeout_is_thirty_seconds() {
+ assert_eq!(request_timeout(), Duration::from_secs(30));
}
}
4 · The file before and after
The workspace applies this exact patch to this exact text, so the pair below is not a mock-up of a change: it is the change.
// src/config.rs — excerpt
use std::time::Duration;
/// Default network timeout for outbound requests.
pub const REQUEST_TIMEOUT_SECS: u64 = 10;
pub fn request_timeout() -> Duration {
Duration::from_secs(REQUEST_TIMEOUT_SECS)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn timeout_is_ten_seconds() {
assert_eq!(request_timeout(), Duration::from_secs(10));
}
}// src/config.rs — excerpt
use std::time::Duration;
/// Default network timeout for outbound requests: 30 s, enough for a cold compiler.
pub const REQUEST_TIMEOUT_SECS: u64 = 30;
pub fn request_timeout() -> Duration {
Duration::from_secs(REQUEST_TIMEOUT_SECS)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn timeout_is_thirty_seconds() {
assert_eq!(request_timeout(), Duration::from_secs(30));
}
}5 · The proof
1 test passed · exit 0 · 4.21 s The test that names the behaviour passes after the change and fails before it: on the old file it asserts 30 while the constant says 10.
Compiling byten v0.1.0 (/work/byten)
Finished `test` profile [unoptimized] target(s) in 4.21s
Running unittests src/lib.rs (target/debug/deps/byten-2b1a7c9d)
running 1 test
test config::tests::timeout_is_thirty_seconds ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s6 · The record
One request, one file, 14 lines touched. Every session keeps the same shape: the request, the tokens, the cost and the latency.