Skip to content
This repository was archived by the owner on Jul 15, 2026. It is now read-only.
This repository was archived by the owner on Jul 15, 2026. It is now read-only.

[bug] db/features.py feature-cache keyed by id() — collision hazard after GC #151

Description

@100yenadmin

Found by: the PR #149 fix-forward (a new test perturbed a stale-cache hit into a non-deterministic ubuntu-py3.13 CI failure).

db/features.py's feature-probe cache is keyed by id() of the connection object. Python reuses id() values after an object is garbage-collected — so a new connection can collide with a GC'd one's cache entry and read stale feature-probe results (e.g. "sqlite-vec available" / FTS5 tokenizer support) for the wrong connection. This is non-deterministic and surfaced as a flaky test in #149 (worked around there by clearing the cache in the test db fixture — a band-aid, not a fix).

Fix: key the cache on something stable for the connection's lifetime (e.g. the resolved DB path + role, or a per-connection attribute set at open time) instead of id(). Audit for the same id()-keying pattern elsewhere.

Target: v0.2.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architecture-reviewFound by the hermes-lcm architecture reviewbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions