Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
38 lines
2.1 KiB
Markdown
38 lines
2.1 KiB
Markdown
## honcho-ledger-damaged
|
|
|
|
**What you see.** `memoryd` logs a line naming `memory/honcho.jsonl`, a line number and a reason,
|
|
then this entry:
|
|
|
|
```text
|
|
/srv/bx/memory/honcho.jsonl:12: turn 3 of session chat-1: decided already; see docs/runbook.md#honcho-ledger-damaged
|
|
```
|
|
|
|
**Why.** The ledger is `memoryd`'s record of what it sends to Honcho: one line when a turn or a
|
|
memory write is decided (where it goes, or that it goes nowhere), and one when it is sent or
|
|
refused (M5c spec, section 5). What is decided and not yet sent is the outbox. `memoryd` reads the
|
|
ledger through at start so that it sends nothing twice and nothing to a workspace it was not
|
|
decided for. A line it cannot read, or one that breaks the ledger's rules, could do either, so it
|
|
does not guess: it does not start its Honcho sync, and nothing is decided or sent to Honcho until
|
|
the ledger reads through. The rules: an item is decided once (`decided already`), and it is sent
|
|
or refused once, only after it is decided and only when it was not decided to go nowhere (`not
|
|
waiting to be sent`). A last line cut off by a crash is not damage: `memoryd` drops it and says so
|
|
in its log.
|
|
|
|
**Confirm.** Look at the line named, and at every line of the same item:
|
|
|
|
```sh
|
|
f="$BOXMAKER_HOME/memory/honcho.jsonl"
|
|
sed -n '<line>p' "$f"
|
|
grep -n '"session":"<id>","turn":<n>}' "$f" # a turn; for an edit: '"id":"<id>","part":<n>}'
|
|
```
|
|
|
|
**Fix.** Keep a copy first: `cp -a "$f" "$f.damaged-$(date +%s)"`. The ledger is written only by
|
|
`memoryd`, so a damaged line was changed by hand or by the disk. If you know what the line should
|
|
say, correct it. Otherwise remove it (`sed -i '<line>d' "$f"`), knowing what that costs: a removed
|
|
`sent` or `failed` line means the item is sent again (a turn's messages appear twice in Honcho, a
|
|
conclusion is made twice); a removed `decided` line means the item is decided again, and any
|
|
later `sent` or `failed` line of the same item then breaks the rules, so remove those too. Honcho
|
|
cannot delete a message, so a turn sent twice stays twice.
|
|
|
|
**Check.** `memoryd` starts, and its log has no line with this entry.
|