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`
39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
repo_root="$(cd "$script_dir/../../.." && pwd)"
|
|
proto_dir="$repo_root/codex-rs/config/src/thread_config/proto"
|
|
generated="$proto_dir/codex.thread_config.v1.rs"
|
|
tmpdir="$(mktemp -d)"
|
|
|
|
cleanup() {
|
|
rm -rf "$tmpdir"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
(
|
|
cd "$repo_root/codex-rs"
|
|
CARGO_TARGET_DIR="$tmpdir/target" cargo run \
|
|
-p codex-config \
|
|
--example generate-proto \
|
|
-- "$proto_dir"
|
|
)
|
|
|
|
if ! sed -n '2p' "$generated" | grep -q 'clippy::trivially_copy_pass_by_ref'; then
|
|
{
|
|
sed -n '1p' "$generated"
|
|
printf '#![allow(clippy::trivially_copy_pass_by_ref)]\n'
|
|
sed '1d' "$generated"
|
|
} > "$tmpdir/generated.rs"
|
|
mv "$tmpdir/generated.rs" "$generated"
|
|
fi
|
|
|
|
rustfmt --edition 2024 "$generated"
|
|
|
|
awk '
|
|
NR == 3 && previous ~ /clippy::trivially_copy_pass_by_ref/ && $0 != "" { print "" }
|
|
{ print; previous = $0 }
|
|
' "$generated" > "$tmpdir/formatted.rs"
|
|
mv "$tmpdir/formatted.rs" "$generated"
|