honcho/src
Eri Barrett f20a13926e
fix(dedup): reinforce times_derived on duplicate detection (#768)
* fix(dedup): reinforce times_derived on duplicate detection

times_derived was never incremented: the reject-new branch dropped the
reinforcement and the new-wins branch reset the count to 1, so the column
stayed pinned at 1 for nearly every conclusion. With every value equal,
ORDER BY times_derived DESC resolved to arbitrary heap order (oldest rows
first), which froze stale conclusions to the front of injected context.

- reject-new: increment existing_doc.times_derived
- new-wins: carry existing count forward onto the replacement
- add created_at DESC tiebreaker to both most_derived queries

* test(dedup): guard times_derived reinforcement + recency tiebreak

Three regression tests, each fails on pre-fix code:
- most-derived ties break toward recency, not insertion order
- rejecting a duplicate reinforces the surviving doc
- a winning duplicate inherits the replaced doc's count + 1

* fix(dedup): atomic reinforcement increment + deterministic tiebreak

---------

Co-authored-by: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com>
2026-06-11 12:37:19 -04:00
..
cache perf: add redis caching and reduce embedding API calls (#372) 2026-02-13 00:53:46 -05:00
crud fix(dedup): reinforce times_derived on duplicate detection (#768) 2026-06-11 12:37:19 -04:00
deriver add read db (#773) 2026-06-10 13:28:36 -04:00
dialectic add read db (#773) 2026-06-10 13:28:36 -04:00
dreamer fix: reframe peer card prompts as stable identity markers (#686) 2026-05-21 13:25:34 -04:00
llm fix: reframe peer card prompts as stable identity markers (#686) 2026-05-21 13:25:34 -04:00
reconciler feat: defer embedding messages (#704) 2026-06-11 10:31:04 -04:00
routers feat: defer embedding messages (#704) 2026-06-11 10:31:04 -04:00
schemas fix: private ip address check for webhook creation (#793) 2026-06-11 10:35:20 -04:00
startup Make embeddings configurable (#678) 2026-05-14 15:03:35 -04:00
telemetry feat: defer embedding messages (#704) 2026-06-11 10:31:04 -04:00
utils add read db (#773) 2026-06-10 13:28:36 -04:00
vector_store feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
webhooks Tighten Transaction Scopes (#525) 2026-04-08 11:14:50 -04:00
__init__.py v0.0.8 Documentation Updates (#55) 2024-05-15 00:07:25 -04:00
_version.py feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
config.py feat: defer embedding messages (#704) 2026-06-11 10:31:04 -04:00
db.py add read db (#773) 2026-06-10 13:28:36 -04:00
dependencies.py add read db (#773) 2026-06-10 13:28:36 -04:00
embedding_client.py feat: defer embedding messages (#704) 2026-06-11 10:31:04 -04:00
exceptions.py Turbopuffer and LanceDB Integration (#287) 2026-01-16 17:04:01 -05:00
main.py feat(config): make CORS allowed origins configurable via env (#697) 2026-06-09 13:49:46 -04:00
models.py Make embeddings configurable (#678) 2026-05-14 15:03:35 -04:00
security.py fix: Various Codex Audits (#386) 2026-02-13 12:00:15 -05:00