Skip to content

Six config settings are defined but never read #517

Description

@oshoma

Six settings in sherpa_ai/config/__init__.py are defined and documented but never read anywhere in sherpa_ai/. Most look like wiring gaps rather than dead code — the feature exists, but the setting that should control it was never connected, so setting the env var silently does nothing.

Found while removing TEMPERATURE (genuinely dead, removed in #509).

Setting Default Why it looks unfinished
ENABLE_COST_TRACKING true DAILY_COST_LIMIT and COST_ALERT_THRESHOLD are both read in 3 places, so cost tracking works — but its on/off switch is never checked. Cost tracking can't be disabled.
MODEL_PRICING_CONFIG_PATH None PricingConfig.__init__(config_path=None) already handles a path, and _load_pricing_config reads it. Nothing passes cfg.MODEL_PRICING_CONFIG_PATH in. (MODEL_PRICING_JSON works fine.)
FILE_SIZE_LIMIT 2097152 FILE_TOKEN_LIMIT is enforced; the size limit next to it isn't.
DAILY_LIMIT_REACHED_MESSAGE long default message A user-facing message for exceeding DAILY_TOKEN_LIMIT (which is enforced), but nothing ever displays it.
AWS_ACCESS_KEY None backup.py calls boto3.client("s3") with no credentials. Also these names are non-standard — boto3 reads AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY, so setting these has no effect by either route.
AWS_SECRET_KEY None as above

Suggestions

  • MODEL_PRICING_CONFIG_PATH — smallest fix: default the parameter to the config value, e.g. config_path or cfg.MODEL_PRICING_CONFIG_PATH in PricingConfig.__init__.
  • ENABLE_COST_TRACKING — check it before cost tracking runs, or drop it if cost tracking is meant to be always-on.
  • FILE_SIZE_LIMIT — enforce it where FILE_TOKEN_LIMIT is enforced, or drop it.
  • DAILY_LIMIT_REACHED_MESSAGE — return it where the daily token limit is hit, or drop it.
  • AWS_ACCESS_KEY / AWS_SECRET_KEY — simplest is to delete both and let boto3 use its standard credential chain, which is what actually happens today. If explicit credentials are wanted, rename to the standard names and pass them to boto3.client().

Each is independent, so they can be taken one at a time. Deleting is a fine outcome for any of them — the point is that right now they read as supported configuration and aren't.

Note LOG_LEVEL is not in this list: it is used, at config/__init__.py:95.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions