Repository navigation
fix(memory): let a dead legacy binding move to V2 or default - #11736
Conversation
A member bound to a V1 store whose name fails the shape rule (a name
that was legal before memory_stores.py existed, such as AgentForge)
is dead on every surface: each turn raises at
require_member_memory_store, and both repairs refused too. The
dashboard V1-to-V2 opt-in validated the prior binding before
provisioning, so it returned 409 member_memory_unavailable on the very
name it was the way out of; and rebinding to default was refused as
private_memory_immutable on both the dashboard and the CLI, although
the record claims no ownership and the name composes no path.
unusable_legacy_binding names exactly that shape: a binding whose name
memory_store_name_defect refuses, on a record with no ownership claim
or no record at all. The opt-in skips the prior-binding validation
for it (provision_member_memory re-runs the private-evidence check
itself), and PUT /api/agents/{name} plus agent update --memory-store
accept a move to default for it, and only to default. A live V1 name,
a private store, and a record claiming ownership under a dead name all
stay immutable. The dead declaration is left in memory_stores verbatim,
like every other reported name, and nothing under memory_stores/ is
read, replaced or removed.
The retire-meshclaw --force finding in the same ticket is a separate
companion-plugin issue and is not part of this change.
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm the reporter's actual store records are unowned V1 — a record claiming ownership under the dead name stays refused, so their 9 members must match the predicate. [DESIGN-REVIEWED] 4dea9f8 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS No linked issue: the defect's provenance is the description's reproduction — corroborated by the base hunk's unconditional 409 — worth a maintainer's confirming glance. What this change shipsInventory (9 items) — 9 justifiedIntent: give an operator whose member is bound to a pre-0.7 store name (refused by the shape rule, so the member fails every turn) a supported way out — this is a FIX.
Root-cause note: the cause ("a repair validates the state it replaces") is fixed at all its instances — grepped [FIRST-PRINCIPLES-REVIEWED] 4dea9f8 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
…dev#11736) A member bound to a V1 store whose name fails the shape rule (a name that was legal before memory_stores.py existed, such as AgentForge) is dead on every surface: each turn raises at require_member_memory_store, and both repairs refused too. The dashboard V1-to-V2 opt-in validated the prior binding before provisioning, so it returned 409 member_memory_unavailable on the very name it was the way out of; and rebinding to default was refused as private_memory_immutable on both the dashboard and the CLI, although the record claims no ownership and the name composes no path. unusable_legacy_binding names exactly that shape: a binding whose name memory_store_name_defect refuses, on a record with no ownership claim or no record at all. The opt-in skips the prior-binding validation for it (provision_member_memory re-runs the private-evidence check itself), and PUT /api/agents/{name} plus agent update --memory-store accept a move to default for it, and only to default. A live V1 name, a private store, and a record claiming ownership under a dead name all stay immutable. The dead declaration is left in memory_stores verbatim, like every other reported name, and nothing under memory_stores/ is read, replaced or removed. The retire-meshclaw --force finding in the same ticket is a separate companion-plugin issue and is not part of this change.
Problem / Motivation
A Crew Member bound to a legacy V1 memory store whose name fails the 0.7 shape rule (a name that was legal before
memory_stores.pyexisted, such asAgentForge) is dead and cannot be repaired:memory_unavailable: invalid memory store name 'AgentForge': not lowercase409 member_memory_unavailablewith the same textPUT /api/agents/<name>withmemory_store: "default"andkirocrew agent update <name> --memory-store=defaultboth return "a member's private memory cannot be rebound or shared"The only way out was editing
config.jsonby hand.Why it matters
Anyone upgrading from 0.6 with a mixed-case or underscored store name hits this on every member bound to that store (the reporter had 9 members across 3 stores). The loader's refusal to sanitize the name is right, but the two supported repairs refused the same name, so the member stayed broken in the UI with no supported exit.
What changed (motivation → approach → change)
PUT /api/agents/<name>provision_memoryPUT /api/agents/<name>memory_store: "default"private_memory_immutablekirocrew agent update <name> --memory-store=default🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged
Both repairs validated the binding they were about to replace. The dashboard opt-in called
require_member_memory_storeon the prior binding beforeprovision_member_memory, and that raises on the name. The rebind check refused every change ofmemory_storeregardless of what the prior record was.unusable_legacy_binding(config, member)inmemory_stores.pynames the one binding shape the immutability rules protect nothing on: a namememory_store_name_defectrefuses, on a record with no ownership claim (owner_member == "",memory_version == 1) or no record at all. No resolver composes a path for such a name, so nothing undermemory_stores/is read, replaced or removed by leaving it.The dashboard opt-in (
dashboard/handlers/agents.py) skips the prior-binding validation when that predicate answers (provision_member_memoryre-runs the private-evidence half itself and already skipped the legacy-file half for such a name).PUT /api/agents/{name}andagent update --memory-store(cli_commands.py) accept a move todefaultfor that shape, and only todefault; the move is validated as the binding it becomes before publication, so a member that still has a stale private declaration of its own gets409 member_memory_unavailablerather than a 500 frompersist_member_config. Any other destination is stillprivate_memory_immutable, now with an error naming the defect instead of calling a V1 name private. Failed-allocation cleanup never treats the global store as a key to retire. The dead declaration stays inmemory_storesverbatim, like every other reported name.Specs (
docs/system-specs/modules/config.md,memory-skills-hooks.md) and the user doc (src/kiro_crew/docs/configuration.md) record the exception; the--memory-storeflag help onagent update(cli.py) names it.Tests
test/test_memory_stores.py—TestUnusableLegacyBindingIsTheOneMovableBinding: movable for a declared unowned V1 record or no record on a malformed name, a non-string binding included; not movable for a usable name, the default store, an unknown member, or any record claiming ownership; and pinned as the exact complement of the runtime refusal (require_member_memory_storefails on the name wherever the predicate answers).test/test_crew_memory_store_binding.py—TestADeadLegacyBindingHasAWayOut: dashboard provisioning succeeds on a dead name (declared or not) and leaves the declaration andmemory_stores/alone; the move todefaultsucceeds and carries other edits; any other destination is 409 and names the defect; a live named V1 binding stays immutable; stale private evidence of the member is a 409 (not a 500) on both repairs; an owned record under a dead name stays refused on both.TestTheCliRepairsADeadLegacyBinding:agent update --memory-store=defaultmoves the member; any other destination exits 1 naming the defect; stale private evidence exits 1;--provision-memorykeeps working; the flag help names the permitted move.prove.py --per-hunk: every code hunk caught. Two hunks report inconclusive because reverting them makes the tests fail at import (the new symbol's definition and one of its imports), not because a test misses them.Manual verification
N/A — unit coverage exercises the real handler and CLI against a real per-test config; no UI change (the Members page already sends
provision_memory: true).Review note
Local lanes (
gpt-5.6-solpercodex-review.yml,claude-opus-4.8perclaude-review.yml) reviewed317ad3724against99dc588b9: Opus no findings; GPT one non-blockingtop-level-importsfinding on the in-handlerrequire_member_memory_storeimport, folded into this commit as a module-level import (the only delta since that review). Full prepare-pr profile: 49/51 gates green on this head; the two scoped-test gates ran on the pre-rebase head, 40,861 backend tests passed with 3 reds that reproduce byte-for-byte on a cleanorigin/mainworktree (a/ApplicationsKiro CLI shadowing PATH on the dev host), and 1 frontend timing red that passes unloaded. No open PR touchesmemory_stores.py; open PRs touchingdashboard/handlers/agents.pyorcli_commands.py(#11324, #11121, #10414, #11658, #11532) edit unrelated regions.Related Issues
no linked issue: reported directly by an operator upgrading from 0.6 to 0.7; the same report's
retire-meshclaw --forcefinding is a separate companion-plugin issue and is not part of this change.Pattern harvest
Rule candidate: review-prompt
Pattern: a repair path validates the very state it exists to replace (precondition on the prior value blocks the only transition out of an invalid prior value)
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)