A config file given with CHATTY_CONFIG is ignored unless its path contains "config"

Open Beginner friendly
#12 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start at ConfigWithSources.load_config in src/chatty/config.py:466 and read how CLI, environment, and TOML values are selected. Reproduce with CHATTY_CONFIG pointing to a TOML file whose path lacks “config,” then check chatty print-config and chat behavior. Done when the file’s model and base_url values apply without relying on its path or source label.

Written by the indexing model from the issue text.

Description

area: config bug wrong-result

ConfigWithSources.load_config (src/chatty/config.py:466) only applies a TOML value when its recorded source starts with chatty.toml or contains the substring config:

if key in _CONFIG_FIELDS and (source.startswith("chatty.toml") or "config" in source):

A file found through CHATTY_CONFIG has source env:CHATTY_CONFIG (<path>), so its values are dropped unless the path happens to contain lowercase config.

Effect: with CHATTY_CONFIG=/path/to/proj.toml containing model = "mymodel" and a base_url, chatty uses the defaults (model = "gpt-4.1", empty base_url), and chat fails with "No base_url configured". chatty print-config still says the values came from the file:

  base_url: (not set) (from: env:CHATTY_CONFIG (/path/to/proj.toml))
  model: gpt-4.1 (from: env:CHATTY_CONFIG (/path/to/proj.toml))

CHATTY_CONFIG is the documented way to point chatty at a config file.

Fix: decide whether a TOML value applies from the precedence logic itself (no CLI value, no env var for that key), not by matching the source label.

Dominant language
Python
Stars
0
Forks
2
Avg merge
1d 4h
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/chatty

All issues in lanl/chatty

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.