Files
ai-agent-book/chapter9/hermes-self-evolution/review_task_6.md
T
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

2.1 KiB
Raw Blame History

Sixth independent review: persisted-row backfill

The third terminal acceptance review rejected the current candidate despite all focused tests passing. Continue the same self-update and correct this exact persistence-boundary defect:

  • append_persistent_model_status() mutates the newest message's in-memory api_content after that message has normally already been persisted. The turn-start user row is flushed before API-message construction (agent/turn_context.py around 12191235), and assistant/tool rows are incrementally flushed before tool execution (agent/conversation_loop.py around 61786185). The status is appended later around 16001612.
  • _flush_messages_to_session_db_unlocked() deliberately skips messages with _db_persisted, and the new path has no update/backfill operation. The sidecar therefore survives within the current process but disappears after restart/session reload, changing the provider prefix across process boundaries.
  • Existing set_latest_user_api_content() only updates the latest user row, is not called by the status path, and cannot cover a tool-result target.

Implement the smallest safe durable update at Hermes' existing string-only database boundary. Do not widen the sidecar type or mutate clean transcript content. Preserve role/tool ordering and fail closed for unsupported content. Use stable row identity or another production-supported mechanism; do not rely on list position if it could update the wrong persisted message.

Add a behavior test that persists a realistic user → assistant tool-call (content=None) → string tool-result sequence, attaches status to the newest tool evidence, reloads it through the real state/session path, and asserts the same string sidecar and byte-identical replay after reload. The test must fail if only the in-memory dictionary was changed.

Run the focused tests, existing sidecar/cache/turn-context regressions, compilation, and git diff --check. Update BOOK_SELF_EVOLUTION_REPORT.md with this sixth review and exact results. Do not edit the book, commit, push, or claim downstream task improvement.