You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
knowledge: a Postgres outage now makes the knowledge base read-only — decide whether that is the intended degradation #15741
Since #15663 (PR #15668, 324fde1a), a knowledge fact is written to Postgres before its Redis projection, and that write is deliberately allowed to raise:
store_fact's outer handler turns a raised exception into {"status": "error"}. update_fact and delete_fact behave the same way through _durable_update_or_adopt / _durable_delete.
So when Postgres is unavailable, the knowledge base can no longer accept, update or delete facts — where previously Redis alone was enough. Reads still work: _read_fact_for_write serves from the Redis projection first.
This is intentional and I would not revert it blind — reporting a fact as stored when it reached only a cache is exactly the shape of #12733, and Postgres is unconditional in every deployment (user_management/config.py:173, #10636). But it is an availability change that was never stated in the PR, and nobody has decided whether it is the behaviour we want under a Postgres outage.
The question to settle
Three defensible answers, and the code currently implements the first by default rather than by decision:
Fail the write (today). Correct, and the user is told immediately. A Postgres blip makes the KB read-only.
Degrade explicitly. Accept the write to Redis, mark the fact as not-yet-durable, and surface that state in the UI rather than silently. Honest, but a fact that is visibly "at risk" is a product decision, not just an engineering one.
Acceptance criteria
The chosen behaviour is recorded in autobot_shared/store_authority.py's knowledge_facts entry, so the next reader learns it from the table rather than from a traceback.
Whatever is chosen is covered by a test that exercises the Postgres-unavailable path — there is none today; every existing test mocks the durable store.
If (1) stands, the user-facing error says the knowledge base is temporarily read-only rather than the current generic "Knowledge operation failed", which reads as data corruption.
If (2) or (3), the intermediate state has a declared system of record like any other persisted concept.
Summary
Since #15663 (PR #15668,
324fde1a), a knowledge fact is written to Postgres before its Redis projection, and that write is deliberately allowed to raise:store_fact's outer handler turns a raised exception into{"status": "error"}.update_factanddelete_factbehave the same way through_durable_update_or_adopt/_durable_delete.So when Postgres is unavailable, the knowledge base can no longer accept, update or delete facts — where previously Redis alone was enough. Reads still work:
_read_fact_for_writeserves from the Redis projection first.This is intentional and I would not revert it blind — reporting a fact as stored when it reached only a cache is exactly the shape of #12733, and Postgres is unconditional in every deployment (
user_management/config.py:173, #10636). But it is an availability change that was never stated in the PR, and nobody has decided whether it is the behaviour we want under a Postgres outage.The question to settle
Three defensible answers, and the code currently implements the first by default rather than by decision:
Acceptance criteria
autobot_shared/store_authority.py'sknowledge_factsentry, so the next reader learns it from the table rather than from a traceback.Related