#7263·hive

[Bug]: CheckpointStore.load_checkpoint lacks integrity validation and fails to isolate corrupted checkpoint files

Author: BHUVANAN8Created Jun 17, 2026Updated Sep 24, 2026

Description

In core/framework/storage/checkpoint_store.py, load_checkpoint and load_index do not perform integrity checks on checkpoint JSON files, and if loading fails due to corruption, the files are not isolated.

Problem Statement

When a checkpoint JSON file is corrupted (e.g. truncated, invalid JSON due to a crash mid-write, or model mismatch), CheckpointStore.load_checkpoint logs an error and returns None.

This causes several issues:

  • State Inconsistency: Returning None triggers a fallback where the orchestrator might silently start a session from scratch or use stale state without notifying the user of the data loss.
  • Brittle Diagnostics: Corrupted checkpoint files are left in the main checkpoints/ directory, causing subsequent resume attempts to repeatedly fail or cluttering the directory.
  • Missing Integrity Checks: There is no checksum or basic validation to verify the file was completely written before parsing.

Steps to Reproduce

  1. Set up a Hive agent session with at least one execution checkpoint saved.
  2. Manually corrupt the checkpoint file (e.g. truncate it to a partial JSON):
bash
echo '{"checkpoint_id": "cp_1", "state":' > ~/.hive/agents/<agent_name>/sessions/<session_id>/checkpoints/cp_1.json
  1. Attempt to resume the session.

Observed Result: CheckpointStore.load_checkpoint fails with a JSON validation error, returns None, and the framework silently begins execution from scratch, losing all previous progress. The corrupted file remains in checkpoints/.

Expected Result: The store should validate the checkpoint's integrity. If a checkpoint file is found to be corrupted on load, it should be isolated (e.g., moved to a .corrupted/ directory), and the load failure should propagate or raise a clear diagnostic exception rather than silently returning None and starting from scratch.

Alternatives Considered

Ignore corruption and always start from scratch — rejected because data loss is silent, leading to confusion and wasted tokens during long-running workflows.

Additional Context

  • Affected file: core/framework/storage/checkpoint_store.py
  • Similar to Layer 2 of the system resilience issue (#5392) but specifically targeting execution checkpoints.