Skip to content

fix(core): extract a long capture session in chunks, fail an oversized one alone - #1673

Merged
ajianaz merged 4 commits into
developfrom
fix/capture-chunked-extraction
Nov 4, 2026
Merged

ajianaz merged 4 commits into
developfrom
fix/capture-chunked-extraction

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

What

  • A capture batch is extracted in chunks of at most [capture] chunk_chars characters (default 24000, minimum 64) instead of one request. Turns are packed on turn boundaries; a single turn larger than the budget is split at a newline or whitespace, else on a character boundary.
  • The facts of every chunk are stored under the same capture:<session>:<batch> source. All chunks are extracted before anything is stored, so the batch stays one unit for the lease, the attempts count and the leftovers withdrawal.
  • A provider answer of HTTP 400/413, or one naming the context length (extraction::is_input_too_large), now fails that session only: it counts an attempt and the run goes on with the sessions behind it. A 429 or 5xx still stops the run.
  • Docs (configuration.md, cli-reference.md) and CHANGELOG updated.

Why

extract_session joined every pending turn into one request. A long session made the provider answer 400, which stopped the run and doubled the wait, and the same oldest session was claimed first again, so one long conversation delayed all capture extraction for hours.

Note: every chunk is a request of up to two minutes, so lease_minutes should stay above the longest session's time (documented). CORE contract: capture routes are LAB, no route or response change.

Testing

New tests in capture.rs: chunk packing and the oversized-turn split (whitespace and multibyte), a session over the budget is extracted in more than one call with every fact stored once under one source, a session the provider always refuses is failed after max_attempts while the next session still runs, the error classification, and a crash halfway through chunk stores is re-run whole without duplicates. cargo test -p uteke-core --lib (1076 passed), cargo clippy --workspace --all-targets -- -D warnings.

Closes #1664

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Comment thread crates/uteke-core/src/capture.rs Fixed
rest.chars()
.take_while(char::is_ascii_digit)
.collect::<String>()
.parse::<u16>()
@ajianaz
ajianaz merged commit 288564a into develop Nov 4, 2026
15 checks passed
@ajianaz
ajianaz deleted the fix/capture-chunked-extraction branch November 4, 2026 06:46
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.

fix(core): a whole capture session is one extraction request; an oversized session starves the queue

2 participants