Execute provider actions through a real transport and executor #17

Merged
Breadway merged 1 commit from feature/ram-48-provider-execution into main 2026-10-11 16:18:01 +08:00
Owner

Closes RAM-48.

Provider relief was the biggest memory win breadram had and it could not happen: the adapters could describe an operation and the coordinator could execute one, but there was no transport to send it and no executor to turn an AdapterOperation into a write.

What this adds

  • adapter::HttpTransport, the real bounded loopback transport: 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. Transport carries probes and OperationTransport carries writes, so a read-only path cannot be handed a write request. 13 tests.
  • adapter::AdapterExecutor, an Executor for 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 anything is sent, applies, confirms with a read-only probe, and reports the memory the provider holds before and after so the effect is measured. 17 tests.
  • coordinator::ChainedExecutor, so host controls and provider actions run in one pass, dispatched by what each executor claims, with the first real measurement winning on either memory axis. 4 tests.
  • Adapter observation, so a provider is read before it is reasoned about: WorkloadAdapter::observe with ProbeOutcome, AdapterRegistry::observe, adapter::refresh_adapters, and inventory_is_current. The daemon refreshes every configured endpoint once per tick, records a failed read as a failure rather than leaving the previous success in place, and an empty current reading is a measured zero rather than a missing reading.
  • A journal entry now carries the consequence: when an executor returns a note it is recorded with the entry, so the cold start a model release costs is in the journal, not only in the pass that reported it.
  • Wire-level tests (crates/breadram-core/tests/provider_execution.rs) 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; monitor mode writing nothing.

No provider is installed on this host, so the end-to-end release is proven over a real socket against the fake, and the daemon's own read path is covered by a unit test against a closed port.

Verification

cargo fmt --all --check clean, cargo clippy --workspace --all-targets -- -D warnings clean, cargo test --workspace 376 passed, 0 failed (up from 349).

Deviations, stated rather than dropped

  • unix: endpoints are not supported, and say so: the hook protocol is a process protocol rather than HTTP, and needs a framed message format and a permission check that does not exist yet (RAM-15).
  • The requested host delta on a provider action is the plan's estimate from the workload's memory, while the provider knows its own figure. Both are now recorded in the entry rather than one being silently preferred.
  • With the default TrackingCompleteness::Unknown a resident model reports Active, so nothing is planned against it. Correct and conservative, but it means the release path is planned-never-executed until request tracking is declared: noted on RAM-45.
Closes RAM-48. Provider relief was the biggest memory win breadram had and it could not happen: the adapters could describe an operation and the coordinator could execute one, but there was no transport to send it and no executor to turn an `AdapterOperation` into a write. ## What this adds - **`adapter::HttpTransport`**, the real bounded loopback transport: 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. `Transport` carries probes and `OperationTransport` carries writes, so a read-only path cannot be handed a write request. 13 tests. - **`adapter::AdapterExecutor`**, an `Executor` for 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 anything is sent, applies, confirms with a read-only probe, and reports the memory the provider holds before and after so the effect is measured. 17 tests. - **`coordinator::ChainedExecutor`**, so host controls and provider actions run in one pass, dispatched by what each executor claims, with the first real measurement winning on either memory axis. 4 tests. - **Adapter observation**, so a provider is read before it is reasoned about: `WorkloadAdapter::observe` with `ProbeOutcome`, `AdapterRegistry::observe`, `adapter::refresh_adapters`, and `inventory_is_current`. The daemon refreshes every configured endpoint once per tick, records a failed read as a failure rather than leaving the previous success in place, and an empty current reading is a measured zero rather than a missing reading. - **A journal entry now carries the consequence**: when an executor returns a note it is recorded with the entry, so the cold start a model release costs is in the journal, not only in the pass that reported it. - **Wire-level tests** (`crates/breadram-core/tests/provider_execution.rs`) 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; monitor mode writing nothing. No provider is installed on this host, so the end-to-end release is proven over a real socket against the fake, and the daemon's own read path is covered by a unit test against a closed port. ## Verification `cargo fmt --all --check` clean, `cargo clippy --workspace --all-targets -- -D warnings` clean, `cargo test --workspace` 376 passed, 0 failed (up from 349). ## Deviations, stated rather than dropped - `unix:` endpoints are not supported, and say so: the hook protocol is a process protocol rather than HTTP, and needs a framed message format and a permission check that does not exist yet (RAM-15). - The requested host delta on a provider action is the plan's estimate from the workload's memory, while the provider knows its own figure. Both are now recorded in the entry rather than one being silently preferred. - With the default `TrackingCompleteness::Unknown` a resident model reports `Active`, so nothing is planned against it. Correct and conservative, but it means the release path is planned-never-executed until request tracking is declared: noted on RAM-45.
Provider relief was the biggest memory win breadram had and it could not
happen: the adapters could describe an operation and the coordinator could
execute one, but there was no transport to send it and no executor to turn
an AdapterOperation into a write.

Add the real bounded loopback transport, an adapter executor on the same
Executor boundary as the host controls, and a chain so both run in one pass.
The daemon now reads every configured endpoint before policy runs and feeds
the answers back into the adapters, so a release is decided on a current
reading rather than a stale one and a failed read is never left as an old
success. A journal entry for a release now carries the cold start it costs.
Breadway deleted branch feature/ram-48-provider-execution 2026-10-11 16:18:01 +08:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Breadway/breadram!17
No description provided.