Files
LahfirandDwin Gharibi 099e84ea23 fix(flags): warn when output limits are invalid (#2258)
* fix(flags): warn when output limits are invalid

Co-Authored-By: Dwin Gharibi <20875684+dwin-gharibi@users.noreply.github.com>

* test(flags): check output-limit warnings through the CLI

* docs(flags): clarify that invalid limits preserve the current value

* docs: put the invalid output-limit note with the option it describes

Drop the core skill line: the warning reaches the agent at runtime, and the
skill body keeps workflow guidance while `references/` carries behavior
details. Move the reference note under the `read` entry that already names
`--max-output`, and fold the README note into the Output Length Limits bullet
instead of leaving it after the security environment table.

---------

Co-authored-by: Dwin Gharibi <20875684+dwin-gharibi@users.noreply.github.com>
2026-10-29 19:39:42 -07:00

44 lines
1.3 KiB
Rust

use std::process::Command;
use tempfile::TempDir;
const BIN: &str = env!("CARGO_BIN_EXE_agent-browser");
#[test]
fn invalid_max_output_warns_for_cli_and_environment() {
let cases = [
(
&["--max-output", "not-a-number", "--help"][..],
None,
"--max-output",
),
(
&["--help"][..],
Some("not-a-number"),
"AGENT_BROWSER_MAX_OUTPUT",
),
];
for (args, env_value, source) in cases {
let home = TempDir::new().unwrap();
let mut command = Command::new(BIN);
command
.args(args)
.current_dir(home.path())
.env("HOME", home.path())
.env("USERPROFILE", home.path())
.env("NO_COLOR", "1")
.env_remove("AGENT_BROWSER_CONFIG")
.env_remove("AGENT_BROWSER_MAX_OUTPUT");
if let Some(value) = env_value {
command.env("AGENT_BROWSER_MAX_OUTPUT", value);
}
let output = command.output().expect("failed to invoke agent-browser");
assert!(output.status.success(), "{source}: {:?}", output.status);
assert!(
String::from_utf8_lossy(&output.stderr).contains(source),
"{source} warning missing from stderr: {}",
String::from_utf8_lossy(&output.stderr)
);
}
}