Skip to content

App-server config write APIs cannot target project .codex/config.toml (user config only) #11728

@songkeys

Description

@songkeys

What version of Codex is running?

Observed on openai/codex current main in v0.101.0.

What issue are you seeing?

config/read can resolve and return project layers (.codex/config.toml) when cwd is provided, but config/value/write and config/batchWrite reject writing to project config paths and only allow writes to $CODEX_HOME/config.toml.

This makes project-scoped config effectively read-only through the app-server protocol.

Steps to reproduce

  1. Create a repo with a trusted project and a project config file:
    • <repo>/.codex/config.toml
  2. Call config/read with cwd=<repo> and includeLayers=true.
    • Observe a Project layer in layers, and/or origins pointing to Project.
  3. Attempt to write a project-scoped key using:
    • config/value/write with filePath="<repo>/.codex/config.toml" (or equivalent absolute path),
    • or config/batchWrite with that same filePath.
  4. Observe error response:
    • config_write_error_code: "configLayerReadonly"
    • message: Only writes to the user config are allowed
  5. If filePath is omitted, the write succeeds but updates $CODEX_HOME/config.toml (user/global scope), not project scope.

Expected behavior

One of these (in order of preference):

  1. Support project-layer writes in config RPC:
    • explicit targeting, e.g. targetLayer: "project" + cwd, or
    • allow filePath to point at trusted .codex/config.toml with guardrails.
  2. If project writes are intentionally unsupported, make that explicit in protocol/docs and narrow filePath semantics to avoid implying arbitrary writable config target files.

Actual behavior

Write APIs are hard-restricted to user config path, even when the protocol can read project layers.

Why this matters

Protocol clients can read effective/project config but cannot persist project-scoped changes.
They must mutate global user config instead, which leaks project-specific settings across repositories.

Additional context (source references)

  • ConfigReadParams.cwd explicitly describes project-layer resolution.
  • ConfigValueWriteParams.file_path / ConfigBatchWriteParams.file_path accept a path and say it defaults to user config when omitted.
  • core/src/config/service.rs enforces:
    • allowed write target = $CODEX_HOME/config.toml
    • otherwise returns ConfigLayerReadonly with message Only writes to the user config are allowed.
  • App-server README currently describes write RPCs as writing user config.

Happy to help test a fix if there is a preferred API shape.

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-serverIssues involving app server protocol or interfacesenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions