Repository navigation
fix(diagnostics): classify encrypted-database open failures and surface damaged receipt chains - #310
Open
Coding-Dev-Tools wants to merge 2 commits into
Open
Coding-Dev-Tools wants to merge 2 commits into
Coding-Dev-Tools wants to merge 2 commits into
Conversation
A user-host report showed a forked receipt chain followed by the provider going unavailable with EncryptionError. Since 1.7.6 receipt damage is audit-only, but there was no supported way to see it outside the host log, and every encrypted-open failure was reported as a wrong key. Extract receipt_chain_state/verify_receipt_chain so the install doctor verifies chains read-only through its own connection and reports damage with recovery guidance, bounded to 20k receipts and 25 scopes. Classify EncryptionError with stable codes; driver text is still never rendered because it can echo paths or the PRAGMA key. Refresh the checksum-bound offline evidence artifact and its rendered SVG/PNG surfaces because tracked producer files changed. Refs discussion #151. Agent: opencode
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Main now carries the 1.7.12 release, the sync/manifest hardening, and the canonical evidence artifact. Rebind the receipt-diagnostics evidence to the three producer files main changed (__init__, routes/v2_api, chunking_eval), recompute the suite digest and artifact SHA, and repin the README, benchmark guide, tests, and both rendered SVG/PNG pairs. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A user report (discussion #151) shows a forked receipt chain (
sqlite3.IntegrityError: receipt chain has no unique structural head) followed by the host marking the provider unavailable withEncryptionError. On currentmainthe receipt failure is already audit-only (since 1.7.6): remember/recall complete with a content-freereceipt_warning. Two operator-facing gaps remained:EncryptionErrorwith a "wrong key" message, so a damaged database looked like a key problem.What changed
engraphis/backends/encrypted_db.py:EncryptionErrorgains a machine-readablecode. Open failures are classified asdatabase_damaged,database_busy,database_unavailable,key_rejected,key_config_invalid,key_file_empty,key_file_unreadable, anddriver_missing. Driver text is still never rendered; classification only inspects stable SQLite phrases.engraphis/core/store.py:receipt_chain_state/verify_receipt_chainare extracted so read-only diagnostics can verify a chain through their own connection. TheStoremethods delegate to the same implementation; behavior is unchanged.scripts/init.py:engraphis-init --checkverifies current-schema receipt chains read-only, bounded to 20,000 receipts and 25 workspace scopes, and reports damage with recovery guidance instead of a bare integrity error.docs/RECALL_RECOVERY.mdgains a receipt-chain recovery runbook and an encryption-code table;docs/SQLITE_DURABILITY.mddocuments the replace-a-database-under-a-writer hazard.docs/benchmark-evidence/offline-fixtures-receipt-diagnostics-20261103.json, SHA-2567679701565f8897a12bb9d7f65918d8faa1d694757957b8628ef635b640a9bed), andBENCHMARKS.md,README.md,tests/test_benchmark_evidence.py, and the two rendered report images are updated to that digest. The numeric results are unchanged; only the artifact identity moved.CHANGELOG.mdentries under Unreleased.Notes
receipt: nullplusreceipt_warning), and memory writes/recall keep working.Validation
ruff check .passed.python -m pytest tests/test_receipts.py tests/test_init.py tests/test_encryption_dependency.py tests/test_benchmark_evidence.py -qpassed.python -m pytest tests/ -q -n 4with an isolated offline config (no local LLM/config.env, approved index roots) passed; the pytestlastfailedcache was empty afterward.python -m pyright(project venv) passed.eval.harness(sample and codemem),eval.ablation,eval.grounded,eval.adversarial_memory_security, andeval.code_armpassed.engraphis-init --check; it reports[FAIL] operation receipts ...whileMemoryService.remember/recallstill complete withreceipt_warning.Refs discussion #151. Merge is left to the maintainer; no merge, release, or deployment action is included.