feat(governor): Lane H PR-4 — PressureBroker → governor pure-function bridge#1369
Merged
joelteply merged 1 commit intoMay 17, 2026
Merged
Conversation
f2dec2c to
aedc0f8
Compare
… bridge
Pure-function bridge between PressureBroker's PressureAlert surface
(disk/memory pool eviction events) and the governor's typed
PressureSignal cascade input. Per GENOME-FOUNDRY-SENTINEL.md Part 11
line 1121: "PressureBroker informs the SubstrateGovernor. Pressure
signals from the broker drive the governor's adjustment cascade."
Scope:
- `alert_to_signal(&PressureAlert) -> Option<PressureSignal>` — pure
mapping. High/Critical tier → SystemMemHigh{used_pct}; Normal/
Warning/unknown → None.
- `governor_alert_sink(Arc<dyn SubstrateGovernor>) -> AlertSink` —
factory that wraps a governor as an AlertSink the broker can register
via `PressureBroker::add_alert_sink`. Sink derives the signal and
forwards via `governor.on_pressure_signal` when Some; drops when None.
NOT in this PR (deferred to PR-5):
- Wiring the sink into PressureBrokerModule's boot path. The bridge is
the data-side primitive; the wiring is a separate concern.
- Pool-name-aware mapping (vram → VRAMHigh, etc.). Today's broker pools
are all memory-adjacent (Docker disk, HF cache, future VRAM via
GpuMemoryManager); SystemMemHigh is the conservative single-mapping
the cascade reacts to identically. Refinement when pool tier_name
conventions stabilize.
Discipline:
- No silent default-on-error. Mapping is total — every alert maps to
either Some(signal) or None explicitly.
- Pressure clamped to [0.0, 1.0] before percent conversion so transient
over-budget snapshots map to 100% and negative artifacts map to 0%
rather than wrapping via `as u8`.
- Sink forwards via `Arc<dyn SubstrateGovernor>` (object-safe trait) so
the bridge does not depend on LocalSubstrateGovernor concretely.
Tests (14, all passing):
- normal/warning/unknown tiers -> None (4 tests)
- high/critical tiers -> SystemMemHigh with rounded used_pct (3 tests)
- pressure clamping above 1.0 + below 0.0 + rounding (3 tests)
- sink forwarding high/critical + non-forwarding normal/warning (4 tests)
- sink survives construction-scope drop + multi-call ordering (2 tests)
Lane H 8-PR stack progress: PR-1 (#1330/1331) -> PR-2 (#1345) -> PR-3a
(#1352) -> PR-3b (#1354) -> PR-3c1 (#1356) -> PR-3c2 (#1360) -> PR-3c3
(#1364) -> PR-3c4 (#1365) -> **PR-4 (this PR)**. PR-3d governor file
watcher in flight from codex on parallel branch (no overlap).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aedc0f8 to
2f64811
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pure-function bridge between
PressureBroker'sPressureAlertsurface (disk/memory pool eviction events) and the governor's typedPressureSignalcascade input. Per GENOME-FOUNDRY-SENTINEL.md Part 11 line 1121: "PressureBroker informs the SubstrateGovernor. Pressure signals from the broker drive the governor's adjustment cascade."Scope
alert_to_signal(&PressureAlert) -> Option<PressureSignal>— pure mapping.High/Criticaltier →SystemMemHigh{used_pct};Normal/Warning/unknown →None.governor_alert_sink(Arc<dyn SubstrateGovernor>) -> AlertSink— factory that wraps a governor as anAlertSinkthe broker can register viaPressureBroker::add_alert_sink. Sink derives the signal and forwards viagovernor.on_pressure_signalwhenSome; drops whenNone.NOT in this PR (deferred)
PressureBrokerModule's boot path — separate concern. The bridge is the data-side primitive; wiring is PR-5.VRAMHigh, docker → potentialDiskHighvariant). Today's broker pools are all memory-adjacent (Docker disk, HF cache, future VRAM via GpuMemoryManager);SystemMemHighis the conservative single-mapping the cascade reacts to identically. Refinement when pooltier_nameconventions stabilize.Discipline
Some(signal)orNoneexplicitly.as u8.Arc<dyn SubstrateGovernor>(object-safe trait) so the bridge does not depend onLocalSubstrateGovernorconcretely.Tests (14, all passing)
SystemMemHighwith roundedused_pct(3 tests)Full governor suite: 152 passing (138 prior + 14 new).
Lane H 8-PR stack progress
PR-1 (#1330/1331) → PR-2 (#1345) → PR-3a (#1352) → PR-3b (#1354) → PR-3c1 (#1356) → PR-3c2 (#1360) → PR-3c3 (#1364) → PR-3c4 (#1365) → PR-4 (this PR). PR-3d governor file watcher in flight from codex (#1368, parallel branch, no overlap).
Test plan
cargo test --package continuum-core --lib --features metal,accelerate governor::pressure_bridge::— 14/14 passcargo test --package continuum-core --lib --features metal,accelerate governor::— 152/152 pass (no regressions)🤖 Generated with Claude Code