Skip to content

fix(core): bound capture turns and the queue, make the run report counters exact (#1666) - #1680

Merged
ajianaz merged 1 commit into
developfrom
fix/capture-limits-counters
Nov 4, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/capture-limits-counters

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

What

  • Uteke::capture refuses a turn over [capture] max_turn_bytes (default 1 MiB) on every surface; uteke capture reads stdin only up to that size; HTTP uses the same setting (413).
  • The queue is bounded: capture refuses a new turn while pending + extracting turns reach max_queue_turns (100000) or max_queue_bytes (512 MiB). extract-queue status / GET /capture/status show pending_bytes and a warning from 80% of a limit.
  • Report counters: lease housekeeping uses UPDATE ... RETURNING, so reclaimed counts batches handed back, batches failed by an expired lease go to sessions_failed, and facts_refused is only added when the attempt stands (not on a rolled-back retry).
  • Docs and CHANGELOG (Unreleased) updated; the raw capture queue is unreleased, so no shim.

Why

A hook passing a huge message stored it whole and sent it in one extraction request, and a stuck extraction let the queue grow without bound. Closes #1666

Testing

New unit tests in capture.rs (size limit by role and bytes, default/zero, queue turn and byte limits, duplicate still a no-op, done turns not counted, 80% warning, reclaim vs failed counts, refused not double counted on retry), a CLI stdin bound test and an HTTP 413 / full-queue test. cargo test -p uteke-core -p uteke-cli -p uteke-server -p uteke-mcp, clippy and fmt are clean.

@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

@ajianaz
ajianaz merged commit d5ce24a into develop Nov 4, 2026
15 checks passed
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): capture turns have no size limit outside HTTP, and the run report counters are inaccurate

1 participant