Skip to content

v0.3.2 — dead letters expire and redrive themselves; amem captures mid-turn messages

Choose a tag to compare

@github-actions github-actions released this 21 Oct 04:12
· 37 commits to main since this release
Immutable release. Only release title and notes can be modified.
a3235c1

Why this release

Dead letters no longer pile up. Before 0.3.2:

  • nothing ever removed a dead letter;
  • nothing requeued one after its cause had passed;
  • most distillation time on agentic CLIs went to retrying tool refusals that could never succeed.

Also, amem now captures what you type while Claude Code is still working. Those messages used to be missing from memory.

Upgrading

No data or configuration changes are required. From 0.3.x:

git fetch --tags && git checkout v0.3.2
./upgrade.sh

Then update amem on each client machine to get the capture fix (REMOTE-CLIENTS §4).

Note: dead letters written before 0.2.3 carry no time. The first sweep after the upgrade treats them as older than a day and removes them. Redrive any you still want before upgrading. Their failures stay in the generation logs.

What's new

Dead letters look after themselves (#41). A sweeper runs every 5 minutes:

A dead letter… What happens
first failed more than a day ago, or was redriven 3 times removed; the generation logs keep its failures and input ids
failed for a passing reason (quota, timeout, outage, an invalid answer) redriven on its own after 1 h, then 2 h, then 4 h; at most 10 per sweep
was refused a tool call (#37) kept until the configured model changes, then redriven like the others
  • A refused tool call is no longer retried: L1/L2 drop the input at once instead of after three ~45 s attempts.

  • Dead letters now record their model, their re-runs and when they first failed. The Panel shows re-runs, and /health counts redriven and expired letters.

  • A redrive whose queue write failed could lose the rest of its batch. Every letter not yet queued is now kept.

  • New settings in the worker section (defaults in brackets):

    • deadLetterTtlHours (24);
    • deadLetterMaxRedrives (3);
    • deadLetterRedriveAfterMinutes (60);
    • deadLetterSweepSeconds (300);
    • deadLetterRedriveBatch (10).

    See docs/ops/DISTILLATION.md §5.

amem captures messages sent while Claude Code is working (#40, @blackhorseya). Claude Code records them as queued_command attachments, not user entries.

  • They are captured as part of the current turn, with their own timestamp.
  • Task notifications and messages from other sessions are not captured.
  • With skip_prompt_prefixes, a matching message dropped mid-turn is skipped on its own, and the turn around it is kept.

Thanks to @blackhorseya for #40 and for the review of #41.

All changes since v0.3.1: #40 and #41, plus the version bump #42. Compare v0.3.1…v0.3.2


為什麼要發這個版本

Dead letter 不會再一直累積。 0.3.2 之前:

  • dead letter 從來不會被移除;
  • 失敗原因消失後,也不會被重新排回佇列;
  • 使用會主動用工具的 CLI 時,大部分蒸餾時間都花在重試「工具被拒絕」上,而這種重試永遠不會成功。

另外,amem 現在會擷取你在 Claude Code 工作期間輸入的訊息,這些訊息以前都沒有進入記憶。

升級

不需要改動資料或設定。從 0.3.x 升級:

git fetch --tags && git checkout v0.3.2
./upgrade.sh

接著更新每台 client 機器上的 amem,才會套用擷取的修正(REMOTE-CLIENTS 第 4 節)。

注意: 0.2.3 以前寫入的 dead letter 沒有時間紀錄。升級後第一次清理會把它們當成已超過一天,直接移除。如果還有想保留的,請在升級之前先重跑。它們的失敗紀錄仍保留在生成紀錄中。

新功能

Dead letter 會自動處理(#41)。每 5 分鐘清理一次:

Dead letter 的狀況 處理方式
第一次失敗超過一天,或已重跑 3 次 移除;生成紀錄仍保留它的失敗原因和輸入 id
暫時性失敗(額度、逾時、服務中斷、回應無效) 1 小時後自動重跑,之後間隔 2 小時、4 小時;每次最多 10 筆
工具被拒絕(#37) 保留到設定的模型變更後,再像其他 dead letter 一樣重跑
  • 工具被拒絕時不再重試:L1/L2 直接 drop 這一批,不必再試 3 次、每次約 45 秒。

  • Dead letter 會記錄失敗時的模型、重跑次數和第一次失敗的時間。Panel 會顯示重跑次數,/health 會統計自動重跑和到期移除的數量。

  • 修正重跑時寫入佇列失敗、同一批其餘 dead letter 會遺失的問題。現在所有還沒排入的都會保留。

  • worker 區段新增以下設定(括號內為預設值):

    • deadLetterTtlHours(24);
    • deadLetterMaxRedrives(3);
    • deadLetterRedriveAfterMinutes(60);
    • deadLetterSweepSeconds(300);
    • deadLetterRedriveBatch(10)。

    詳見 docs/ops/DISTILLATION.zh-tw.md 第 5 節。

amem 會擷取 Claude Code 工作期間送出的訊息(#40,@blackhorseya)。Claude Code 把這些訊息記成 queued_command 附件,而不是一般的使用者訊息。

  • 現在它們會當成目前這一輪的一部分被擷取,並保留各自的時間。
  • task notification 和其他 session 傳來的訊息不會被擷取。
  • 使用 skip_prompt_prefixes 時,符合前綴的插話只略過那一則,不影響它所在的那一輪。

感謝 @blackhorseya 貢獻 #40,並仔細 review 了 #41。

v0.3.1 之後的所有變更:#40、#41,以及版號更新 #42。比較 v0.3.1…v0.3.2