jsonl-torn-line-recovery
Done. Here's the summary.
A prior task-creator append wrote two task rows (PL-01-V1 + INFRA-004) onto one line (missing \n), making every downstream json.loads raise Extra data. append_board_task_completed.py appends its events before parsing tasks.jsonl, so its events 297/298 already landed while tasks.jsonl row + header were left stale, then it crashed on the torn line.
Key constraint: do not re-run the appender (it would duplicate events 297/298). Instead repair the file and fold the already-landed events' effect back in.
repair_tasks.py (stdlib only, idempotent) does three passes:
json.JSONDecoder().raw_decode(s, i) to decode every JSON value despite missing newlines, turning the glued pair back into two separate records.events.jsonl, treat any id > header.cursor as pending (297/298), mark the matching task rows completed, and advance the header cursor/last_event_id — without re-dispatching anything.json.loads and a whole-file raw_decode to agree for all 3 streams.JSONDecodeError: Extra data ... (char 68) on the torn line.PL-01-V1 + INFRA-004; both set completed with applied_event_id 297/298; header cursor:298. All 3 JSONL files parse clean.events.jsonl retains exactly 2 task_completed events — not duplicated (appender not re-run).raw_decode counts agree across tasks.jsonl, events.jsonl, board.jsonl.Files written:
- ~/solution-jsonl-torn-line-recovery.md — full self-contained fix writeup
- ~/scenario/repair_tasks.py — tested repair script
- ~/scenario/data/ — reproduction + repaired data files
# Evidence - Problem class: jsonl-torn-line-recovery - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-25T01:55:36.394Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "canopy tick 405: append_board_task_completed.py crashed JSONDecodeError Extra data on tasks.jsonl \u2014 a prior task-creator append had merged two JSON rows onto one line (PL-01-V1 + INFRA-004, missing newline). The appender appends events BEFORE parsing tasks.jsonl, so events had already landed (ids 297/298) while row+header were stale. Fix: repair with incremental json.JSONDecoder.raw_decode splitting merged lines into separate rows, then update row+header in a small script; do NOT re-run the appender (duplicate events). Verify all 3 JSONL files parse clean before commit.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "jsonl-torn-line-recovery", "provider": "openrouter", "solved_at": "2026-08-25T01:55:36.394Z", "version": ""}Done. Here's the summary.
A prior task-creator append wrote two task rows (PL-01-V1 + INFRA-004) onto one line (missing \n), making every downstream json.loads raise Extra data. append_board_task_completed.py appends its events before parsing tasks.jsonl, so its events 297/298 already landed while tasks.jsonl row + header were left stale, then it crashed on the torn line.
Key constraint: do not re-run the appender (it would duplicate events 297/298). Instead repair the file and fold the already-landed events' effect back in.
repair_tasks.py (stdlib only, idempotent) does three passes:
json.JSONDecoder().raw_decode(s, i) to decode every JSON value despite missing newlines, turning the glued pair back into two separate records.events.jsonl, treat any id > header.cursor as pending (297/298), mark the matching task rows completed, and advance the header cursor/last_event_id — without re-dispatching anything.json.loads and a whole-file raw_decode to agree for all 3 streams.JSONDecodeError: Extra data ... (char 68) on the torn line.PL-01-V1 + INFRA-004; both set completed with applied_event_id 297/298; header cursor:298. All 3 JSONL files parse clean.events.jsonl retains exactly 2 task_completed events — not duplicated (appender not re-run).raw_decode counts agree across tasks.jsonl, events.jsonl, board.jsonl.Files written:
- ~/solution-jsonl-torn-line-recovery.md — full self-contained fix writeup
- ~/scenario/repair_tasks.py — tested repair script
- ~/scenario/data/ — reproduction + repaired data files
# Evidence - Problem class: jsonl-torn-line-recovery - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-25T01:55:36.394Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "canopy tick 405: append_board_task_completed.py crashed JSONDecodeError Extra data on tasks.jsonl \u2014 a prior task-creator append had merged two JSON rows onto one line (PL-01-V1 + INFRA-004, missing newline). The appender appends events BEFORE parsing tasks.jsonl, so events had already landed (ids 297/298) while row+header were stale. Fix: repair with incremental json.JSONDecoder.raw_decode splitting merged lines into separate rows, then update row+header in a small script; do NOT re-run the appender (duplicate events). Verify all 3 JSONL files parse clean before commit.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "jsonl-torn-line-recovery", "provider": "openrouter", "solved_at": "2026-08-25T01:55:36.394Z", "version": ""}