mirror of
https://github.com/openai/codex.git
synced 2026-11-28 07:32:19 +00:00
Display title-only reasoning summaries in the TUI (#35989)
## What changed - Treat a single non-empty bold span as a title-only reasoning summary instead of transcript-only content. - Render title-only summaries consistently in the TUI history and transcript. - Add a regression test covering both render paths. GitOrigin-RevId: e3cda451b3fa0ad92985463b14427384bcae4a8d
This commit is contained in:
1 parent
1ae2b9880e
commit
1e3c0042eb
2 files changed
+25
-1
No files matched your search
@@ -553,7 +553,11 @@ pub(crate) fn new_reasoning_summary_block(
|
|||||||
cwd: &Path,
|
cwd: &Path,
|
||||||
) -> Box<dyn HistoryCell> {
|
) -> Box<dyn HistoryCell> {
|
||||||
let (header, content) = split_reasoning_summary_parts(&reasoning_parts);
|
let (header, content) = split_reasoning_summary_parts(&reasoning_parts);
|
||||||
let transcript_only = header.is_empty();
|
let title_only = content
|
||||||
|
.strip_prefix("**")
|
||||||
|
.and_then(|content| content.strip_suffix("**"))
|
||||||
|
.is_some_and(|content| !content.is_empty() && !content.contains("**"));
|
||||||
|
let transcript_only = header.is_empty() && !title_only;
|
||||||
Box::new(ReasoningSummaryCell::new(
|
Box::new(ReasoningSummaryCell::new(
|
||||||
header,
|
header,
|
||||||
content,
|
content,
|
||||||
|
|||||||
@@ -2496,6 +2496,26 @@ fn reasoning_summary_block_falls_back_when_summary_is_missing() {
|
|||||||
assert_eq!(rendered, vec!["• High level reasoning without closing"]);
|
assert_eq!(rendered, vec!["• High level reasoning without closing"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn reasoning_summary_block_displays_title_only_summary() {
|
||||||
|
let cell = new_reasoning_summary_block(
|
||||||
|
vec!["**Confirming backend JSONL source**".to_string()],
|
||||||
|
&test_cwd(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
|
||||||
|
insta::assert_snapshot!(
|
||||||
|
rendered_display.join("\n"),
|
||||||
|
@"• Confirming backend JSONL source"
|
||||||
|
);
|
||||||
|
|
||||||
|
let rendered_transcript = render_transcript(cell.as_ref());
|
||||||
|
assert_eq!(
|
||||||
|
rendered_transcript,
|
||||||
|
vec!["• Confirming backend JSONL source"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reasoning_summary_block_splits_header_and_summary_when_present() {
|
fn reasoning_summary_block_splits_header_and_summary_when_present() {
|
||||||
let cell = new_reasoning_summary_block(
|
let cell = new_reasoning_summary_block(
|
||||||
|
|||||||
Reference in new issue
Block a user