current time reminders impl for system clock (2/n)#28824
Conversation
eccf43d to
05da7e6
Compare
There was a problem hiding this comment.
💡 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".
| .expect("test config should allow current-time reminders"); | ||
| config.current_time_reminder = Some(CurrentTimeReminderConfig { | ||
| reminder_interval_model_requests: interval, | ||
| clock_source: CurrentTimeSource::AppServerClient, |
There was a problem hiding this comment.
[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?; |
There was a problem hiding this comment.
[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(|| { |
There was a problem hiding this comment.
nit: Probably should be named external
There was a problem hiding this comment.
renamed to external everywhere in the stack
| state_db: Option<StateDbHandle>, | ||
| installation_id: String, | ||
| attestation_provider: Option<Arc<dyn AttestationProvider>>, | ||
| external_current_time_provider: Option<Arc<dyn CurrentTimeProvider>>, |
There was a problem hiding this comment.
nit: external_time_provider
| .services | ||
| .current_time_provider | ||
| .as_ref() | ||
| .ok_or_else(|| CodexErr::Fatal("current-time provider is not configured".to_string()))?; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
should we have 1 method?
| 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; | ||
| } |
There was a problem hiding this comment.
I'm not in love with this special pile of error handling. Can we have all error handling localized? maybe by reordering things
7a0e21d to
88be248
Compare
38a6d16 to
d45f58b
Compare
5df1f8f to
221ef10
Compare
4d678ec to
f09e32e
Compare
3f08ca5 to
98dbb60
Compare
14e4299 to
0539ddc
Compare
98dbb60 to
c8424ce
Compare
0539ddc to
671d4f5
Compare
c8424ce to
88a9dc6
Compare
671d4f5 to
933b6ab
Compare
933b6ab to
5396ac2
Compare
5396ac2 to
ba927fa
Compare
Stacked on #28822.
Summary
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 clippy -p codex-core -p codex-app-server -p codex-mcp-server -p codex-thread-manager-samplejust fmt