#5514·OpenViking

[Bug] Memory extraction fails with failure_kind=parse_error when the model wraps operations in a fenced code block

Author: za8209Created Sep 30, 2026Updated Sep 30, 2026

Issue Origin

Observed in a real local deployment (OpenViking v0.4.22, macOS), 2026-09-30 ~20:35 CST, during session_commit.

Bug Description

The commit fails with:

Phase 2 step long_term failed: Final response could not be parsed as operations after 2 iterations (failure_kind=parse_error)

with the underlying parse error:

Failed to parse memory operations (iteration 2/2) failure_kind=parse_error
error=Line 44: invalid Python syntax: …

Observation from the captured response_preview: the model wrapped its operations in a **Markdown fenced block starting with ```python** (i.e. ```python <op>(...) ``` instead of bare ops). The DSL parser then reports an invalid-syntax error at the corresponding line.

Notes:

  • After #5171 this is correctly surfaced as a failure (previously it would have been silently swallowed as a successful zero-memory commit) — good change; reporting so the parse edge can be handled.
  • Similar family: #1541 (open, “LLM returns plain text instead of JSON structure”), #4580 / #4486 / #5163 (closed).
  • Retrying the same session reproduced parse_error again (not transient).

Ask

  1. Should the extractor normalize/strip code fences before parsing (defensive), or is the intended fix prompt-side only?
  2. Is Line 44: invalid Python syntax the expected error shape for a fenced block, or is there a better diagnostic to include (e.g., first offending line snippet)?

Environment

OpenViking v0.4.22 local (vlm doubao-seed-2.1-lite via Ark plan gateway). Session content redacted; can share a sanitized raw response if needed.