Skip to content

Add AGENT=codex environment variable to UNIFIED_EXEC_ENV #13416

Closed as not planned

Description

@sw-square

What variant of Codex are you using?
CLI (codex-rs)

What feature would you like to see?

Add AGENT=codex to the UNIFIED_EXEC_ENV array in codex-rs/core/src/unified_exec/process_manager.rs, so that spawned processes can detect they are running inside the Codex agent.

Other AI coding agents already follow this convention:

  • Goose sets AGENT=goose
  • Amp sets AGENT=amp

This allows downstream tools, scripts, and MCP servers to detect which agent is driving them and adapt behavior accordingly (e.g., adjusting output format, disabling interactive prompts, or collecting telemetry).

Proposed diff:

-const UNIFIED_EXEC_ENV: [(&str, &str); 10] = [
+const UNIFIED_EXEC_ENV: [(&str, &str); 11] = [
     ("NO_COLOR", "1"),
     ("TERM", "dumb"),
     ("LANG", "C.UTF-8"),
@@ -63,6 +63,7 @@
     ("GIT_PAGER", "cat"),
     ("GH_PAGER", "cat"),
     ("CODEX_CI", "1"),
+    ("AGENT", "codex"),
 ];

The test unified_exec_env_injects_defaults also needs the new entry added to the expected HashMap.

Additional information

A working implementation with passing tests is available at: https://github.com/sw-square/codex/tree/add-agent-env-var

All existing process_manager unit tests pass and cargo clippy is clean.

Activity

  1. added
    enhancementNew feature or request
    CLIIssues related to the Codex CLI
    tool-callsIssues related to tool calling
    on Mar 4, 2026
  2. sw-square commented on Mar 4, 2026

    @sw-square
    Author

    Also CF agentsmd/agents.md#136, which is an attempt to standardize this

  3. etraut-openai commented on Apr 3, 2026

    @etraut-openai
    Contributor

    This feature request hasn't received enough upvotes, so closing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions