mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
## What changed - Make Summary the initial Analytics tab, showing profile identity, token totals, streaks, activity insights, and most-used plugins and skills. - Move daily, weekly, and cumulative token activity charts into Summary. Replace the usage menu's separate views with “View analytics”; `/usage weekly` and the other explicit modes open Summary with the requested view, while reopening from the menu retains navigation. - Load account profiles independently of other reports, preserve missing values separately from zero, and reject responses when the active account changes. Refresh retries profile failures. - Adapt Summary to narrow terminals and compact large chart totals and axis labels. Show the account email without its ID in the Analytics header. - Flush queued transcript history before opening an overlay so startup output stays in the transcript. ## Testing Add profile decoding and account identity tests, Summary layout and navigation snapshots, refresh and cancellation coverage, and regression tests for retained navigation and transcript history when opening Analytics. GitOrigin-RevId: 6dbe6c4c98209000d8b4bc18a4e01b98fab5991a
55 lines
2.3 KiB
Rust
55 lines
2.3 KiB
Rust
//! Defer reset hints until active transcript output and stream consolidation have settled.
|
|
|
|
use super::ChatWidget;
|
|
use crate::app_event::AppEvent;
|
|
|
|
impl ChatWidget {
|
|
/// Reports whether completed asynchronous usage output must wait before insertion.
|
|
///
|
|
/// Inserting while a stream, queued consolidation, or active transcript cell is
|
|
/// present can reorder output relative to visible work, so callers retry once
|
|
/// these barriers clear.
|
|
pub(crate) fn usage_history_insertion_blocked(&self) -> bool {
|
|
self.stream_controller.is_some()
|
|
|| self.plan_stream_controller.is_some()
|
|
|| self.pending_stream_consolidations > 0
|
|
|| self.transcript.active_cell.is_some()
|
|
|| self.active_hook_cell.is_some()
|
|
}
|
|
|
|
/// Records a stream consolidation barrier that delays reset hint insertion.
|
|
///
|
|
/// Each queued consolidation should eventually call
|
|
/// [`ChatWidget::note_stream_consolidation_completed`].
|
|
pub(crate) fn note_stream_consolidation_queued(&mut self) {
|
|
self.pending_stream_consolidations =
|
|
self.pending_stream_consolidations.saturating_add(/*rhs*/ 1);
|
|
}
|
|
|
|
/// Releases one queued stream consolidation barrier.
|
|
///
|
|
/// The counter saturates at zero so an unmatched completion does not underflow,
|
|
/// but paired queue/completion calls are still the intended contract.
|
|
pub(crate) fn note_stream_consolidation_completed(&mut self) {
|
|
self.pending_stream_consolidations =
|
|
self.pending_stream_consolidations.saturating_sub(/*rhs*/ 1);
|
|
}
|
|
|
|
/// Requests another insertion attempt when completed usage output is waiting.
|
|
///
|
|
/// This is used after stream or history lifecycle events that may have cleared
|
|
/// the insertion barriers without directly owning the completed output.
|
|
pub(crate) fn request_pending_usage_output_insertion(&self) {
|
|
if self.pending_rate_limit_reset_hint().is_some() {
|
|
self.app_event_tx.send(AppEvent::CommitPendingUsageOutput);
|
|
}
|
|
}
|
|
|
|
pub(crate) fn request_pending_usage_output_insertion_after_stream_shutdown(&self) {
|
|
if self.pending_rate_limit_reset_hint().is_some() {
|
|
self.app_event_tx
|
|
.send(AppEvent::CommitPendingUsageOutputAfterStreamShutdown);
|
|
}
|
|
}
|
|
}
|