OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

Transient overview read failure is reported as a failed completed archive (Working Memory and checkpoints skip it)

Open Kiko0301 opened this issue 1 month ago • 1 comments

Transient overview read failure is reported as a failed completed archive (Working Memory and checkpoints skip it)

Bug Description

ArchiveStore.read_overview (openviking/session/archive_store.py) converts every storage failure into an empty string:

async def read_overview(self, archive_uri: str) -> str:
    try:
        overview = await self._viking_fs.read_file(f"{archive_uri}/.overview.md", ctx=self._ctx)
    except Exception:
        return ""
    return body_for_preview(overview or "")

ArchiveStore.scan_states then interprets an empty overview on a working_memory=true archive as a structural failure:

if done.get("enable_working_memory") is True:
    overview = await self.read_overview(archive["archive_uri"])
    if not overview.strip():
        states.append(ArchiveState(..., state="failed",
            failed={"stage": "archive_overview",
                    "error": "required overview is missing or unreadable"}))
        continue

The failed branch is meant for a durably missing or corrupt required overview. A transient fault (AGFS timeout, 5xx, permission error) is not that, yet read_overview cannot tell the two apart. The consequence is destructive:

  • completed_refs() excludes the archive, so latest_completed_summary() falls through to an older completed archive and _generate_archive_summary_async updates Working Memory from the wrong baseline — the demoted archive's compressed Working Memory content is dropped from the cumulative chain;
  • get_effective_completed_checkpoints (openviking/session/checkpoints.py) also skips it, so v2 cumulative checkpoints stored in that archive disappear from context;
  • get_session_archive reports a completed archive with status: failed.

The sibling probes in the same file already classify precisely: terminal_state / list_refs (fixed in #6728) and file_exists / read_meta (companion fix in the same series) narrow to is_storage_not_found and re-raise everything else. read_overview is the remaining member of that family.

Steps to Reproduce

  1. Have a session archive with a valid .done containing enable_working_memory: true and an .overview.md.
  2. Make the storage backend fail transiently for the .overview.md read (timeout / 5xx), while scan_states runs.
  3. scan_states reports the completed archive as failed; completed_refs() no longer includes it.

Expected Behavior

Only a typed not-found signal should mean "overview absent". Any other storage fault should propagate so the caller can retry and report it.

Actual Behavior

A transient read failure silently downgrades a completed archive to failed, removing it from Working Memory updates and checkpoint restoration.

Environment

  • OS: Windows 11
  • OpenViking version/commit: main @ 97c0da2

Additional Context

Same fail-open family as #6728 (terminal_state / list_refs). Verified with a fake FS raising AGFSTimeoutError: on current main read_overview returns "" and scan_states returns a failed state; after narrowing to is_storage_not_found the fault propagates, while a genuinely missing overview still reads as "" and remains a failed state. The fix is submitted as a PR.

Kiko0301 avatar Nov 04 '26 12:11 Kiko0301

Adding a production data point from a local deployment (OpenViking 0.4.17.2.dev0, DSH memory plugin 0.5.37, deepseek-flash as VLM, ~2,800 overviews).

Our case was not a transient timeout — an operator moved 27 .overview.md files aside while their .done still said working_memory_enabled: true — but the outcome matches what you describe, and the cost is substantial:

  • those archives were reported state="failed"; Completed archive has no readable required overview was logged 1,206 times within a few hours (once per archive per scan, no dedupe);
  • the next commits on those sessions rolled the failed archives forward: 156 archives re-summarized, ~35.4M input + 2.7M output VLM tokens in three hours;
  • the only way to tell the system "this archive is intentionally overview-less" is editing .done by hand; there is no retry cap/backoff and no per-archive repair/skip operation.

Would the planned fix also cover the durable case (file deleted or operator cleanup), e.g. after N scans mark the archive failed_permanent and stop folding it into new commits, plus an explicit "mark overview-less" operation? That would have turned a multi-hour re-summarization into a warning.

dzwalker avatar Nov 17 '26 06:11 dzwalker