mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Delay automatic recaps and compact their TUI layout (#45089)
## What changed - Increase the automatic recap delay from 3 to 30 minutes. - Replace the recap heading and divider with an italic `↳ Recap:` layout, hanging indentation, and right padding. Preserve explicit line breaks and Unicode, splitting URLs only when they exceed the available text column. - Use Tokio's clock for automatic recap eligibility and create the timer before spawning its task. - Remove the `token_budget.use_history_notes_extension` override from temporary structured requests. ## Testing Add coverage for the 30-minute deadline, recap styling, narrow terminals, Unicode, and URL wrapping. Update recap generation and reconnect tests to advance Tokio's clock instead of relying on host uptime. GitOrigin-RevId: 79a9bca779020b59a409207163b02944b30c1a20
This commit is contained in:
1 parent
ee6814bfa4
commit
f16c2237a5
7 files changed
+193
-62
No files matched your search
@@ -231,7 +231,7 @@ async fn reconnect_restores_history_permissions_and_keeps_old_input_paused() ->
|
||||
&mut app.rate_limit_hard_stop_generation,
|
||||
)
|
||||
.unwrap();
|
||||
let before_disconnect = Instant::now() - Duration::from_secs(/*secs*/ 300);
|
||||
let before_disconnect = Instant::now();
|
||||
app.recap.note_focus_lost(before_disconnect);
|
||||
for _ in 0..3 {
|
||||
app.recap
|
||||
@@ -273,6 +273,10 @@ async fn reconnect_restores_history_permissions_and_keeps_old_input_paused() ->
|
||||
!app.agent_navigation
|
||||
.finish_picker_refresh(id, stale_picker_refresh)
|
||||
);
|
||||
// Let the rebound timer become due without depending on machine uptime.
|
||||
tokio::time::pause();
|
||||
tokio::time::advance(recap::RECAP_DELAY).await;
|
||||
tokio::time::resume();
|
||||
let mut deferred = Vec::new();
|
||||
tokio::time::timeout(Duration::from_secs(/*secs*/ 5), async {
|
||||
loop {
|
||||
|
||||
@@ -34,7 +34,7 @@ fn render_chat_widget(app: &App) -> String {
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
fn prepare_eligible_recap(app: &mut App, thread_id: ThreadId) {
|
||||
async fn prepare_eligible_recap(app: &mut App, thread_id: ThreadId) {
|
||||
app.active_thread_id = Some(thread_id);
|
||||
app.transcript_cells
|
||||
.push(Arc::new(crate::history_cell::UserHistoryCell {
|
||||
@@ -44,15 +44,19 @@ fn prepare_eligible_recap(app: &mut App, thread_id: ThreadId) {
|
||||
local_image_paths: Vec::new(),
|
||||
remote_image_urls: Vec::new(),
|
||||
}));
|
||||
let ready_at = Instant::now() - recap::RECAP_DELAY;
|
||||
let ready_at = Instant::now();
|
||||
app.recap.note_focus_lost(ready_at);
|
||||
for _ in 0..3 {
|
||||
app.recap
|
||||
.note_turn_finished(&TurnStatus::Completed, ready_at);
|
||||
}
|
||||
// Advance the scheduler's clock instead of subtracting from the host's uptime.
|
||||
tokio::time::pause();
|
||||
tokio::time::advance(recap::RECAP_DELAY).await;
|
||||
tokio::time::resume();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
#[tokio::test]
|
||||
async fn recap_generation_uses_bounded_structured_request_and_inserts_result() -> Result<()> {
|
||||
let chunks = [
|
||||
ev_response_created("recap-response"),
|
||||
@@ -113,7 +117,7 @@ stream_max_retries = 0
|
||||
.await?;
|
||||
while app_event_rx.try_recv().is_ok() {}
|
||||
|
||||
prepare_eligible_recap(&mut app, thread_id);
|
||||
prepare_eligible_recap(&mut app, thread_id).await;
|
||||
|
||||
app.handle_event(
|
||||
&mut tui,
|
||||
@@ -305,7 +309,7 @@ async fn manual_recap_works_when_auto_recap_disabled() -> Result<()> {
|
||||
async fn auto_recap_opt_out_blocks_requests_and_cleans_up_pending_start() -> Result<()> {
|
||||
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
let thread_id = ThreadId::new();
|
||||
prepare_eligible_recap(&mut app, thread_id);
|
||||
prepare_eligible_recap(&mut app, thread_id).await;
|
||||
let (mut app_server, requests, proxy) = start_recording_remote_app_server(&app.config).await?;
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
app.local_settings.tui.auto_recap = false;
|
||||
@@ -453,7 +457,7 @@ async fn temporary_recap_threads_disable_memories_and_remote_mcp_servers() -> Re
|
||||
async fn recap_check_rejects_a_non_displayed_thread() -> Result<()> {
|
||||
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
let displayed_thread_id = ThreadId::new();
|
||||
prepare_eligible_recap(&mut app, displayed_thread_id);
|
||||
prepare_eligible_recap(&mut app, displayed_thread_id).await;
|
||||
while app_event_rx.try_recv().is_ok() {}
|
||||
let (mut app_server, requests, proxy) = start_recording_remote_app_server(&app.config).await?;
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
@@ -483,7 +487,7 @@ async fn recap_check_rejects_a_non_displayed_thread() -> Result<()> {
|
||||
async fn recap_check_rejects_a_running_turn() -> Result<()> {
|
||||
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
let thread_id = ThreadId::new();
|
||||
prepare_eligible_recap(&mut app, thread_id);
|
||||
prepare_eligible_recap(&mut app, thread_id).await;
|
||||
app.chat_widget
|
||||
.handle_thread_session(test_thread_session(thread_id, app.config.cwd.to_path_buf()));
|
||||
app.chat_widget.handle_server_notification(
|
||||
|
||||
Reference in new issue
Block a user