[Bug]: [openclaw-plugin]: OpenClaw /reset boundary is not treated as a new OV session — pre-reset Working Memory summary is re-injected on the next turn
Issue Origin
Observed or reproduced in a real environment
Bug Description
When a user runs OpenClaw's /reset command, OpenClaw records a reset boundary but keeps the same sessionId (documented behavior: "records a reset boundary in an existing persisted session and keeps its sessionId"). The openclaw-plugin derives its OV session id deterministically from that sessionId (openClawSessionToOvStorageId in routing/identity-routing.ts), so the OV session id is unchanged across the reset.
On before_reset, the plugin commits the OV session (commitOVSession -> archive all active messages, generate a fresh Working Memory summary, extract memories). On the next turn, assemble fetches getSessionContext(ovSessionId), sees archives + no (or few) active messages, and REPLACES the host-provided fresh messages with the archive summary + OV messages (buildAssembledContext). Net effect: the pre-reset conversation summary is injected into the model context on the very next turn — /reset behaves as "compact and remind me of everything" rather than "fresh start".
Observed live: after /reset and a bare "hello", the agent replied "Picking up where we left off — you'd asked for the individual role ratings..." and reproduced pre-reset eval data verbatim. OpenClaw's own /context detail confirmed the OpenClaw transcript was genuinely fresh (2 real messages, 0 cached tokens) — the injected content came from the OV session store.
This contradicts OpenClaw's documented reset semantics ("a fresh history window") and the maintainers' own handling of rollovers (#3496 treats daily/idle/reset transitions as new session UUIDs). The same bug class was accepted as a bug for the Codex plugin in #4058 ("Codex memory plugin replays historical turns after resume or transcript compaction", fixed by #4429).
Steps to Reproduce
- Run OpenClaw with plugins.slots.contextEngine: "openclaw" on a chat session (e.g., Telegram direct).
- Have a substantive conversation (enough to build session state).
- Run /reset.
- Send a trivial greeting, e.g. "hello".
- Observe the reply resumes the pre-reset topic and reproduces pre-reset details.
- Optionally run /context detail (OpenClaw): the OpenClaw transcript shows only the post-reset messages — proving the injected content came from the OV session store, not the transcript.
Source-level path (plugin 2026.9.8-3):
- plugin/openviking-lifecycle-hooks.js -> before_reset hook -> contextEngine.commitOVSession(...) (commitSession archives everything, keepRecentCount: 0)
- services/context-lifecycle-service.ts -> assembleOpenVikingSession -> client.getSessionContext(ovSessionId, tokenBudget) -> buildAssembledContext(latest_archive_overview, preAbstracts, ctx.messages, ...)
- routing/identity-routing.ts -> openClawSessionToOvStorageId(sessionId, sessionKey) returns the same id because /reset keeps the sessionId
Expected Behavior
A session reset boundary should start a logically new OV session (or at minimum suppress archive-summary injection until genuinely new post-reset content exists). The next turn's model context should not include the pre-reset conversation summary or history. Extracted long-term memories may still be recalled via auto-recall — that's the intended memory layer — but the session-scoped Working Memory/archive injection should not replay pre-reset history.
Actual Behavior
- before_reset commits (archives + summarizes + extracts) the OV session under the SAME session id.
- Next assemble returns: fresh Working Memory summary (latest_archive_overview) + predecessor archive abstracts + OV active messages, replacing the fresh host messages.
- The model treats this as conversation continuity ("Picking up where we left off") immediately after an explicit reset.
Minimal Reproducible Example
# pseudo-flow using the plugin's client API
session_id = "same-openclaw-session-uuid" # /reset keeps this id unchanged
client.commit_session(session_id, keep_recent_count=0) # before_reset hook
ctx = client.get_session_context(session_id, token_budget) # next assemble
# ctx.latest_archive_overview -> pre-reset Working Memory summary <-- leak
# ctx.messages -> OV active messages
# assemble replaces the 2 fresh host messages with the archive summary + ctx.messages
Error Logs
No error logs — silent misbehavior. Observable diagnostics (plugin emitStandardDiagnostics):
assemble_result shows passthrough: false with archiveCount >= 1 immediately after reset, where a
fresh session would log session_not_found or no_ov_data.
OpenViking Version
0.4.19 (server, /health); @openviking/openclaw-plugin 2026.9.8-3
Python Version
3.12.3
Operating System
Linux
Model Backend
OpenAI
Additional Context
- OpenClaw reset semantics: https://docs.openclaw.ai/reference/session-management-compaction — "Gateway reset (/new, /reset) records a reset boundary in an existing persisted session and keeps its sessionId"; transcript entry type reset: "a fresh history window".
- #3496 already handles the rollover case (new UUID per daily/idle/reset transition) for archive search, but plain /reset produces no new UUID, so the boundary is invisible to the plugin.
- #4058 / #4429 fixed the same class of bug for the Codex plugin (replaying historical turns after resume/compaction).
- Suggested fixes (either):
- In before_reset handling, record a reset boundary in the OV session (e.g., a new OV session revision/epoch) and have getSessionContext/assemble treat post-boundary turns as a new window: no archive-overview injection until post-boundary content exists.
- Or have OpenClaw host pass the reset boundary into the engine (runtimeContext) so assemble can suppress archive injection for the first N turns after a boundary.
- Workarounds currently available: OpenClaw-side sessionId rotation (sessions tool reset action, or session.reset.mode: idle/daily), or bypassSessionPatterns for the affected chat.
I traced this against OpenViking a386269d38 and OpenClaw 421245a606. The source supports the same-session replay mechanism: main assemble loads context using the unchanged OV storage ID, and an archive bypasses the fewer-messages passthrough check.
There is a timing constraint on a hook-only epoch fix. The host launches runBeforeReset in an unawaited async function. It supplies the previous session ID plus sessionFile, pre-reset messages and the command reason; the event contract carries no reset revision. The plugin currently awaits a commit inside that callback. Rotating an OV ID after that await therefore would not itself establish ordering with the next assemble/capture, and an in-memory epoch alone would not survive a gateway restart. These are source-level findings; I have not run the reporter's gateway reproduction.
A durable fix needs the same authoritative reset-window identity at capture and assemble, including after restart, while keeping ordinary compaction and intentional long-term recall intact. Is there an existing supported host accessor for that committed reset boundary, or should we coordinate a boundary token in the context-engine host contract? That would let the plugin avoid inferring a reset from message counts or suppressing an arbitrary number of turns. The regression should exercise a delayed/failed reset commit, immediate next turn, repeated reset and restart against the same session ID.
This seems only started to happen in last release or two. I did not notice this behavior before 0.4.19 or plugin 2026.9.3 (not sure exactly which version). now that openclaw is essentially not usable, and I have to turn the plugin off.
previous session context gets injected after reset, and agent often takes up as instruction and start executing. please fix.
checking,will fix today
key change is openclaw 2.0, released in 8-30 changed behavior of /reset to retain sessionID.
issue introduced in https://github.com/openclaw/openclaw/pull/112988 this is my proposed solution: https://github.com/volcengine/OpenViking/pull/4937
Thanks for reporting this! #4937 fixes the reset boundary: the OpenClaw plugin commits with resetContext: true, and the server records that boundary and stops loading summaries from before it. This prevents /reset from injecting the previous conversation's working-memory summary even when OpenClaw keeps the same session ID.
Closing as resolved on main. Use plugin and server versions containing #4937. If it still occurs, please reopen, or comment requesting reopening, with both versions and a minimal sequence showing the conversation, /reset, and the stale context injected on the next turn. Remove private conversation content from the example.