Repository navigation
fix(memory): honor configured episodic store options - #12856
Conversation
|
Maintainers: please approve the fork workflows for this PR when convenient. The branch is locally green, including both extracted GPT 5.6 and Opus 4.8 review contracts with no findings. |
|
Intent: Named memory stores must honor the configured episodic deduplication threshold, matching the other memory construction paths. |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Ledger indexing pauses permanently once the episodic store sits at its cap — eviction never frees a slot, so retry-forever is the steady state on mature installs. WatchThe PR's own doc states the trap: "cap eviction by other writers always leaves the count AT the cap, so it never frees a slot for the importer." Once any install accrues Suggestions
[DESIGN-REVIEWED] d5bcf91 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the operational trade: at a configured low cap, ledger indexing now pauses indefinitely, signalled only by a warning log until the operator raises the cap. What this change shipsInventory (9 items) — 9 justifiedIntent: FIX — every config-built memory store honors the configured episodic dedup threshold and cap, at boot and after a live reload. Defect verified on base:
The five other [FIRST-PRINCIPLES-REVIEWED] d5bcf91 |
7fe8a57 to
46ead19
Compare
|
|
|
46ead19 to
c9c64e5
Compare
|
Current head
My failed-job-only rerun request was refused because contributors lack repository admin rights. Maintainers: please rerun these failed jobs after the installation rate limit resets. No new head is needed. |
c9c64e5 to
45b14ae
Compare
|
Rebased onto current Blocking item — resolved by new head. The
The prior head was also 328 commits behind Rebase is a no-op on behaviour. One commit, kept as one; Verified on
Independent-reviewer spawn (contract step 6, gpt-5.6-sol) was refused by host governance (capability disabled), so it was not run; constructor-signature and call-site sweep were verified directly instead. Remaining work is maintainer-side only: this fork PR's re-triggered workflows need maintainer approval to execute, after which |
0159afc to
0e04f48
Compare
|
span=dc2d7de999a7
|
0e04f48 to
a751ac0
Compare
|
span=3f8cfc777e5f
|
|
span=04181484b0a3
|
|
span=c35f877c0707
|
a751ac0 to
f97d117
Compare
f97d117 to
58eb5b6
Compare
|
span=6afa6d02c389
|
|
span=708455be55bb
|
|
span=d2d549431dc0
|
|
span=15f027fccf46
|
|
First-principles, span=3753a3dfe4b9 (replay's The item rests on "that subscription's applier is sync and never raises
So on replay against a snapshot with a degraded New test The awaitable arm is not covered by the generic |
|
GPT, span=5f43642af427 ( The parenthetical explains why the loader floors Spec prose is not test input in this repo. A test that string-matches this paragraph would fail on a rewording and pass on a behavior change, which is the reverse of what it would be for. If the floor moved, the loader test fails, and that is the trigger to revise the sentence. |
|
Design, span=eb9d6193a40c (a
|
|
First-principles, span=16d6ebf51ecb (
|
|
Design, span=568b3691042a (ledger indexing pauses at the episodic cap): rebutted, the pause is the recorded steady state for #10889, no change on
|
|
Design, span=84667e35b901 (
|
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed on behalf of the maintainers (sweep 2026-09-28): readiness passed, required checks green on d5bcf91, no blocking review threads, security posture unchanged. Approving and merging.
Problem / Motivation
Goal: Every memory store honors the configured episodic dedup threshold and cap, at boot and after a live reload.
Memory stores can ignore configured episodic settings. Named stores miss
memory.episodic_dedup_threshold, and several production constructors missmemory.episodic_max_count, so they run on the built-in defaults.Why it matters
A store can deduplicate or evict episodic memories with defaults that disagree with the operator's configuration. Boot behavior can then differ from live
reconfigure()behavior for the same store.Not a goal
data_homestore, theeval/harnesses or the read-only injection audit, which keep constructor defaults.What changed (motivation → approach → change)
Every store built from the install's config takes its
memory.*tuning fromVectorMemoryStore.reconfigure(cfg), the method the live reload calls. Insrc/kiro_crew/vector_memory.pythe constructor takesconfig=and applies it BEFORE subscribing to the live watcher, so a reload landing during construction is not overwritten by the caller's older copy. The store then callsConfigWatch.replay(sub), added insrc/kiro_crew/config/live.py, on its new subscription, only when it was built withconfig=(aconfig=Nonestore, such as onboarding import's foreigndata_home, keeps its constructor defaults at construction): a reload adopts its config before it snapshots the registry, so one dispatched between the caller's load and the registration never reached the store.replayhands the new subscription the adopted snapshot when the watcher's fingerprint matches the file, re-reading it after each apply, and otherwise marks the subscription stale so the next tick delivers the file.Named stores in
src/kiro_crew/context.py(_build_store_vectors, V1 and V2 viaopen_member_database) passconfig=cfg, replacing a hand-copied options dict that droppedepisodic_dedup_thresholdandepisodic_max_count. So dosrc/kiro_crew/slack/gateway.py,src/kiro_crew/cli_server.py,src/kiro_crew/dashboard/handlers/memory.py, the lesson, carve and import/migrate stores insrc/kiro_crew/cli_commands.py, and the ops-mission-controlroutes.pyanddispatch.py, several of which dropped some or all of the memory tunables.Honoring a lower cap exposed two existing hazards, fixed here:
ledger_index.import_pendingcursored every refused write as a duplicate, so entries a full V1 store refused were never indexed after the cap was raised.write_episodic_outcome()returnsWRITTEN/REFUSED/AT_CAPACITY(write_episodicis itsboolwrapper), decided inside the transaction that refused the row. OnAT_CAPACITYthe indexer stops, logs how many entries stay pending, and retries them next import.REFUSEDis cursored as final; only the text refusals are final in fact, and a duplicate refusal that could succeed after its colliding row is tombstoned is an accepted loss._build_memory_config(insrc/kiro_crew/config/section_builders.pysince refactor(config): give each config domain a named owner module #14558, re-exported byconfig/loader.py) acceptedmemory.episodic_max_count: 0; it now floors the value at 1.onboarding_import, theeval/harnesses and the read-only injection audit keep constructor defaults, each with a stated reason. An inventory test fails on a new construction site that is neither plumbed nor exempted, and a structural guard fails on a site that omitsconfig=, passes a literal, or sets a tunable on the constructor. The memory, config and ops-mission-control system specs describe the change.Backwards compatibility
Compatible: defaults stay unchanged, and existing supported configuration values now reach every applicable constructor. A configured cap of 0 or below now loads as 1; the old value evicted every V1 episode on the next write. The ledger-index result keys are unchanged.
Tests
The named-store regression writes the dedup threshold, cap, confidence threshold and result limit, constructs the store through
_build_store_vectors, and checks the live settings. The dashboard regression constructs a real throwaway store and checks the configured dedup threshold, cap, confidence threshold, result limit and semantic keys. The structural guard verifies every plumbed construction call passesconfig=, proves it catches a missingconfig=(including a construction followed by a latereconfigure), a literalconfig=Noneand a constructor tunable, and the inventory test covers every construction site in the package.test_the_gateway_passes_the_configured_count_into_the_storenow pins the gateway'sconfig=self._cfg.test_a_reload_during_construction_is_not_overwrittendelivers a watcher reload (cap 900) at the moment the store subscribes and checks the caller's older config (cap 10) does not overwrite it.test_a_reload_dispatched_before_the_store_subscribed_is_replayedprimes the watcher with an adopted cap of 900 and builds the store from a cap-10 config: the store ends at 900.test_a_store_built_without_a_config_is_not_replayedprimes the same cap-900 watcher and builds aconfig=Nonestore withepisodic_max=77: it stays at 77.TestReplayOnRegistrationintest/test_config_live.pycovers a reload that missed the registration (a control subscriber that is not replayed keeps the old value), a snapshot behind the file (not applied, delivered on the next tick even when that tick changes only a field outside the prefix), a reload landing mid-replay, and the no-op on an unstarted watcher.TestCapacityRefusalintest_ledger_index.pycovers a fake full store and a real V1 store at its cap: refused entries stay pending and are written after the cap is raised, while duplicates are still cursored.test_capacity_verdict_survives_a_cap_raise_racing_the_refusalraises the cap on a real V1 store the instant a write is refused (whatreconfiguredoes from the watcher thread) and checks the entry is still retried.test_write_outcome_names_the_refusal_causepins each outcome, andtest_episodic_max_count_is_floored_at_onepins the loader floor.write_episodic_outcomeis registered as a write primitive intest_persistence_writer_inventory.py, and the generation-check guard intest_embedding_model_apply.pynow reads the method that holds the write body.On this head
d5bcf912b(rebased on64b0bdeda; #14558 moved_build_memory_configfromconfig/loader.pytoconfig/section_builders.py, so the floor hunk moved with it andrange-diffshows no other change), the touched test modules,test_config_module_boundaries.pyand the embeddings/slack-thread suites pass (1930 passed, 14 skipped), the 129 test files that importslack.gatewayordashboard.handlers.memorypass (7097 passed, 27 skipped), andmypy src/kiro_crew/is clean. On96f89e1f6(same diff on174614135) the 560 test files that importconfig.loaderorsection_buildersran 41975 passed, 3 failed: two fail identically onorigin/mainon this host (test_home_pin_survives_monkeypatch_undo.py::test_the_guard_accepts_a_scratch_home,test_auto_improvement_members.py::test_assignments_build_real_context_from_only_their_private_store; host environment), andtest_remote_crew_chaining.py::TestLentHopReservation::test_a_torn_down_lent_hop_is_owned_not_merely_skippedfailed once under-n 24and its file passed 3/3 in isolation (163 passed). Earlier heads: ond057475d6the touched modules plus the watcher suites andtest_dashboard_origin.pypassed (1285 passed, 14 skipped).TestReplayOnRegistration::test_a_degraded_section_is_deferred_on_replay_not_logged_as_a_failurepins replay'sConfigDeferredarm: with the arm deleted it fails ('failed on replay' is contained). On the previous base31c291de1,scripts/local-gate.py --base origin/main(backend, related): 25313 passed, 7 failed that fail identically onorigin/mainon the same host (aws_control/.../test_producer.pyx3,code_review_sage/.../test_store_ancestor_chain.py::...test_a_link_planted_inside_the_window_is_followed_outside_every_root,test_agent_import_hoist.pyx2,test_auto_improvement_members.py::test_assignments_build_real_context_from_only_their_private_store; host environment).black --check(changed files clean or baselined in.github/black-baseline.txt), isort, flake8, the fast-gatescripts/check_*.pyguards,verify_vendor_manifest.pyanddocs_lint.pypass.Manual verification
N/A — unit coverage drives the real configuration and constructor paths. Against the previous source the new regressions fail at pytest call phase: the capacity tests (refused entries cursored as duplicates and never retried; on
eb3d37748the cap-raise race test fails with1 != 0 : a capacity refusal is not a duplicate), the loader floor (0 != 1) and the structural guard (three unplumbedcli_commands.pysites). On0c102253dthe reconfigure guard fails (stores built without reconfigure(cfg)), the dashboard regression fails on the confidence threshold (0.8 == 0.61); on111a2fe71the guard fails withcontext.py:line 454/461: VectorMemoryStore(...) is never reconfigured; on9363051bbtest_capacity_pause_is_loggedfails with no warning logged; and on0159afca8the construct-then-reconfigureorder leaves the cap at 10 after a watcher reload to 900 lands during construction (reproduced with that head's own call sequence); on0e04f488ethe replay regression fails withassert 10 == 900; on58eb5b699theconfig=Noneregression fails withassert 900 == 77.Related Issues
Fixes #10889
Pattern harvest
Rule candidate: review-prompt
Pattern: Memory-store construction must pass every live
reconfigure()tuning field through each applicable constructor, with behavioral and structural parity coverage.Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)