Skip to content

feat(config): settings.local.toml — gitignored project overrides#234

Merged
emal-avala merged 1 commit intomainfrom
feat/config-settings-local-toml
Apr 23, 2026
Merged

feat(config): settings.local.toml — gitignored project overrides#234
emal-avala merged 1 commit intomainfrom
feat/config-settings-local-toml

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

Adds a new config precedence tier: .agent/settings.local.toml, a gitignored overlay that sits on top of the committed settings.toml. Intended for developer-local overrides (e.g. a personal API base URL) without mutating the team's shared config.

Precedence (highest → lowest)

Tier File Intent
1 CLI flags / env vars Runtime overrides
2 .agent/settings.local.toml New — gitignored, per-developer
3 .agent/settings.toml Committed, shared team config
4 ~/.config/agent-code/config.toml User-global defaults

Both project-file walks are independent, so a repo-root settings.toml plus a crate-local settings.local.toml compose correctly — you can place the overlay at a different ancestor level than the shared file.

Scope

  • load_inner picks up the local layer after the project layer so it overrides.
  • watch_config observes the local file too, so /reload detects edits.
  • permissions.rules keep extend-semantics — user + project + local rules concatenate in order, matching existing behavior for the two-layer case.
  • Partial overrides work as expected: the local file can touch one [api] field without clobbering the rest.

Tests

5 new cases:

  • local_layer_overrides_project_layer
  • local_layer_partial_override_leaves_other_fields_intact
  • local_layer_without_project_still_overlays_on_user
  • local_layer_permission_rules_extend_across_all_layers
  • e2e_find_local_config_walks_up_from_nested_dir, …_is_independent_from_settings_toml, …_stops_at_first_match

Full config:: suite: 81 pass, 0 fail. Clippy clean under -D warnings.

Test plan

  • cargo test -p agent-code-lib --lib config::
  • cargo clippy --workspace --tests --no-deps -- -D warnings
  • cargo fmt --all --check

Adds a new config precedence tier above `settings.toml` and below env vars:
`.agent/settings.local.toml`. Intended for machine-specific or developer-
specific overrides that shouldn't be committed (e.g. pointing at a local
proxy base URL while leaving the team's shared `settings.toml` intact).

Precedence (highest → lowest):
1. CLI flags / env vars
2. `.agent/settings.local.toml` (gitignored, developer-local)  ← new
3. `.agent/settings.toml`       (committed, shared)
4. `~/.config/agent-code/config.toml` (user-global)

Both walks are independent, so a repo-root `settings.toml` plus a crate-
local `settings.local.toml` compose correctly.

`watch_config` now also watches the local file so `/reload` picks up
changes.

Tests: 5 new cases covering partial override, stand-alone local layer,
permission-rules extend ordering, walk-up, and no-cross-contamination
with `settings.toml`. Full config suite: 81 pass, 0 fail.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@emal-avala emal-avala merged commit ee42bec into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/config-settings-local-toml branch April 23, 2026 23:46
@emal-avala emal-avala mentioned this pull request Apr 24, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant