Execute provider actions through a real transport and executor #16
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?
Gap found while delivering RAM-12 (the Ollama adapter) and RAM-44 (the plan-execute loop).
Provider relief is the biggest memory win breadram has, and the pieces exist on both sides but do not meet:
AdapterOperation: request, expected deltas, note, confirmation) — RAM-12 landed one for Ollama and RAM-13/RAM-14 will add more.Executor, confirm it, measure the observed effect, and journal it — and RAM-44 now runs that loop in the daemon with the real host-control executor.AdapterRegistryis built fromconfig.providersand its activity evidence reaches the planner, so an idle-model release is planned.Nothing can perform a provider action:
Transport.breadram_core::adapter::probedefines the trait and only shipsScriptedTransport, so nothing can send an HTTP request to a loopback provider or a unix socket.AdapterOperationinto a request, evaluates its confirmation, and reports the measured memory change, and no composite that lets the daemon dispatch host controls and provider actions through oneExecutor.Scope
http(loopback) andunix:endpoints, per attempt timeout, response size cap,Connection: close, and no credential ever rendered.coordinator::Executor: revalidate the capability and the workload generation, refuse a release that needs proven idleness when activity is unknown, send the operation, evaluate the confirmation, and read the target's host and device memory before and after so the observed effect is real.Acceptance criteria
Blocked by nothing. Related: RAM-11/RAM-45 (leases and the gateway), RAM-13, RAM-14.
Started. Status, uncommitted in the working tree on
main@639f630:Done
The real transport,
breadram-core/src/adapter/http.rs: loopbackhttponly, one connection per request, connect/read/write timeouts,Connection: close, content-length and chunked parsing, a response size cap, credentials never rendered, and every resolved address tried in turn (localhostresolving to::1while the server listens on127.0.0.1was a real harness fault this caught).Transportcarries probes; a separateOperationTransportcarries writes, so a read-only path can never be handed a write request. 13 tests, all passing.fmtandclippy -D warningsclean,cargo test --workspace349 pass, 0 fail.Deviation from this card's scope
unix:is not supported, and it says so with a reason instead of failing silently. The hook protocol is a process protocol rather than HTTP, so a unix socket needs a framed message format and an ownership/permission check that does not exist yet. Recorded here rather than quietly dropped.Two gaps found while wiring the executor, both needed before provider relief can fire in production
OllamaAdapter::observe_loaded/observe_versionare called only from tests — the daemon never feeds probe results back, andoperation()returnsNoneunless the state is fresh. So an adapter executor wired up today would refuse every action as "nothing to release right now". Being fixed in this card: aWorkloadAdapter::observehook, aProbeOutcome, and a daemon refresh step each tick.TrackingCompleteness::Unknown) a loaded model reportsActive, so a release is refused however long the model has been resident. That is the conservative direction and is correct, but it means the release path is dead until tracking is declared — and today nothing declares it, because the gateway that would feed real leases is RAM-45. Until then, provider relief is planned-never-executed by design, not by accident. This is a separate decision (a config field, or RAM-45) and is not being invented inside this card.Implemented and verified, on
feature/ram-48-provider-executionata25f352(not pushed, so no PR yet).What landed
adapter/http.rs): loopbackhttponly, one connection per request, connect/read/write timeouts,Connection: close, content-length and chunked parsing, a response size cap, credentials never rendered, every resolved address tried in turn.Transportcarries probes andOperationTransportcarries writes, so a read-only path cannot be handed a write. 13 tests.adapter::AdapterExecutor: anExecutorfor the provider-backed actions. It revalidates the capability and the workload generation, refuses a release that needs proven idleness when activity is unknown, active, or too recent, checks every URL against the configured endpoints before sending, applies, confirms with a read-only probe, and reports the memory the provider holds before and after. 17 tests.coordinator::ChainedExecutor: host controls and provider actions in one pass, dispatched by what each claims, with the first real measurement winning on either memory axis. 4 tests.WorkloadAdapter::observeplusProbeOutcome,AdapterRegistry::observe,adapter::refresh_adapters, andinventory_is_current, so an adapter is handed the answers to the probes it asked for and an empty current reading is a measured zero rather than a missing reading. The daemon refreshes every configured endpoint once per tick before policy runs, and reports a read that failed instead of leaving the previous success in place.tests/provider_execution.rs, 5 tests) against an in-process fake Ollama service on a real socket: an idle release planned, performed, confirmed, and journalled with a measured effect; a backend with a live request never written to; an unreachable provider reported and unable to release; a provider that ignores the unload journalled as unconfirmed with a zero observed delta; monitor mode writing nothing.Verification
cargo fmt --all --checkclean,cargo clippy --workspace --all-targets -- -D warningsclean,cargo test --workspace376 passed, 0 failed, exit status 0 (up from 349).Deviations, stated rather than dropped
unix:is not supported, with a reason. The hook protocol is a process protocol, not HTTP.TrackingCompleteness::Unknowna resident model reportsActive, so nothing is planned against it. Correct and conservative, but it means the release path is planned-never-executed until request tracking is declared (RAM-45). Filed as the one open dependency rather than inferred inside this card.Left
Push and PR, then merge. No provider is installed on this host, so the daemon path itself is covered by build plus a unit test that drives the daemon's own read path against a closed port; the end-to-end release is proven at the core level over a real socket.
Merged as PR #17 into
mainat774fe49. Verified onmainafter the merge:cargo fmt --all --checkclean,cargo clippy --workspace --all-targets -- -D warningsclean,cargo test --workspace376 passed, 0 failed. Branch deleted.Provider relief is now executable end to end, with the two honest limits recorded above (no
unix:transport, and no release until request tracking is declared).