| 1 | # Delegated note retry and authority hardening |
| 2 | |
| 3 | Status: implementation design approved by GPT-6 Astra on 2026-10-25 after |
| 4 | reviewing the existing Memoria, Calendar and Calls adapters. Source review, |
| 5 | CI and deployed canary verification remain separate requirements. |
| 6 | |
| 7 | Persist a keyed receipt-authority marker binding the content fingerprint key, |
| 8 | exact Home issuer, delegation issuer and selected team. Initialize under the |
| 9 | SQLite writer reservation only if receipt and attribution state is empty. Check |
| 10 | on enablement and every mutation before receipt lookup. Existing receipt state |
| 11 | without the marker requires explicit migration; do not bless, erase or reset it. |
| 12 | Include both issuers in new receipt coordinates. |
| 13 | |
| 14 | The HTTP adapter supplies a private context callback using only the original |
| 15 | credential's underlying verifier. Compare subject, client, grant and required |
| 16 | team/scope. Never invoke local-DB/rate-limit middleware from inside the writer |
| 17 | transaction. Check delegation and the existing local Home link/admission using |
| 18 | the reserved transaction, then repeat before every successful commit, including |
| 19 | retry exits. An absent callback fails closed on agent mutations. Reject malformed |
| 20 | Unicode before lossy decoding. |
| 21 | |
| 22 | Memoria's current Ingest is an upsert. A guard alone cannot make pending receipt |
| 23 | recovery safe: after body commit but before receipt completion, retrying that |
| 24 | upsert can overwrite intervening edits or recreate a deleted note. The delegated |
| 25 | creation path must commit the document/chunks and receipt document ID together. |
| 26 | Keep public Ingest behavior; factor its transaction body into an inner function |
| 27 | surrounded by private required agent hooks. All early successes pass the final |
| 28 | hook. The before hook reserves the writer, validates marker and authority, claims |
| 29 | and rereads the receipt. Completed receipts skip ingestion entirely, check the |
| 30 | referenced document still exists, and preserve current edits/revision. Deletion |
| 31 | returns not_found. For an incomplete receipt, refuse if source/key already exists; |
| 32 | agent creation must never upsert even matching content. |
| 33 | |
| 34 | Indexing remains derived postcommit work. Preserve committed IDs on index failure. |
| 35 | A skipped ingestion does not prove indexing succeeded. Any repair uses current |
| 36 | stored content, never the old request body. Keep indexed false until indexing |
| 37 | actually succeeds; no success-looking result for a deleted document. |
| 38 | |
| 39 | Test crash/reopen at receipt/body/index boundaries, independent concurrent |
| 40 | requests, deletion and edits before retry, orphan source/key refusal, changed |
| 41 | key/authority refusal, and revocation while waiting for the writer and just before |
| 42 | commit. Adverse mutations must fail meaningful behavior tests. Source approval |
| 43 | and checks do not claim a deployed canary. |
| 44 | |
| 45 | The same immutable-marker and writer-boundary pattern applies to Calendar and |
| 46 | Calls in their own adapters. Existing direct Registry.HTTP read emission remains |
| 47 | a separate response-revalidation gap; this write-hardening slice does not claim |
| 48 | Docs-equivalent response guards or full suite completion. |
| 49 | |