Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
11f3f7e
lighter rendering of user/agent messages
nornagon-openai Aug 26, 2025
9c659d6
wip
nornagon-openai Aug 27, 2025
8170786
wip
nornagon-openai Aug 27, 2025
1e56853
wip
nornagon-openai Aug 27, 2025
54dee3a
simplify
nornagon-openai Aug 27, 2025
792fb82
fix tests
nornagon-openai Aug 27, 2025
5159b46
agent message >
nornagon-openai Aug 27, 2025
f51eda8
warning emoji
nornagon-openai Aug 27, 2025
b2d79b9
single-line command runs
nornagon-openai Aug 27, 2025
bb45161
command wrapping
nornagon-openai Aug 27, 2025
93d9da0
diff wip
nornagon-openai Aug 28, 2025
e6ba0af
diffs
nornagon-openai Aug 28, 2025
ca93201
fix wrapping
nornagon-openai Aug 28, 2025
a25a6be
cleanup
nornagon-openai Aug 28, 2025
2567354
wip
nornagon-openai Aug 29, 2025
99dd4f2
fix spacing in textarea
nornagon-openai Aug 29, 2025
8a86495
tui: show spinner instead of bullet in Exploring header
nornagon-openai Aug 29, 2025
7ecac28
test
nornagon-openai Aug 29, 2025
e7548e2
revert status changes
nornagon-openai Aug 29, 2025
1bc20d1
placeholder
nornagon-openai Aug 29, 2025
990e997
update plan, approval spacing
nornagon-openai Aug 29, 2025
3339c3b
Merge remote-tracking branch 'origin/main' into nornagon/message-styling
nornagon-openai Aug 29, 2025
599e5d0
fix testst
nornagon-openai Aug 29, 2025
64d548b
tui: ChatComposer rect fixes and hint line; split patch history snaps…
nornagon-openai Aug 29, 2025
49d8633
remove empty test
nornagon-openai Aug 29, 2025
3a10412
test
nornagon-openai Aug 29, 2025
0f18de3
simpler test
nornagon-openai Aug 29, 2025
230bd1a
more simpler
nornagon-openai Aug 29, 2025
b8adb5a
test
nornagon-openai Aug 29, 2025
b6d38e9
tui: parse bash commands and dim some syntax
nornagon-openai Aug 29, 2025
cdfd879
fix headers
nornagon-openai Aug 29, 2025
7afe05a
better wrapping
nornagon-openai Aug 29, 2025
c312e26
diff simplify
nornagon-openai Aug 29, 2025
5bc0d64
simplify
nornagon-openai Aug 29, 2025
3da7f52
better path display
nornagon-openai Aug 29, 2025
a8d37e0
simplify diff
nornagon-openai Aug 29, 2025
d7ed1fd
better wrap in userhistorycell
nornagon-openai Aug 29, 2025
582d7fd
simplify
nornagon-openai Aug 29, 2025
27ef3c5
revert changes in tui.rs
nornagon-openai Aug 29, 2025
c21e10a
show single file for change approved
nornagon-openai Aug 29, 2025
0d96cb8
reparse commands for ideal response
nornagon-openai Aug 29, 2025
521a71b
dim output text
nornagon-openai Aug 29, 2025
861f7b5
convert binary size test to snapshot
nornagon-openai Aug 29, 2025
70b83f4
dim output text
nornagon-openai Aug 29, 2025
1aa8cec
don't try to detect image paths for normal typing
nornagon-openai Aug 30, 2025
93934a1
defensively, assume 1-char strings are not image paths
nornagon-openai Aug 30, 2025
1dbfa1f
Merge branch 'nornagon/lag' into nornagon/message-styling
nornagon-openai Aug 30, 2025
bf72447
update plan cell
nornagon-openai Sep 1, 2025
e8fc8c2
simplify
nornagon-openai Sep 1, 2025
1677132
wip
nornagon-openai Sep 1, 2025
47c9068
Merge branch 'nornagon/message-styling' into nornagon/parse-bash
nornagon-openai Sep 2, 2025
34bdfdd
Merge remote-tracking branch 'origin/main' into nornagon/parse-bash
nornagon-openai Sep 2, 2025
e700c44
Merge remote-tracking branch 'origin/main' into nornagon/parse-bash
nornagon-openai Sep 2, 2025
62c8ee3
fix
nornagon-openai Sep 2, 2025
19fd5e6
standardize on allowing hyphenation and breaking words
nornagon-openai Sep 2, 2025
59a4c63
restore no-hyphenation for bash
nornagon-openai Sep 2, 2025
92144d9
wip
nornagon-openai Sep 2, 2025
3750b6a
wip
nornagon-openai Sep 3, 2025
e2688ff
wip
nornagon-openai Sep 3, 2025
fbefb73
Merge remote-tracking branch 'origin/main' into nornagon/parse-bash
nornagon-openai Sep 3, 2025
f85f54e
wip
nornagon-openai Sep 3, 2025
6ca03b6
reorg
nornagon-openai Sep 4, 2025
d508cff
wip
nornagon-openai Sep 4, 2025
78d911f
move prefix_lines helper
nornagon-openai Sep 4, 2025
01e311b
gitignore
nornagon-openai Sep 4, 2025
54630ca
order
nornagon-openai Sep 4, 2025
79c66d9
consolidate wrapping helpers
nornagon-openai Sep 4, 2025
7508ec2
agents.md
nornagon-openai Sep 4, 2025
d9fd052
lint
nornagon-openai Sep 4, 2025
9f52dd2
better test
nornagon-openai Sep 4, 2025
c11f63a
simplify
nornagon-openai Sep 4, 2025
9e28bb4
tests
nornagon-openai Sep 4, 2025
8d2eeb1
Merge branch 'main' into nornagon/parse-bash
nornagon-openai Sep 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
convert binary size test to snapshot
  • Loading branch information
