mirror of
https://github.com/openai/codex.git
synced 2026-05-03 02:46:39 +00:00
## Why Thread-scoped config needs a stable boundary between the app/session owner and the config stack. Instead of having call sites manually copy thread config fields into individual overrides, this adds the proto and Rust plumbing needed for a `ThreadConfigLoader` implementation to return typed sources that can be translated into ordinary config layer entries. Keeping the remote payload typed also makes precedence easier to reason about: session-owned thread config maps back to the existing session config source, while user-owned thread config is represented separately without introducing a new config-layer source until it has TOML-backed fields. ## What changed - Added the `codex.thread_config.v1` protobuf service and generated Rust module for loading thread config sources. - Added `RemoteThreadConfigLoader`, which calls the gRPC service, parses `SessionThreadConfig` / `UserThreadConfig`, and validates provider fields such as `wire_api`, auth timeout, and absolute auth cwd. - Added proto generation tooling under `config/scripts/generate-proto.sh` and `config/examples/generate-proto.rs`. - Added `ThreadConfigLoader::load_config_layers`, plus static/no-op loader helpers, so tests and callers can use the same typed loader interface while config-layer translation stays centralized. ## Verification - `cargo test -p codex-config thread_config`
20 lines
544 B
Rust
20 lines
544 B
Rust
use std::path::PathBuf;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let Some(proto_dir_arg) = std::env::args().nth(1) else {
|
|
eprintln!("Usage: generate-proto <proto-dir>");
|
|
std::process::exit(1);
|
|
};
|
|
|
|
let proto_dir = PathBuf::from(proto_dir_arg);
|
|
let proto_file = proto_dir.join("codex.thread_config.v1.proto");
|
|
|
|
tonic_prost_build::configure()
|
|
.build_client(true)
|
|
.build_server(true)
|
|
.out_dir(&proto_dir)
|
|
.compile_protos(&[proto_file], &[proto_dir])?;
|
|
|
|
Ok(())
|
|
}
|