This commit is contained in:
jif-oai
2025-12-08 17:06:17 +00:00
parent 18909f0aef
commit a81d0da79c
2 changed files with 18 additions and 20 deletions

View File

@@ -90,10 +90,11 @@ fn strip_ansi_escape_sequences(input: &str) -> String {
break;
}
if c == '\u{1b}'
&& let Some('\\') = iter.peek().copied() {
let _ = iter.next();
break;
}
&& let Some('\\') = iter.peek().copied()
{
let _ = iter.next();
break;
}
}
}
Some(_) => {
@@ -211,7 +212,10 @@ impl UnifiedExecSessionManager {
let wall_time = Instant::now().saturating_duration_since(start);
let raw_text = String::from_utf8_lossy(&collected).to_string();
#[cfg(target_os = "windows")]
let text = normalize_unified_exec_text(&raw_text);
#[cfg(not(target_os = "windows"))]
let text = raw_text;
let output = formatted_truncate_text(&text, TruncationPolicy::Tokens(max_tokens));
let has_exited = session.has_exited();
let exit_code = session.exit_code();
@@ -334,7 +338,10 @@ impl UnifiedExecSessionManager {
let wall_time = Instant::now().saturating_duration_since(start);
let raw_text = String::from_utf8_lossy(&collected).to_string();
#[cfg(target_os = "windows")]
let text = normalize_unified_exec_text(&raw_text);
#[cfg(not(target_os = "windows"))]
let text = raw_text;
let output = formatted_truncate_text(&text, TruncationPolicy::Tokens(max_tokens));
let original_token_count = approx_token_count(&text);
let chunk_id = generate_chunk_id();

View File

@@ -2390,23 +2390,14 @@ async fn windows_unified_exec_escape_output_snapshot() -> Result<()> {
let raw_output = parsed.output.as_str();
// assert!(
// raw_output.contains("UEXEC-WINDOWS-ESCAPES"),
// "expected marker string in unified_exec output, got {raw_output:?}"
// );
// assert!(
// !raw_output.contains('\u{1b}'),
// "expected unified_exec output to be stripped of ANSI escape sequences on Windows, got {raw_output:?}"
// );
// Intentionally failing assertion so CI logs show the raw PTY output,
// including any escape sequences produced by ConPTY / PowerShell.
let expected = "UEXEC-WINDOWS-ESCAPES\n";
assert_eq!(
raw_output, expected,
"raw unified_exec PTY output on Windows (expected simple marker, got full stream)"
assert!(
raw_output.contains("UEXEC-WINDOWS-ESCAPES"),
"expected marker string in unified_exec output, got {raw_output:?}"
);
assert!(
!raw_output.contains('\u{1b}'),
"expected unified_exec output to be stripped of ANSI escape sequences on Windows, got {raw_output:?}"
);
assert!(false);
Ok(())
}