nornagon-openai committed Aug 29, 2025
commit 861f7b55ee1a6608c668c5869b29a81054020379
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
To get started, describe a task or try one of these commands:

/init - create an AGENTS.md file with instructions for Codex
/status - show current session configuration and token usage
/approvals - choose what Codex can do without approval
/model - choose what model and reasoning effort to use

I’m going to scan the workspace and Cargo manifests to see build profiles and
---
source: tui/src/chatwidget/tests.rs
expression: visible_after
---
> I’m going to scan the workspace and Cargo manifests to see build profiles and
dependencies that impact binary size. Then I’ll summarize the main causes.

• Explored
Expand All @@ -21,7 +18,7 @@ I’m going to scan the workspace and Cargo manifests to see build profiles and
• Explored
└ Read Cargo.toml

Here’s what’s driving size in this workspace’s binaries.
> Here’s what’s driving size in this workspace’s binaries.

Main Causes

Expand Down
67 changes: 11 additions & 56 deletions codex-rs/tui/src/chatwidget/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ use pretty_assertions::assert_eq;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Read;
use std::path::PathBuf;
use tokio::sync::mpsc::unbounded_channel;

Expand Down Expand Up @@ -433,7 +432,7 @@ fn exec_history_extends_previous_when_consecutive() {
}

#[tokio::test(flavor = "current_thread")]
async fn binary_size_transcript_matches_ideal_fixture() {
async fn binary_size_transcript_snapshot() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual();

// Set up a VT100 test terminal to capture ANSI visual output
Expand Down Expand Up @@ -552,19 +551,6 @@ async fn binary_size_transcript_matches_ideal_fixture() {
}
}

