Clean loader idempotency state when tool registries are destroyed #67
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
PR #66 introduces deterministic per-registry loader idempotency using private
loaded_tool_pack/4state inrlm_tool_loader. The loader exposesrlm_tool_loader_forget_registry/1, and the new fixture suites call it during cleanup, but ordinaryrlm_tool:tool_registry_destroy/1does not currently notify the loader.Because registry IDs are monotonic and never reused, this is not a stale-registry correctness or authority bug. It is a process-lifetime retention edge for hosts that repeatedly create, load, and destroy many registries without explicitly calling the loader cleanup predicate.
Severity
Low correctness risk; moderate long-running-host hygiene risk if registry churn is high.
Reproduction / architecture failure
rlm_tool_loader.tool_registry_destroy/1without callingrlm_tool_loader_forget_registry/1.loaded_tool_pack/4until explicitly forgotten or process exit.Required invariant
Destroying a tool registry must eventually remove all loader idempotency bookkeeping owned by that registry without exposing loader internals or introducing a circular business-logic dependency.
Acceptance criteria
tool_registry_destroy/1or an established registry cleanup-hook mechanism clears loader state automatically whenrlm_tool_loaderis loaded.Scope exclusions
Discovered while auditing PR #66 / #48.
PR #66 merged as
9ba763d248f6e087b3ff01c651762997f02ee726; #67 remains intentionally open.The merged loader exposes explicit
rlm_tool_loader_forget_registry/1, and deterministic fixtures use it. Canonical registry IDs are monotonic/non-reused, so retained bookkeeping cannot be mistaken for authority/capability state of a future registry. The remaining defect is bounded to process-lifetime hygiene for hosts with repeated registry churn.Do not fold this into #52 unless the next implementation discovers a clean generic registry-destroy hook that is tiny and dependency-safe.
Inspected #67 while implementing #52 / PR #72. The current registry destroy path in
rlm_toolclears authority plus registry entries/aliveness, while loader idempotency is separate dynamicloaded_tool_pack/4state with an explicitrlm_tool_loader_forget_registry/1cleanup call used by loader tests.There is no existing generic registry-destroy cleanup hook for independent subsystems to contribute teardown. Closing #67 here would therefore require introducing a new cross-module registry lifecycle callback/contract, not merely wiring an already-existing hook, and that is not a natural dependency of the MCP declaration-policy slice.
Keeping #67 open intentionally. Remaining acceptance is still: destroy a tool registry -> loader idempotency state for that registry is reclaimed automatically, without creating a circular
rlm_tool/rlm_tool_loaderbusiness-logic dependency and with deterministic lifecycle coverage.