feat(api): add targeted consolidation by observation scopes - #1746
Merged
Conversation
Add `observation_scopes` parameter to the consolidate endpoint to run consolidation only on memories matching specific tag scopes, and add `enable_auto_consolidation` config flag to disable automatic post-retain consolidation.
Update observations docs with targeted consolidation section, trigger consolidation endpoint reference, and auto-consolidation disable flag. Regenerate OpenAPI spec and client SDKs.
6 tasks
nicoloboschi
added a commit
that referenced
this pull request
May 26, 2026
PR #1746 added enable_auto_consolidation to _CONFIGURABLE_FIELDS and introduced a ConsolidationRequest body on the /consolidate endpoint, but didn't update test_hierarchical_fields_categorization (still expects 35 fields) or the CLI's trigger_consolidation wrapper (still calls the generated client with 2 args), so CI on this branch breaks on test-api, test-rust-cli, test-embed-windows, and test-doc-examples (cli). Bump the expected count to 36, add enable_auto_consolidation to the explicit assertions, and pass a default ConsolidationRequest to the generated client so the no-scope CLI invocation keeps consolidating all unconsolidated memories.
4 tasks
nicoloboschi
added a commit
that referenced
this pull request
May 26, 2026
… (#1757) PR #1746 added enable_auto_consolidation to _CONFIGURABLE_FIELDS and introduced a ConsolidationRequest body on the /consolidate endpoint, but didn't update test_hierarchical_fields_categorization (still expects 35 fields) or the CLI's trigger_consolidation wrapper (still calls the generated client with 2 args), so CI on this branch breaks on test-api, test-rust-cli, test-embed-windows, and test-doc-examples (cli). Bump the expected count to 36, add enable_auto_consolidation to the explicit assertions, and pass a default ConsolidationRequest to the generated client so the no-scope CLI invocation keeps consolidating all unconsolidated memories.
nicoloboschi
added a commit
that referenced
this pull request
May 26, 2026
PR #1746 (targeted consolidation by observation scopes) added a request body to the POST /v1/default/banks/{bank_id}/consolidate endpoint, but the rust CLI caller in hindsight-cli/src/api.rs was not updated, so the rust client test was broken on main (just not surfaced — test-rust-cli only runs when core/cli/ci files change in a PR, and the PR that introduced the body didn't trigger it). CLI always wants the "consolidate everything" behavior, so we pass an empty ConsolidationRequest (observation_scopes: None). Surfaced when this PR's hindsight-api-slim changes triggered test-rust-cli.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1625
observation_scopes: list[list[str]]parameter toPOST /v1/default/banks/{bank_id}/consolidate— when provided, only unconsolidated memories whose tags contain all tags in at least one scope are processed (tags @> scopewith OR across scopes)enable_auto_consolidationhierarchical config flag (HINDSIGHT_API_ENABLE_AUTO_CONSOLIDATION, defaulttrue) — whenfalse, retain/delete/update operations no longer auto-trigger consolidation, letting users run it on-demand via the APITest plan
test_targeted_consolidation_filters_by_scopes— single scope filters correctly, leaves other scopes unconsolidatedtest_targeted_consolidation_multiple_scopes— OR semantics across multiple scopestest_targeted_consolidation_no_scopes_processes_all— backward compatibility (no scopes = full bank sweep)test_targeted_consolidation_contains_semantics—["user:alice"]matches memories tagged["user:alice", "team:eng"]test_enable_auto_consolidation_flag— retain with flag disabled produces no observations