Skip to content

fix(config): read environment defaults at instantiation - #428

Draft
er-s-an wants to merge 1 commit into
HKUDS:mainfrom
er-s-an:fix/config-environment-defaults-20261023
Draft

er-s-an wants to merge 1 commit into
HKUDS:mainfrom
er-s-an:fix/config-environment-defaults-20261023

Conversation

@er-s-an

@er-s-an er-s-an commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Description

RAGAnythingConfig reads scalar environment defaults while its module is imported. Loading a .env file afterwards, as application code commonly does, therefore leaves parser, storage, concurrency and processing settings at stale defaults. For example, loading PARSER=docling, MAX_CONCURRENT_FILES=4 and ENABLE_IMAGE_PROCESSING=false after import still constructs a MinerU configuration with concurrency 1 and images enabled.

Use default factories for the scalar environment settings, matching the existing list settings. Each new configuration captures the environment at construction; explicit arguments still take precedence. Existing instances retain their values. Keep the legacy parse-method compatibility path unchanged.

Related Issues

Found during local investigation. Searches for configuration/environment defaults, default_factory, and dotenv found no equivalent pending fix or claimed issue. #315 concerns packaging and other reliability changes, not these defaults.

Validation

At upstream afb67c43d391b1b1008a6fee9f020a232067b9e5, Linux/Python 3.12:

  • Both new regressions fail before the fix.
  • 46 focused/core tests pass after the fix; full suite: 900 passed.
  • Ruff formatting/checks and git diff --check pass.
  • Separate final diff review checked constructor precedence, existing-instance stability, environment cleanup in tests, and unchanged legacy behavior.

Tests import the real config class and load an actual temporary dotenv file. They cover string/integer/boolean values and two configurations constructed under different environments. No live model, external parser executable, or end-to-end ingestion was exercised; other Python/OS combinations await CI.

Checklist

  • Changes tested locally
  • Code reviewed
  • Class documentation updated
  • Unit tests added

Additional Notes

AI assistance: OpenAI Codex investigated, implemented, tested and reviewed this change. No independent human review is claimed.

This branch has not been deployed

No deployments
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