Add app-server current-time impl (varlatency 3/n)#28835
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d473fdc80a
ℹ️ 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".
| thread_id: ThreadId, | ||
| ) -> Result<DateTime<Utc>> { | ||
| let connection_ids = thread_state_manager | ||
| .current_time_capable_connections_for_thread(thread_id) |
There was a problem hiding this comment.
Wait for subscriber attachment before reading app-server time
For threads created outside the synchronous thread/start path, such as subagents, client subscription is attached later by the thread_created_rx background branch, but the first model request can call this provider immediately. With clock_source = "app_server_client" and a reminder due on the first request, this lookup can see zero current-time-capable subscribers and fail the turn even though an initialized client would be attached moments later; make creation/attachment ordered for these threads or have the provider wait/retry for the initial subscriber.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed cleanly for the supported single-client case in 5617874.
| /// Opt into `currentTime/read` requests for an external clock. | ||
| #[serde(default)] | ||
| pub request_current_time: bool, |
There was a problem hiding this comment.
Keep current-time capability out of v1 initialize
Adding request_current_time to v1::InitializeCapabilities expands the v1 initialize contract and regenerates schema/json/v1/InitializeParams.json with a new current-time field. This current-time negotiation is new app-server API surface, so it should be modeled in v2/common protocol instead of extending v1.
AGENTS.md reference: AGENTS.md:L257-L260
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
iiuc, this shouldn't be an issue
| let capabilities = InitializeCapabilities { | ||
| experimental_api: self.experimental_api, | ||
| request_attestation: false, | ||
| request_current_time: false, |
There was a problem hiding this comment.
Expose current-time opt-in through the client facade
For callers that use app-server-client and handle AppServerEvent::ServerRequest, this hard-coded false means they cannot advertise the new current-time capability even if they implement currentTime/read. With clock_source = "app_server_client", app-server will therefore find zero capable subscribers and fail the turn before inference; add a start/connect argument and forward it here (and in the remote connect args) so facade clients can opt in.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
shouldn't be an issue. this should only support clients that connect directly to the app-server using JSON-RPC
What
Server should request:
Client should respond with something like:
Why
Sessions configured with
clock_source = "app_server_client"need a thread-specific external time source before inference. The system clock remains the default production provider.Validation
cargo test -p codex-app-server-protocolcargo test -p codex-app-server --test all current_time_read_round_trip_adds_reminder_to_model_inputcargo test -p codex-app-server first_attestation_capable_connection_for_thread_only_uses_thread_subscriberscargo test -p codex-analyticsjust fix -p codex-app-server-protocoljust fix -p codex-app-serverStacked on #28824.