Skip to content

current time reminders impl for system clock (varlatency 2/n)#28824

Open
rka-oai wants to merge 5 commits into
codex/varlatency-configfrom
codex/varlatency-reminders
Open

current time reminders impl for system clock (varlatency 2/n)#28824
rka-oai wants to merge 5 commits into
codex/varlatency-configfrom
codex/varlatency-reminders

Conversation

@rka-oai

@rka-oai rka-oai commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Stacked on #28822.

Summary

  • add a host-injectable current-time provider with a built-in system implementation
  • record UTC developer reminders in history immediately before due model requests
  • keep cadence state per session and force a refresh after compaction

This does NOT include the app server client <-> server clock logic. This PR is only for the reminder message & system clock that will be used in prod.

Testing

  • just test -p codex-core varlatency_
  • just clippy -p codex-core -p codex-app-server -p codex-mcp-server -p codex-thread-manager-sample
  • just fmt

@rka-oai rka-oai force-pushed the codex/varlatency-reminders branch from 3110411 to eccf43d Compare June 18, 2026 01:09
@rka-oai rka-oai force-pushed the codex/varlatency-reminders branch from eccf43d to 05da7e6 Compare June 18, 2026 01:19
@rka-oai rka-oai changed the title Inject current-time reminders before sampling current time reminders impl (varlatency 2/n) Jun 18, 2026
@rka-oai rka-oai changed the title current time reminders impl (varlatency 2/n) current time reminders impl for system clock (varlatency 2/n) Jun 18, 2026
@rka-oai rka-oai marked this pull request as ready for review June 18, 2026 01:57
@rka-oai rka-oai requested a review from a team as a code owner June 18, 2026 01:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8c21f1b20

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/session/time_reminder.rs
.expect("test config should allow current-time reminders");
config.current_time_reminder = Some(CurrentTimeReminderConfig {
reminder_interval_model_requests: interval,
clock_source: CurrentTimeSource::AppServerClient,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[found by codex] These tests only exercise AppServerClient; please add coverage for the production System source.

.build(&server)
.await?;

test.submit_turn("first turn").await?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[found by codex] This proves cadence across turns, not model requests; please cover a tool-call follow-up within one turn.


match config.clock_source {
CurrentTimeSource::System => Ok(Some(Arc::new(SystemCurrentTimeProvider))),
CurrentTimeSource::AppServerClient => external_provider.map(Some).ok_or_else(|| {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Probably should be named external

state_db: Option<StateDbHandle>,
installation_id: String,
attestation_provider: Option<Arc<dyn AttestationProvider>>,
external_current_time_provider: Option<Arc<dyn CurrentTimeProvider>>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: external_time_provider

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and TimeProvider

.services
.current_time_provider
.as_ref()
.ok_or_else(|| CodexErr::Fatal("current-time provider is not configured".to_string()))?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a lil strange that we have 2 sources of truth for how this feature is enabled. Pick one.

.await;

let mut state = sess.state.lock().await;
state.current_time_reminder.record_delivery(window_id);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have 1 method?

Comment on lines +229 to +236
info!("Turn error: {err:#}");
sess.emit_turn_error_lifecycle(turn_context.as_ref(), err.to_codex_protocol_error())
.await;
sess.track_turn_codex_error(turn_context.as_ref(), &err);
let event = EventMsg::Error(err.to_error_event(/*message_prefix*/ None));
sess.send_event(&turn_context, event).await;
return None;
}

@pakrym-oai pakrym-oai Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not in love with this special pile of error handling. Can we have all error handling localized? maybe by reordering things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants