Skip to content

Pipeline: compression can inflate input; entity extractor floods graph with garbage #20

Description

@codenamekt

Summary

The compression pipeline and entity extractor produce incorrect/garbage output that pollutes storage and the entity graph.

Findings

Compression can output MORE than the input (high)

hexus/pipeline/router.py:111-118_compress_text splits on \n\n; for single-paragraph text (the common shape of a long memory entry) paragraphs[0] is the whole text, and it returns it verbatim plus "\n... [Truncated Text]".

  • Scenario: a 50 KB single-paragraph payload passes through "compression" completely uncompressed, with a misleading truncation marker appended.
  • _compress_json (router.py:57-68) is likewise unbounded: ', '.join(keys) for a 10k-key object, or a 3-key sample whose values are megabyte strings, exceeds the input.

Entity extractor floods the graph with garbage (high)

hexus/entity_extractor.py

  • :12 hostname pattern \b[a-zA-Z0-9]+-[a-zA-Z0-9-]+\b matches every hyphenated word ("well-known", "multi-agent", "re-run" → hostnames). docker_image's \b\w+:\w+\b matches timestamps / key:value prose.
  • version matches inside IP octets (10.0.0.1 → version 10.0.0).
  • :39,56-58 seen is shared across entity types, so a value matching two patterns is classified by whichever regex runs first (dict order) — results depend on insertion order.
  • Scenario: ordinary prose floods the entities table and co-occurrence graph (store.py:776,1410), degrading entity-based recall.

Suggested direction

Make _compress_text/_compress_json actually bound their output (truncate to a target size) and only emit the marker when real truncation happened; tighten the entity regexes (anchor hostnames to a TLD/.; require a registry/tag shape for docker images; exclude IPs from version matches) and make seen per-type; add unit tests (currently none — see the tests issue).

Filed from the 2026-07 codebase review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: pipelineArea: pipelinebugSomething isn't workingcode-reviewFiled from the 2026-07 codebase reviewpriority: highImportant correctness/UX bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions