Skip to content

fix: pipeline reliability — retry logic, checkpointing, concurrency, stale cleanupFix/pipeline reliability#2

Open
mosumosu-JAPAN wants to merge 2 commits into
coolwoods19:mainfrom
mosumosu-JAPAN:fix/pipeline-reliability
Open

fix: pipeline reliability — retry logic, checkpointing, concurrency, stale cleanupFix/pipeline reliability#2
mosumosu-JAPAN wants to merge 2 commits into
coolwoods19:mainfrom
mosumosu-JAPAN:fix/pipeline-reliability

Conversation

@mosumosu-JAPAN
Copy link
Copy Markdown

@mosumosu-JAPAN mosumosu-JAPAN commented Apr 23, 2026

What this fixes

Ran compile on 1400+ Claude conversations and hit several issues at scale.
This PR addresses all of them.

Bugs fixed

  1. parse_llm_json returns a list instead of a dict → crash
    Added isinstance check + retry logic (up to 3–5 attempts) in filter.py,
    summarize.py, and all three call sites in compile.py.

  2. No per-source checkpointing → crash loses all progress
    State is now written to disk after every single source. Resuming from a
    crashed run automatically skips already-processed sources.

  3. Fully sequential summarize → 3+ hours for 700+ sources
    Replaced with ThreadPoolExecutor (5 workers) + rate-limit jitter.
    Same workload now completes in ~25 minutes.

  4. Stale wiki files persist across recompiles
    Fresh compile now clears the old wiki directory before writing.

Files changed

  • kompile/utils.py — list unwrapping in parse_llm_json
  • kompile/compiler/filter.py — retry + checkpoint
  • kompile/compiler/summarize.py — retry + concurrency + jitter
  • kompile/compiler/compile.py — retry at all call sites + defensive parsing
  • kompile/state.py — compile-stage checkpoint functions
  • kompile/cli.py — stale cleanup, checkpoint load/skip/clear
  • kompile.yaml — summarize model → Haiku

jaydezhang0901-cloud and others added 2 commits April 22, 2026 23:09
…ency

- utils.py: unwrap single-element list from parse_llm_json (root cause of all crashes)
- filter.py: 3-attempt retry per source; per-source checkpoint so filter resumes on crash
- summarize.py: 5-attempt retry with rate-limit jitter; ThreadPoolExecutor(5) for ~4x speedup
- compile.py: retry loops in all LLM call sites; defensive isinstance guards for articles/subtopics/insights/gaps
- state.py: compile-stage checkpoints for WikiCompilation and ActiveNote (skip already-done domains on crash)
- cli.py: stale wiki cleanup on fresh compile; load/skip compile checkpoints; clear checkpoints after successful write
- kompile.yaml: switch summarize model to Haiku to reduce cost

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants