fix(openclaw): harden koch agent prompts, clarify wiki_get schema, and document Issue 22

This commit is contained in:
Moritz Graf
2026-10-10 13:06:28 +02:00
parent 6ea08ea497
commit 5b3dfe2a50
3 changed files with 40 additions and 1 deletions
+39
View File
@@ -704,3 +704,42 @@ This document captures fixed issues, operational quirks, and incident root-cause
- Never let recovery scripts silently discard unfulfilled user turns without re-queuing and notifying the user.
- Generously tune probe timeouts and memory cgroup ceilings on nodes with ample headroom (32GB RAM) to survive temporary multi-process activity.
### Issue 22: Split-Turn Context Drift, `wiki_get` Schema Trap & Unanswered Turn Bleed-Through on Koch Agent (Topic 21)
- **Date**: 2026-10-10
- **Severity**: High (User voice note about new porridge recipe was answered with cooking wishlist; recipe was not saved; 70k context token drift; stalled turns bleed into future turns)
- **Symptom**:
Moritz sent a voice note to Topic 21 (`#Kochen` / `agentId: koch`) specifying a new breakfast porridge batch recipe:
_"Ich habe eine neue Porridge-Mischung gemacht. Bitte speichere diese als Rezept auf. Es ist 400 Gramm Haferflocken, 200 Gramm Haferkleie, 50 Gramm Chiasamen, 30 Gramm getrocknete Mango, also gefriergetrocknete Mango, 5 Gramm Zimt und 160 Gramm Eiweißpulver. Speichere das bitte so als Rezept auf: Moritz Porridge-Mischung Oktober 2026. und speichere bitte, merkt ihr quasi, wenn ich sage, ich habe in der Früh meine Porridge-Mischung gemacht, dann meine ich ab sofort diese Mischung. Bitte merkt dir das."_
Instead of saving the recipe and calculating macros, the Koch Agent replied with the open "To-Cook" wishlist (`lists/to-cook.md`), appending `NO_REPLY`.
- **Root Cause**:
1. **Unanswered / Stalled Turn Bleed-Through**:
In a previous turn (Seq 51), Moritz had asked: _"Wir haben eine Liste im Wiki, was wir noch unbedingt kochen wollen. Gib mir doch mal diese Liste aus."_ The agent failed tool executions and timed out at Seq 60 with: _"The tool run finished, but no final summary was produced. I did not repeat any completed actions."_
Because this prior turn never delivered a completed user response, the unfulfilled instruction remained hanging in the conversation history.
2. **Long-Context Attention Drift on GLM-5.3-Flash (>70k Tokens)**:
The session had accumulated **70,974 tokens**. When Moritz sent the new porridge voice note (Seq 61), the agent started processing it (Seq 62), but after one tool read at Seq 63, the LLM drifted back to the unresolved prompt from Seq 51 (Seq 64 Thinking: _"Moritz wants the 'To-Cook' list from the wiki. Search wiki."_). The agent abandoned the porridge recipe completely and spent 30 tool iterations fetching `lists/to-cook.md`.
3. **`wiki_get` Parameter Schema Trap**:
The system prompt did not specify the required argument name for `wiki_get`. The model guessed `path: "lists/to-cook.md"` repeatedly, failing with:
`Invalid arguments for tool "openclaw:memory-wiki:wiki_get": lookup: must have required property 'lookup'; <root>: must not have additional properties: "path".`
- **Resolution**:
1. **Delivered Porridge Recipe & Confirmation**:
- Created `knowledge-wiki/entities/recipes/moritz-porridge-mischung-oktober-2026.md` with full ingredients (400g Haferflocken, 200g Haferkleie, 50g Chia, 30g Mango gefriergetrocknet, 5g Zimt, 160g Eiweißpulver = 845g Gesamtmasse).
- Calculated exact macros: Batch ~3.120 kcal / 219g P / 359g KH / 66g F / 98g Ballaststoffe; Pro 100g ~369 kcal / 25,9g P / 42,5g KH / 7,8g F / 11,6g Ballaststoffe; Pro 65g Portion ~240 kcal / 16,8g P / 27,6g KH / 5,1g F / 7,5g Ballaststoffe.
- Registered food entity `moritz-porridge-mischung-oktober-2026` in `data/entities/foods.jsonl` and recipe in `data/entities/recipes.jsonl`.
- Updated alias in `entities/standard-foods.md` and marked `entities/recipes/muller-protein-porridge.md` as superseded.
- Sent full confirmation directly to Telegram Topic 21 via `openclaw message send` (Message ID 2519).
2. **Prompt Hardening for Topic 21 in `openclaw-instance.secret.yaml`**:
- Fastpath schema clarification:
`- wiki_get: lookup ("lists/to-cook.md" oder "entities/recipes/<slug>.md") – WICHTIG: Das Argument heißt 'lookup', NIEMALS 'path'! Die Wunschliste offener Rezepte liegt unter 'lists/to-cook.md'.`
`- wiki_search: query`
- Strict Turn-Isolation Rule:
`STRIKTE REGEL: IMMER NUR DIE AKTUELLSTE BENUTZERNACHRICHT BEARBEITEN! Wenn ein vorheriger Turn unvollständig war, Tool-Fehler hatte oder abgebrochen wurde, ignoriere ihn komplett. Beantworte und erfülle ausnahmslos und fokussiert den aktuellen Prompt der neuesten Nachricht. Versuche NIEMALS, alte unerledigte Anfragen aus früheren Turns eigenmächtig aufzugreifen oder mit neuen Prompts zu vermischen!`
- Standard breakfast mapping:
`STANDARD-FRÜHSTÜCK MORITZ: Wenn Moritz 'meine Porridge-Mischung' oder 'meinen Porridge' erwähnt, ist ab Oktober 2026 immer 'moritz-porridge-mischung-oktober-2026' gemeint.`
3. **Hard-Reset of Bloated Session**:
- Executed `openclaw sessions delete "agent:koch:telegram:group:-1004326921510:topic:21" --agent koch --yes`, safely archiving the bloated 70k context transcript and resetting the session to 0 tokens for subsequent messages.
- **How to Avoid Recurrence**:
- Always provide exact argument property names in direct tool fastpaths so LLMs do not guess invalid keys like `path` instead of `lookup`.
- Mandate strict turn isolation in agent system prompts to prevent stalled turns from bleeding into new user prompts during context spikes.
- Rely on Tier A daily resets (04:45 CET) for logging/stateful agents whose canonical history is fully externalized in DuckDB, JSONL, and Git.
Binary file not shown.