mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 05:02:04 +03:00
Gateway: fix post-compaction amnesia for injected messages (#12283)
* Gateway: preserve Pi transcript parentId for injected messages Thread: unknown When: 2026-02-08 20:08 CST Repo: https://github.com/openclaw/openclaw.git Branch: codex/wip/2026-02-09/compact-post-compaction-parentid-fix Problem - Post-compaction turns sometimes lost the compaction summary + kept suffix in the *next* provider request. - Root cause was session graph corruption: gateway appended "stopReason: injected" transcript lines via raw JSONL writes without `parentId`. - Pi's `SessionManager.buildSessionContext()` walks the `parentId` chain from the current leaf; missing `parentId` can sever the active branch and hide the compaction entry. Fix - Use `SessionManager.appendMessage(...)` for injected assistant transcript writes so `parentId` is set to the current leaf. - Route `chat.inject` through the same helper to avoid duplicating the broken raw JSONL append logic. Why This Matters - The compaction algorithm may be correct, but if the leaf chain is broken right after compaction, the provider payload cannot include the summary/suffix "shape" Pi expects. Testing - pnpm test src/agents/pi-embedded-helpers.post-compaction-shape.test.ts src/agents/pi-embedded-runner/run.overflow-compaction.post-context.test.ts - pnpm build Notes - This is provider-shape agnostic: it fixes transcript structure so Anthropic/Gemini/etc all see the same post-compaction context. Resume - If post-compaction looks wrong again, inspect the session transcript for entries missing `parentId` immediately after `type: compaction`. * Gateway: guardrail test for transcript parentId (chat.inject) * Gateway: guardrail against raw transcript appends (chat.ts) * Gateway: add local AGENTS.md note to preserve Pi transcript parentId chain * Changelog: note gateway post-compaction amnesia fix * Gateway: store injected transcript messages with valid stopReason * Gateway: use valid stopReason in injected fallback
This commit is contained in:
@@ -27,6 +27,7 @@ Docs: https://docs.openclaw.ai
|
||||
- Cron: route text-only isolated agent announces through the shared subagent announce flow; add exponential backoff for repeated errors; preserve future `nextRunAtMs` on restart; include current-boundary schedule matches; prevent stale threadId reuse across targets; and add per-job execution timeout. (#11641) Thanks @tyler6204.
|
||||
- Subagents: stabilize announce timing, preserve compaction metrics across retries, clamp overflow-prone long timeouts, and cap impossible context usage token totals. (#11551) Thanks @tyler6204.
|
||||
- Agents: recover from context overflow caused by oversized tool results (pre-emptive capping + fallback truncation). (#11579) Thanks @tyler6204.
|
||||
- Gateway: no more post-compaction amnesia; injected transcript writes now preserve Pi session `parentId` chain so agents can remember again. Thanks @Takhoffman 🦞.
|
||||
- Telegram: render markdown spoilers with `<tg-spoiler>` HTML tags. (#11543) Thanks @ezhikkk.
|
||||
- Telegram: recover proactive sends when stale topic thread IDs are used by retrying without `message_thread_id`, and clear explicit no-thread route updates instead of inheriting stale thread state. (#11620)
|
||||
- Gateway/CLI: when `gateway.bind=lan`, use a LAN IP for probe URLs and Control UI links. (#11448) Thanks @AnonO6.
|
||||
|
||||
Reference in New Issue
Block a user