Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- Revoke memories, clean up derivatives, and prevent stale data from returning
- Deleting the text and prohibiting its reuse are separate steps. The authoritative revocation state must participate in reads and writebacks before the old replica, otherwise old checkpoints, backfills, or caches will reintroduce deleted facts.
How does the mechanism work?
Step-by-step explanation
- How should the product commitment be defined if the removal coincides with tool shipping?
After deleting copies, examine the race between revocation and dispatch.
- How to prevent tombstone loss during backup and restore?
Recovery may restore stale knowledge of revocations even after physical cleanup.
- What are the costs of the full-scope epoch and the itemized versions?
Move from preventing revoked memory from reappearing to implementable performance trade-offs.
Debugging · Diagnose failures
Diagnose failures · Revoke memories, clean up derivatives, and prevent stale data from returning
Objectives of this level: Produce a causal diagnosis before seeing an explanation and validate a personal repair on identical inputs.
Visual guide · Restore through current authority
Deleting one payload does not invalidate its copies. This local view checks dependencies; atomic cross-service revocation and cleanup are separate design work. Select the figure to open it at full size.
Starting point and observed failure
Complete implementation first; work on a separate copy of your revocation_student.py. Save revocation_lab.py as revocation_lab.py if needed. This is a public diagnostic rehearsal, not proof of diagnosing an unseen incident. The incident uses exactly this starting input:
{
"authority": {
"available": true,
"scope": [
"tenant-a",
"user-1",
"project-1"
],
"epoch": 2,
"sources": {
"s-email": {
"version": 2,
"revoked": true
},
"s-style": {
"version": 1,
"revoked": false
}
},
"memories": {
"m-email": {
"scope": [
"tenant-a",
"user-1",
"project-1"
],
"version": 1,
"source_id": "s-email",
"source_version": 1,
"body": "send email digests"
},
"m-style": {
"scope": [
"tenant-a",
"user-1",
"project-1"
],
"version": 1,
"source_id": "s-style",
"source_version": 1,
"body": "use short paragraphs"
}
}
},
"checkpoint": {
"scope": [
"tenant-a",
"user-1",
"project-1"
],
"epoch": 1,
"refs": [
{
"memory_id": "m-email",
"version": 1
},
{
"memory_id": "m-style",
"version": 1
}
],
"summary": {
"body": "send a short email digest",
"dependencies": [
{
"source_id": "s-email",
"version": 1
},
{
"source_id": "s-style",
"version": 1
}
]
}
},
"candidate": {
"scope": [
"tenant-a",
"user-1",
"project-1"
],
"epoch": 2,
"memory_id": "renamed-email",
"source_id": "s-email",
"source_version": 2,
"body": "send email digests"
}
}
The supplied failure log is:
[
{
"step": "revoke",
"source": "s-email",
"source_version": 2,
"epoch": 2
},
{
"step": "restore",
"cp_epoch": 1,
"context_ids": [
"m-email",
"m-style"
],
"summary": "send a short email digest",
"authority_lookup": false
},
{
"step": "background_write",
"memory_id": "renamed-email",
"read_epoch": 2,
"status": "allow",
"checked": [
"epoch"
]
}
]
Two observed fault fragments are restore: return checkpoint['summary']['body'] and write: allow = candidate['epoch'] == authority['epoch']. The first path skipped authority; the second checked only epoch. The log is fictional and does not mean an email was sent. Use it to identify the earliest wrong decision, not just the final leaked string.
Submit evidence before an optional explanation
python3 revocation_lab.py incident > revocation-incident.json
python3 -c 'from pathlib import Path; Path("revocation_debug_student.py").open("x").write(Path("revocation_student.py").read_text())'
If your module is already green, retain that result as a control. The copy command refuses an existing debug filename. In revocation_debug_student.py inject the observed checkpoint-trust or epoch-only branch, adapting the fragment to your variable names. Label this explicitly as an injected known fault and run:
python3 revocation_lab.py grade --module revocation_debug_student.py --out revocation-debug-before.json --seed 41
Retain this failing report. Before consulting an answer, write diagnosis.md: input/version facts, failing path, competing explanation, and what evidence would distinguish it. Record your initial diagnosis before repair, then fix your debug copy and save repair.diff between its faulty and repaired versions. Do not mutate source labels or suppress failing cases.
python3 revocation_lab.py grade --module revocation_debug_student.py --out revocation-debug-after.json --seed 41
python3 revocation_lab.py explain --diagnosis diagnosis.md --diff repair.diff
The paired before/after grade uses the same seed 41; a repaired conforming module exits 0. explain requires nonempty diagnosis and diff files and records their SHA; it checks presence, not the quality of your diagnosis. Keep the originally recorded diagnosis even if the optional explanation changes your view.
Identify causes and preserve a positive control
The base context should become m-style only with summary null; the renamed-email candidate should be denied/source_revoked. Check a current unrevoked summary too: denying everything is not a repair. An instructor can change which dependency is revoked, keep the epoch unchanged or remove a source before disclosing the new input. Supply a fresh causal explanation and code change if needed. Public logs, guided correct code and a known one-line fix demonstrate reproduction or repair, not independent diagnosis of a new fault. Assess that separately using an unannounced variant and the learner’s reasoning.
No log here proves physical backup cleanup. The same body existing in a checkpoint and being blocked from future context are different facts.
Continue to do advanced research experiments
Why can’t the old context continue to be used after the policy changes?
Transferring pre-retrieval filtered ideas to memory versions and recovery. Observe how existing drafts become invalid after cancellation.
Read full text and fault analysis → · Download experiment package ↓
python3 cli.py memory-put --db memory.sqlite
python3 cli.py submit --db memory.sqlite
python3 cli.py run --db memory.sqlite --lease-seconds 2 --fault after_draft
python3 cli.py memory-forget --db memory.sqlite
# 等待至少 2 秒后分别执行
python3 cli.py run --db memory.sqlite
python3 cli.py inspect --db memory.sqliteKeep evidence and check item by item
- The draft checkpoint already exists after the first exit.
- Recovery after memory-forget gets failed with memory_changed_or_expired.
- No publish checkpoint; explain the difference between fail blocking and complete deletion.
Verify local scope, version, and undo blocking; old checkpoints remain, no complete deletion of logs, backups, or checkpoints is provided.
code example
A failed cleanup worker is a different failure
If authority filtering works but vector cleanup retries fail, future-use blocking can pass while physical cleanup remains pending. Repairing a read path does not justify changing cleanup status to completed.
Acceptance task for this level
Deliver the initial causal diagnosis, faulty/repaired personal diff and same-seed reports; label public rehearsal and injected faults separately from an instructor-selected diagnostic variant.
Reading this browser’s record…
Hide the answer and check your understanding
Both reads used epoch 2. What evidence would separate stale-generation failure from revoked-source reuse?
Expand reference derivation
Inspect the current tombstone and source/version dependency of the candidate or summary. A current epoch with a revoked source rules out epoch freshness as sufficient. Do not infer physical erasure or a remote effect from the context log.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.