Skip to content

feat(indexation): disable topic tagging by default#653

Draft
Ahmath-Gadji wants to merge 1 commit into
mainfrom
feat/topic-tagging-off-by-default
Draft

feat(indexation): disable topic tagging by default#653
Ahmath-Gadji wants to merge 1 commit into
mainfrom
feat/topic-tagging-off-by-default

Conversation

@Ahmath-Gadji

@Ahmath-Gadji Ahmath-Gadji commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Why

Topic tagging is currently on by default for every partition, so every indexed document pays an extra LLM call to generate tags that nothing consumes: they are not surfaced in the API and not used in retrieval. The admin UI already acknowledges this — the toggle ships disabled with the hint "Coming soon — generated tags aren't surfaced or used in retrieval yet."

This makes the feature opt-in until it actually ships.

What changed

File Change
core/config/indexation_pipeline.py enable_topic_tagging default TrueFalse
services/orchestrators/preset_service.py seeded default indexation preset sets it False
services/workers/indexer_pool.py _required_llm_names no longer resolves an LLM for an absent key
services/workers/indexer_actor.py _replace_topic_tags_if_needed treats an absent key as disabled
ui/src/pages/admin/presets.tsx toggle fallback truefalse, matching the backend

Reviewer note — one behavior change beyond the flag

_replace_topic_tags_if_needed previously purged tags only when a preset set enable_topic_tagging explicitly to False. Now that an absent key means disabled, the purge must apply to absent-key presets too (legal, finance) — otherwise they would silently stop tagging but never clear tags written by an earlier run.

The cost is one indexed DELETE FROM topic_tags WHERE document_id = ? AND partition = ? per indexed document on the (now default) disabled path. It is a no-op for fresh files. Happy to scope it back to is False semantics if you'd rather not pay that on the hot path, at the price of leaving stale tags unreachable for those two presets.

Upgrade impact

Existing deployments keep their current behavior. seed_defaults() only inserts when a preset type has zero rows, so a database that already seeded default with tagging on retains it. Only fresh deployments get the new default. Operators who want tagging back set enable_topic_tagging: true on the partition's indexation preset.

Testing

  • Added test_indexation_pipeline_topic_tagging_defaults_off pinning the model default.
  • Added test_seed_defaults_indexation_leaves_topic_tagging_off covering the seeded presets.
  • Updated test_required_llm_names_mirrors_pipeline_selection{} now resolves no LLM, and an explicit True still resolves default.
  • uv run pytest tests/unit/ → 1663 passed. The 2 failures in tests/unit/api/middleware/test_rate_limit.py are timing-flaky and reproduce unchanged on origin/main.
  • uv run ruff check / format --check clean.

Summary by CodeRabbit

  • Bug Fixes

    • Topic tagging now starts turned off by default across the app, unless explicitly enabled.
    • Re-indexing now correctly clears old topic tags when the feature wasn’t enabled for that preset.
    • Required model selection now reflects the new default and won’t treat topic tagging as active unless it’s enabled.
  • Tests

    • Updated coverage to verify the new default behavior in configuration, preset seeding, and model selection.

Topic tagging ran on every indexed document, spending one LLM call per
file to produce tags that nothing consumes yet — they are not exposed in
the API and not used in retrieval. The admin UI already ships the toggle
as disabled with a "Coming soon" hint.

Make it opt-in instead:

- IndexationPipelineConfig.enable_topic_tagging defaults to False
- the seeded `default` indexation preset sets it False explicitly
- _required_llm_names no longer resolves an LLM endpoint for an absent key
- _replace_topic_tags_if_needed treats an absent key as disabled, so a
  re-index under a preset that never enabled tagging clears tags left
  behind by an earlier run
- the admin UI toggle falls back to off, matching the backend

Existing deployments are unaffected: seed_defaults only inserts when a
preset type has no rows, so a stored preset with tagging on keeps it on.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d7f6ad23-fb87-4b39-90a6-ad0b9aae6946

📥 Commits

Reviewing files that changed from the base of the PR and between a128424 and df5861a.

📒 Files selected for processing (8)
  • openrag/core/config/indexation_pipeline.py
  • openrag/services/orchestrators/preset_service.py
  • openrag/services/workers/indexer_actor.py
  • openrag/services/workers/indexer_pool.py
  • tests/unit/core/config/test_pipeline_configs.py
  • tests/unit/services/orchestrators/test_preset_service.py
  • tests/unit/services/workers/test_indexer_pool.py
  • ui/src/pages/admin/presets.tsx

📝 Walkthrough

Walkthrough

Changes the default value of enable_topic_tagging from True to False across the indexation pipeline config, preset seed data, indexer worker gating logic (both tag replacement and required LLM resolution), and the admin UI toggle, with corresponding unit test updates.

Changes

Topic Tagging Default Flip

Layer / File(s) Summary
Pipeline config and preset seed defaults
openrag/core/config/indexation_pipeline.py, openrag/services/orchestrators/preset_service.py, tests/unit/core/config/test_pipeline_configs.py, tests/unit/services/orchestrators/test_preset_service.py
enable_topic_tagging default changes from True to False in IndexationPipelineConfig and in the seeded indexation.default preset, verified by new tests asserting the field and seeded presets default to disabled.
Indexer worker gating logic
openrag/services/workers/indexer_actor.py, openrag/services/workers/indexer_pool.py, tests/unit/services/workers/test_indexer_pool.py
_replace_topic_tags_if_needed now treats a missing enable_topic_tagging key as disabled (clearing stale tags on re-index), and _required_llm_names no longer requires the topic-tagging LLM endpoint when the flag is absent; test expectations updated accordingly.
Admin UI toggle default
ui/src/pages/admin/presets.tsx
The “Topic tagging” toggle in the preset admin page now defaults to false when config.enable_topic_tagging is unset.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant IndexerActor
  participant PipelineOutput
  participant IndexerPool

  IndexerActor->>IndexerActor: read indexation_config.enable_topic_tagging
  IndexerActor->>PipelineOutput: check topic_tags presence
  IndexerActor->>IndexerActor: treat missing/falsy flag as disabled, clear stale tags
  IndexerPool->>IndexerPool: _required_llm_names checks enable_topic_tagging (default False)
  IndexerPool->>IndexerPool: exclude topic_tagging_llm when disabled
Loading

Possibly related PRs

  • linagora/openrag#621: Both PRs touch the topic-tagging flow — this PR disables topic tagging by default and adjusts indexer gating/LLM requirements, while the related PR changes error handling in TopicTagger.tag().

Suggested labels: `admin-ui`

Suggested reviewers: `andyne13`

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely states the main change: topic tagging is now disabled by default for indexation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/topic-tagging-off-by-default

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the admin-ui Admin UI label Jul 9, 2026
@Ahmath-Gadji Ahmath-Gadji marked this pull request as draft July 10, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admin-ui Admin UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant