core-agent-ide/codex-rs/state
Celia Chen 90cc4e79a2
feat: add local date/timezone to turn environment context (#12947)
## Summary

This PR includes the session's local date and timezone in the
model-visible environment context and persists that data in
`TurnContextItem`.

  ## What changed
- captures the current local date and IANA timezone when building a turn
context, with a UTC fallback if the timezone lookup fails
- includes current_date and timezone in the serialized
<environment_context> payload
- stores those fields on TurnContextItem so they survive rollout/history
handling, subagent review threads, and resume flows
- treats date/timezone changes as environment updates, so prompt caching
and context refresh logic do not silently reuse stale time context
- updates tests to validate the new environment fields without depending
on a single hardcoded environment-context string

## test

built a local build and saw it in the rollout file:
```
{"timestamp":"2026-02-26T21:39:50.737Z","type":"response_item","payload":{"type":"message","role":"user","content":[{"type":"input_text","text":"<environment_context>\n  <shell>zsh</shell>\n  <current_date>2026-02-26</current_date>\n  <timezone>America/Los_Angeles</timezone>\n</environment_context>"}]}}
```
2026-02-26 23:17:35 +00:00
..
migrations feat: memories forgetting (#12900) 2026-02-26 13:19:57 +00:00
src feat: add local date/timezone to turn environment context (#12947) 2026-02-26 23:17:35 +00:00
BUILD.bazel feat: sqlite 1 (#10004) 2026-01-28 15:29:14 +01:00
Cargo.toml feat: drop sqlx logging (#10398) 2026-02-02 19:26:58 +00:00