Skip to content

bug(analytics): the config-duplicate detector groups by literal value only and treats a stale directory list as the SSOT — 96 'duplicates' on AutoBot itself, mostly coincidental numbers #19728

Open

Description

@mrveiss

Problem

Codebase Analytics' "duplicate config values" report, run on the AutoBot repo itself on 2026-10-26, returned duplicates_found: 96. Most of those groups are not duplicates, and the report flags the SSOT files themselves. The result reads as 96 problems when the real ones are a handful.

Root cause

Both causes are in autobot-backend/api/codebase_analytics/config_duplication_detector.py.

  1. It groups by literal value only. self.config_values: Dict[any, List[...]] (line 184) is keyed by the value, so any two fields that happen to share a number become one "duplicate". Examples from the report:

    • 2000: ssot_config.py:310 (cognifier_batch_max_chunk_chars) and ssot_constants.py:179 (RAG_CONTEXT_LOW_COMPLEXITY)
    • 60000: ssot_config.py:682 (frontend api timeout) and agent_loop/types.py:190 (iteration_timeout_ms)
    • 3 × 33, 5 × 27, 10 × 25, 300 × 31: unrelated retry counts, limits and TTLs

    The hand-kept CONTEXT_SPECIFIC_VALUES / IGNORE_VALUES lists (around lines 74-103) try to patch this one number at a time.

  2. Its idea of the source of truth is stale. SOURCE_DIRS = {"src/constants", "backend/constants"} (line 117). The real SSOT is autobot_shared/ssot_config.py and autobot_shared/ssot_constants.py. _is_source_of_truth (line 221, used at lines 407-408) never matches them, so SSOT definitions are reported as duplicates of themselves. ssot_config.py appears in almost every group.

Fix

  • Group candidates by (normalised field or constant name, value). A value-only match is at most a low-confidence hint, and only when the names are semantically related (same stem, or the existing LLM-equivalence step).
  • Derive the source-of-truth set from the SSOT modules themselves, not a hardcoded directory list. A value defined in the SSOT and repeated elsewhere is a finding that points at the SSOT symbol to reuse.
  • Retire the per-number ignore lists once grouping is by name.

Acceptance criteria

  • A known-answer test: two unrelated fields that share a value produce no finding, and a re-hardcoded copy of an SSOT constant produces one finding that names the SSOT symbol.
  • The SSOT files are never listed as duplicate locations. A test pins this.
  • A re-run on this repo reports far fewer groups than 96, and every reported group is a real same-concept duplicate (sample-checked in the PR).

Activity

  1. added
    bugSomething isn't working
    phase:M1.8Knowledge base: upload, web sources and chat retrieval work end to end
    on Oct 26, 2026
  2. mrveiss commented on Oct 26, 2026

    @mrveiss
    OwnerAuthor

    Full report from the live endpoint, for source 88831f3d (the AutoBot repo itself): 96 groups / 562 locations, and 58 of the 96 groups list an SSOT file as a duplicate location. A name+value scan of the same tree finds 30 real groups / 57 re-hardcoded locations (#19730). That gap is the false-positive rate this issue removes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugSomething isn't workingphase:M1.8Knowledge base: upload, web sources and chat retrieval work end to endpriority: medium

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions