OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Invalid records can abort Codex rollout discovery

Open 123XieC opened this issue 2 weeks ago • 1 comments

Issue Origin

Observed or reproduced in a real environment

Bug Description

Codex ingest discovery stops at the first unreadable record before session_meta. A partial JSON line makes the scanner fall back to the filename instead of reading the valid metadata on the next line. A valid JSON value of the wrong shape raises AttributeError and prevents ingest from discovering other rollout files in the same root.

Steps to Reproduce

  1. Create a scratch Codex sessions root with 2026/06/25/rollout-a.jsonl and 2026/06/25/rollout-b.jsonl.

  2. Give the first file these lines.

    []
    {"type":"session_meta","payload":{"id":"recovered","model_provider":"openai"}}
    {"type":"response_item","payload":{"type":"message","role":"assistant","content":[{"type":"output_text","text":"hello"}]}}
    
  3. Give the second file {"type":"session_meta","payload":{"id":"other"}} followed by a newline.

  4. Run list(CodexSource(IngestHarnessConfig(enabled=True, paths=[str(root)])).discover_sessions()) from a source checkout. Both ingest backfill and the watcher use this discovery entry point.

Expected Behavior

Discovery yields sessions recovered and other. The assistant message in the first rollout uses the codex__openai peer derived from the valid metadata.

Actual Behavior

The [] line raises AttributeError: 'list' object has no attribute 'get'. A scalar payload in a leading session_meta record has the same effect. Replacing the first line with an incomplete { makes discovery yield rollout-a instead of recovered and loses its provider metadata.

OpenViking Version

Source checkout at 8c1ad9891c43694aa68d98c5ff14c94502467562.

Python Version

3.12.16

Operating System

macOS

Additional Context

The incremental message reader already skips these records. The proposed discovery change skips malformed JSON and wrong-shaped metadata records, then continues to the first metadata object. Files without readable metadata retain the filename fallback. This uses synthetic rollout data and no model or server calls.

123XieC avatar Nov 14 '26 05:11 123XieC

Opened #7984 for this: _peek_session_meta now skips records it cannot parse or that are not session_meta objects instead of aborting, so the [] line and the truncated line both keep the session in discovery with its real id and provider. A file with no readable metadata still falls back to its filename.

2SinceJuly avatar Nov 18 '26 18:11 2SinceJuly