Files
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

92 lines
5.4 KiB
Plaintext

Query: # Seventh independent review: idempotent request rebuilds
The fourth terminal acceptance review rejected the candidate after all focused
tests passed. Continue the same self-update and correct this retry-path defect:
- `append_persistent_model_status()` is not idempotent when the same newest
message is used to build another request (for example, a transient provider
failure, empty-response retry, or request rebuild before a new transcript
message). It computes `updated = base + "\n\n" + status` from wire content
that already contains the previous projection, so every rebuild adds another
`<agent_status>` block.
- A direct production-helper exercise repeated the call 20 times and produced
20 status blocks, changing previously sent bytes and violating both the
prompt-cache stability claim and the total output bound.
- Current tests always append a new transcript message before the next build
and therefore miss same-message retries.
Make projection idempotent at the production persistence boundary. Preserve an
unmodified base sidecar or safely recognize/replace only a status projection
owned by this feature; do not delete user-authored text that merely resembles
status markup. Decide and document whether volatile status values remain fixed
for a retry of the same message or can be replaced, but previously sent prefix
bytes must not drift unexpectedly. Keep clean transcript content unchanged,
retain string-only fail-closed behavior, and durably persist the selected
sidecar by stable row identity.
Add a regression test that repeatedly builds requests with unchanged source
messages, including a persisted/reloaded case. Assert identical wire bytes and
exactly one owned status block. Retain realistic tool-call placement,
persistence-reload, adversarial-bound, and unsupported-type coverage.
Run the focused tests, existing sidecar/cache/turn-context regressions,
compilation, and `git diff --check`. Update `BOOK_SELF_EVOLUTION_REPORT.md` with
this seventh review and exact results. Do not edit the book, commit, push, or
claim downstream task improvement.
Initializing agent...
↻ Resumed session 20260802_031522_523cd2 (7 user messages, 191 total messages)
────────────────────────────────────────
┊ 💻 preparing terminal…
┊ 💻 $ python3 - <<'PY' from pathlib import Path for f in ['agent/model_status_context.py','tests/agent/test_model_status_context.py']: print('\n###',f) + 1 command 0.0s
┊ 💻 preparing terminal…
┊ 💻 $ python3 - <<'PY' from pathlib import Path p=Path('agent/model_status_context.py') + 3 commands 1.2s
┊ 💻 preparing terminal…
┊ 💻 preparing terminal…
┊ 💻 preparing terminal…
┊ 💻 $ uv run --with pytest pytest tests/agent/test_api_content_sidecar.py tests/run_agent/test_background_review_cache_parity.py tests/agent/test_turn_context.py -q 10.4s
┊ 💻 $ python3 -m py_compile agent/model_status_context.py agent/conversation_loop.py agent/agent_init.py run_agent.py hermes_state.py + 1 command 0.1s
┊ 💻 $ git status --short + 1 command 0.0s
┊ 💻 preparing terminal…
┊ 💻 $ python3 - <<'PY' from pathlib import Path p=Path('BOOK_SELF_EVOLUTION_REPORT.md') + 5 commands 0.1s
╭─ ⚕ Hermes ───────────────────────────────────────────────────────────────────╮
Corrected the seventh-review idempotency defect.
Changes:
- Status projections are now idempotent for the same message.
- The first non-empty string api_content sidecar is treated as the feature-owned projection and reused verbatim on retries, including after database reload.
- Later volatile status values are deliberately ignored for that message, preserving previously sent bytes.
- User-authored status-looking text in clean transcript content is never parsed or removed.
- Stable row-identity backfill remains supported through update_message_api_content().
- Added a regression test that:
- rebuilds the same request 20 times;
- checks identical wire bytes;
- checks exactly one <agent_status> block;
- closes and reopens SessionDB;
- repeats the assertions after reload.
- Retained realistic tool-call placement, persistence reload, output bounds, and unsupported-type tests.
Verification:
- uv run --with pytest pytest tests/agent/test_model_status_context.py -q
- Passed: 7 passed in 0.84s
- uv run --with pytest pytest tests/agent/test_api_content_sidecar.py tests/run_agent/test_background_review_cache_parity.py tests/agent/test_turn_context.py -q
- Passed: 36 passed in 9.42s
- python3 -m py_compile agent/model_status_context.py agent/conversation_loop.py agent/agent_init.py run_agent.py hermes_state.py
- Passed.
- git diff --check
- Passed.
BOOK_SELF_EVOLUTION_REPORT.md includes the seventh review round and exact results. No book changes, commit, push, or downstream task-improvement claim was made.
╰──────────────────────────────────────────────────────────────────────────────╯
Resume this session with:
hermes --resume 20260802_031522_523cd2
Session: 20260802_031522_523cd2
Duration: 42s
Messages: 203 (8 user, 187 tool calls)