feat(retain): make structured-unit chunk limit configurable#2139
feat(retain): make structured-unit chunk limit configurable#2139Sanderhoff-alt wants to merge 1 commit into
Conversation
6085789 to
b5c32c0
Compare
|
One naming suggestion: Consider
Purely a naming nit — the approach and the absolute-cap semantics look good. |
d025e9d to
9eac18e
Compare
Add retain_structured_chunk_size as an explicit retain chunking knob for structured inputs. When unset, structured inputs follow the effective retain_chunk_size instead of the hidden 1.5x overflow factor. Thread the setting through retain extraction, append/prepend chunking, bank config resolution, templates, MCP docs, maintained clients, generated OpenAPI artifacts, the control-plane retain strategy UI, and the Rust CLI set-config command. Validate retain_chunk_size and retain_structured_chunk_size as positive integers while allowing either value to be smaller. Keep the existing retain_max_completion_tokens check scoped to retain_chunk_size. Preserve upstream validation details for client errors through the control-plane proxy so UI alerts and toasts can show concrete configuration errors without exposing server-side failure details. Update chunking, config, hierarchical config, template, MCP, client payload, control-plane serialization, SDK-response, API-client, and retain UI validation tests for the new behavior.
9eac18e to
23fcdd2
Compare
|
@nicoloboschi I’ve updated the PR to use retain_structured_chunk_size / HINDSIGHT_API_RETAIN_STRUCTURED_CHUNK_SIZE and --retain-structured-chunk-size throughout the API, config, CLI, clients, docs, and control-plane UI. I kept the existing description semantics focused on the actual behavior: the value controls the maximum size for a single JSONL line or conversation turn to stay whole, and defaults to retain_chunk_size when unset. |
Summary
Adds
retain_structured_chunk_sizeas an explicit retain chunking configuration for structured inputs such as JSONL and conversation arrays.When unset, structured chunks now follow the effective
retain_chunk_sizeinstead of using the hiddenretain_chunk_size * 1.5overflow allowance. Operators can tune structured inputs independently by settingretain_structured_chunk_sizeexplicitly.Closes #2136.
Motivation
The previous structured chunking behavior allowed a single JSONL line or conversation turn to exceed
retain_chunk_sizeby an implicit 1.5x factor. That made the effective size limit difficult to reason about and impossible to tune directly.This PR replaces that hidden heuristic with a named configuration field:
retain_structured_chunk_sizeis unset, the structured chunk size equals the effectiveretain_chunk_size.retain_structured_chunk_sizebelowretain_chunk_sizeto split very large JSONL lines or conversation turns sooner.retain_structured_chunk_sizeaboveretain_chunk_sizeto preserve larger structured records whole.retain_max_completion_tokens > retain_chunk_sizecheck unchanged.Changes
HINDSIGHT_API_RETAIN_STRUCTURED_CHUNK_SIZE/retain_structured_chunk_size.bank set-configcommand to expose--retain-chunk-sizeand--retain-structured-chunk-size..env.examplefiles and generated docs/skill references.Testing
git diff --check./scripts/hooks/lint.shcd hindsight-dev && uv run cli-coverage-checkgenerate-docs-skill.shlint.shAdditional targeted coverage was added for: