Answer: Environment variables are set for the full duration of the chat, including setup scripts and the agent phase. Secrets are stored with an additional layer of encryption, decrypted only for task execution, and are only available to setup scripts because they are removed before the agent phase starts. Status: Confirmed Entry: tool/codex/settings/cloud-environment-variables-secrets Revision: 1 Digest: sha256:58e0b6e44dcc84e2 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:50:56Z Last changed: 2026-11-13T03:50:56Z Last verified: 2026-11-20T13:39:12Z Next check: 2026-11-21T13:39:12Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of Environment variables duration | the full duration of the chat | [1] | 2026-11-20 Secrets storage | stored with an additional layer of encryption | [1] | 2026-11-20 Secrets availability | only available to setup scripts | [1] | 2026-11-20 Secrets removal | removed before the agent phase starts | [1] | 2026-11-20 Sources: [1] OpenAI. "Codex Cloud (Legacy)". https://learn.chatgpt.com/docs/environments/cloud-environment.md Role: primary. Accessed: 2026-11-20T13:39:12Z Quote: "**Environment variables** are set for the full duration of the chat (including setup scripts and the agent phase)." (Supports: Environment variables duration) Quote: "They are stored with an additional layer of encryption and are only decrypted for task execution." (Supports: Secrets storage) Quote: "They are only available to setup scripts." (Supports: Secrets availability) Quote: "For security reasons, secrets are removed before the agent phase starts." (Supports: Secrets removal) Snapshot SHA-256: a8f0c084d12d59c1fd815ad91c2749a3f7133b413b9ecb84fd2f41bd4e86bf0f (captured 2026-11-13T03:50:56Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:50:56Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:39:12Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:39:12Z Last attempt: 2026-11-20T13:39:12Z Notes and limitations: Extracted automatically from a single official source (section "Environment variables and secrets"). Related: https://latestn.com/tool/codex/settings/code-review-delivery-setting How do I change Codex code review delivery to inline or detached in ChatGPT settings? https://latestn.com/tool/codex/settings/codex-auth-network-env-vars What environment variables does Codex support for authentication and network settings? https://latestn.com/tool/codex/settings/codex-local-skills-location Where does Codex load local skills from? https://latestn.com/tool/codex/settings/change-settings-tui How do I change Codex settings in the TUI? https://latestn.com/tool/codex/settings/choose-cloud-environment How do I choose or set up an environment for a Codex Cloud task? https://latestn.com/tool/codex/settings/choose-scan-profile Which scan profile should I choose for Codex Security in GitLab CI/CD? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:50:56Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/codex/settings/cloud-environment-variables-secrets/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/codex/settings/cloud-environment-variables-secrets POST: https://latestn.com/dispute/tool/codex/settings/cloud-environment-variables-secrets with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/codex/settings/cloud-environment-variables-secrets?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I set environment variables and secrets for Codex Cloud environments? Revision 1, last verified 2026-11-20T13:39:12Z. https://latestn.com/tool/codex/settings/cloud-environment-variables-secrets (accessed 2026-11-21T09:53:31Z). @misc{LatestN_tool_codex_settings_cloud_environment_variables_secrets_r1, title = {How do I set environment variables and secrets for Codex Cloud environments?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/codex/settings/cloud-environment-variables-secrets}}, note = {Revision 1; digest sha256:58e0b6e44dcc84e2; last verified 2026-11-20T13:39:12Z; accessed 2026-11-21T09:53:31Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/codex/settings/cloud-environment-variables-secrets