Bound model-visible adapter metadata #143
No reviewers
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!143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "agent/107-bound-adapter-metadata"
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?
Closes #107.
Problem
Trusted external-context adapters may return model-visible metadata during
context_register_adapter/4. The core previously required only a ground dict, so a buggy or malicious trusted adapter could publish an arbitrarily large descriptor outside the normal context output ceiling.Change
max_bytesregistration option as the complete adapter-metadata ceiling;context_metadata{...}descriptor with the same serialized-term UTF-8 accounting used by model-visible context term output;adapter_metadata_too_largeerrors containing observedbytesandmax_bytes;TDD
The regression test was committed before the implementation. Under the same
max_bytes(512)ceiling it first proves ordinary adapter metadata registers successfully, deletes that handle, then supplies a 4 KiB adapter-controlled payload and requires a structured rejection. It immediately unregisters the adapter after the rejection; successful unregister proves no context handle leaked from the failed registration.The existing suite continues to cover that ordinary context source data cannot install executable adapter callbacks.
Validation
This runtime does not have SWI-Prolog installed locally, so the exact-head GitHub Actions gate is authoritative. The PR remains unmerged until those checks are observed green.