// Read the ideal fixture as-is
let mut f = open_fixture("ideal-binary-response.txt");
let mut ideal = String::new();
f.read_to_string(&mut ideal)
.expect("read ideal-binary-response.txt");
// Normalize line endings for Windows vs. Unix checkouts
let ideal = ideal.replace("\r\n", "\n");
let ideal_first_line = ideal
.lines()
.find(|l| !l.trim().is_empty())
.unwrap_or("")
.to_string();

// Build the final VT100 visual by parsing the ANSI stream. Trim trailing spaces per line
// and drop trailing empty lines so the shape matches the ideal fixture exactly.
let mut parser = vt100::Parser::new(height, width, 0);
Expand All @@ -589,24 +575,19 @@ async fn binary_size_transcript_matches_ideal_fixture() {
while lines.last().is_some_and(|l| l.is_empty()) {
lines.pop();
}
// Compare only after the last session banner marker. Skip the transient
// 'thinking' header if present, and start from the first non-empty line
// of content that follows.
// Consider content only after the last session banner marker. Skip the transient
// 'thinking' header if present, and start from the first non-empty content line
// that follows. This keeps the snapshot stable across sessions.
const MARKER_PREFIX: &str = ">_ You are using OpenAI Codex in ";
let last_marker_line_idx = lines
.iter()
.rposition(|l| l.starts_with(MARKER_PREFIX))
.expect("marker not found in visible output");
// Anchor to the first ideal line if present; otherwise use heuristics.
// Prefer the first assistant content line (blockquote '>' prefix) after the marker;
// fallback to the first non-empty, non-'thinking' line.
let start_idx = (last_marker_line_idx + 1..lines.len())
.find(|&idx| lines[idx].trim_start() == ideal_first_line)
.or_else(|| {
// Prefer the first assistant content line (blockquote '>' prefix) after the marker.
(last_marker_line_idx + 1..lines.len())
.find(|&idx| lines[idx].trim_start().starts_with('>'))
})
.find(|&idx| lines[idx].trim_start().starts_with('>'))
.unwrap_or_else(|| {
// Fallback: first non-empty, non-'thinking' line
(last_marker_line_idx + 1..lines.len())
.find(|&idx| {
let t = lines[idx].trim_start();
Expand All @@ -621,8 +602,8 @@ async fn binary_size_transcript_matches_ideal_fixture() {
compare_lines.extend(lines[(start_idx + 1)..].iter().cloned());
let visible_after = compare_lines.join("\n");

// Normalize: drop a leading 'thinking' line if present in either side to
// avoid coupling to whether the reasoning header is rendered in history.
// Normalize: drop a leading 'thinking' line if present to avoid coupling
// to whether the reasoning header is rendered in history.
fn drop_leading_thinking(s: &str) -> String {
let mut it = s.lines();
let first = it.next();
Expand All @@ -634,35 +615,9 @@ async fn binary_size_transcript_matches_ideal_fixture() {
}
}
let visible_after = drop_leading_thinking(&visible_after);
let ideal = drop_leading_thinking(&ideal);

// Normalize: strip leading Markdown blockquote markers ('>' or '> ') which
// may be present in rendered transcript lines but not in the ideal text.
fn strip_blockquotes(s: &str) -> String {
s.lines()
.map(|l| {
l.strip_prefix("> ")
.or_else(|| l.strip_prefix('>'))
.unwrap_or(l)
})
.collect::<Vec<_>>()
.join("\n")
}
let visible_after = strip_blockquotes(&visible_after);
let ideal = strip_blockquotes(&ideal);

// Optionally update the fixture when env var is set
if std::env::var("UPDATE_IDEAL").as_deref() == Ok("1") {
let mut p = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
p.push("tests");
p.push("fixtures");
p.push("ideal-binary-response.txt");
std::fs::write(&p, &visible_after).expect("write updated ideal fixture");
return;
}

// Exact equality with pretty diff on failure
assert_eq!(visible_after, ideal);
// Snapshot the normalized visible transcript following the banner.
assert_snapshot!("binary_size_ideal_response", visible_after);
}

//
Expand Down