The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(memory-tree): expose the scheduler gate's live pause on pipeline_status
Shanu5c58db78e934
diff --git a/app/src/components/intelligence/sourcePipelineStatus.test.ts b/app/src/components/intelligence/sourcePipelineStatus.test.tsindex 58dee24378..bb2bc778b8 100644--- a/app/src/components/intelligence/sourcePipelineStatus.test.ts+++ b/app/src/components/intelligence/sourcePipelineStatus.test.ts@@ -293,6 +293,10 @@ describe('deriveSourcePipelineHealth — vectors pending vs stored without vectoit.each([{ label: 'is_paused', pipeline: makePipeline({ is_paused: true }) },{ label: "status 'paused'", pipeline: makePipeline({ status: 'paused', reason: 'gate off' }) },+ {+ label: 'gate_paused (live policy, mode still auto)',+ pipeline: makePipeline({ gate_paused: true, gate_pause_reason: 'on_battery' }),+ },])('reads a paused scheduler ($label) as stuck even while a chain is armed and ingest is fresh',({ pipeline }) => {diff --git a/app/src/components/intelligence/sourcePipelineStatus.ts b/app/src/components/intelligence/sourcePipelineStatus.tsindex 492a8bbf7c..cd51b769b0 100644--- a/app/src/components/intelligence/sourcePipelineStatus.ts+++ b/app/src/components/intelligence/sourcePipelineStatus.ts@@ -123,10 +123,12 @@ export function deriveSourcePipelineHealth(// - the global "semantic recall degraded" latch (no usable provider): hard;// - an embeddings-family blocking cause: the provider cannot write vectors,// so the backlog will not drain: hard;- // - a paused scheduler (`is_paused` / `status === 'paused'`): the chain may- // be armed and ingest may still be writing, but no worker will embed- // anything until the user resumes, so "shortly" would be a promise nobody- // is keeping. Pending chunks are hard until then;+ // - a paused scheduler: the configured `off` mode (`is_paused` /+ // `status === 'paused'`) or the gate's live policy (`gate_paused`: on+ // battery, CPU pressure, signed out). The chain may be armed and ingest+ // may still be writing, but no worker will embed anything until the gate+ // lifts, so "shortly" would be a promise nobody is keeping. Pending+ // chunks are hard until then;// - otherwise pending chunks are soft while the engine reports a re-embed// chain with rows to process, OR this source's newest chunk landed inside// the core's own `recent` window (≤ 5 min: ingest is still writing and@@ -141,7 +143,8 @@ export function deriveSourcePipelineHealth(const pending = status?.chunks_pending ?? 0;const recallLatched = degraded?.semantic_recall === true;const embeddingsBlocked = causeCode !== null && EMBEDDINGS_BLOCKING_CAUSES.has(causeCode);- const paused = pipeline?.is_paused === true || pipeline?.status === 'paused';+ const paused =+ pipeline?.is_paused === true || pipeline?.status === 'paused' || pipeline?.gate_paused === true;const draining =!paused &&(backfill?.in_progress === true ||diff --git a/app/src/utils/tauriCommands/memoryTree.ts b/app/src/utils/tauriCommands/memoryTree.tsindex 3393468e31..efec2193d9 100644--- a/app/src/utils/tauriCommands/memoryTree.ts+++ b/app/src/utils/tauriCommands/memoryTree.ts@@ -924,6 +924,17 @@ export interface MemoryTreePipelineStatus {is_syncing: boolean;/** Convenience flag: scheduler-gate mode is `off`. */is_paused: boolean;+ /**+ * The scheduler gate's live verdict (openhuman#6025 review): `true` while+ * its policy is `paused` whichever mode is configured — in `auto` that is+ * on battery with `require_ac_power`, under CPU pressure, or signed out —+ * so every LLM-bound worker, the embed backfill included, is blocked right+ * now. `is_paused` stays the configured `off` mode (the panel's toggle).+ * Absent from a core that predates the field.+ */+ gate_paused?: boolean;+ /** Why the gate is paused: `user_disabled` | `on_battery` | `cpu_pressure` | `signed_out` | `unknown`. */+ gate_pause_reason?: string | null;/*** #002 (FR-002/FR-005): degradation snapshot. Optional for back-compat with* older cores that don't emit it (the Rust field is `#[serde(default)]`);diff --git a/src/openhuman/memory/tree/tree/rpc_part_02.rs b/src/openhuman/memory/tree/tree/rpc_part_02.rsindex e59322c66f..40fbb3109a 100644--- a/src/openhuman/memory/tree/tree/rpc_part_02.rs+++ b/src/openhuman/memory/tree/tree/rpc_part_02.rs@@ -193,6 +193,20 @@ pub struct PipelineStatusResponse {/// Convenience flag: scheduler-gate is in `off` mode, so all LLM-bound/// background work is paused cooperatively.pub is_paused: bool,+ /// The scheduler gate's *live* verdict: `true` while its policy is+ /// `Paused`, whichever mode is configured — in `auto` that is on battery+ /// with `require_ac_power`, under CPU pressure, or while signed out — so+ /// every LLM-bound worker, the embed backfill included, sits behind+ /// `wait_for_capacity` right now. `is_paused` stays the configured `off`+ /// mode (the panel's toggle). Additive: `#[serde(default)]` keeps older+ /// clients deserialising the response (openhuman#6025 review).+ #[serde(default)]+ pub gate_paused: bool,+ /// Why the gate is paused, when it is: `user_disabled`, `on_battery`,+ /// `cpu_pressure`, `signed_out` or `unknown` — the module host's+ /// `scheduler_policy` spells them the same way. `None` while running.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub gate_pause_reason: Option<String>,/// #002 (FR-002/FR-004): "the pipeline ran but output quality is reduced"/// — `semantic_recall` true when embeddings were skipped (no usable/// provider, so recall falls back to recency), `structure` true when@@ -275,6 +289,36 @@ fn latest_quarantine(})}+/// The scheduler gate's live verdict, mapped for the wire.+///+/// `is_paused` is the configured `off` mode (the panel's toggle); this is+/// what the workers see right now. In `auto` the gate also pauses on battery+/// with `require_ac_power`, under CPU pressure, or while signed out, and an+/// armed embed backfill then waits in `wait_for_capacity` with its+/// `in_progress` flag still up — a row must not promise vectors "shortly" on+/// that flag alone (openhuman#6025 review). Reason slugs match the module+/// host's `scheduler_policy` so both surfaces spell a pause the same way.+fn gate_pause_state(+ policy: crate::openhuman::cron::scheduler_gate::Policy,+) -> (bool, Option<String>) {+ use crate::openhuman::cron::scheduler_gate::{PauseReason, Policy};+ match policy {+ Policy::Paused { reason } => (+ true,+ Some(+ match reason {+ PauseReason::UserDisabled => "user_disabled",+ PauseReason::OnBattery => "on_battery",+ PauseReason::CpuPressure => "cpu_pressure",+ PauseReason::SignedOut => "signed_out",+ PauseReason::Unknown => "unknown",+ }+ .to_string(),+ ),+ ),+ Policy::Aggressive | Policy::Normal | Policy::Throttled => (false, None),+ }+}/// Aggregates `list_sources` + `count_by_status` + a recursive disk-size/// probe into the [`PipelineStatusResponse`] the UI status panel renders./// All blocking work is dispatched onto `spawn_blocking` so the async@@ -340,6 +384,8 @@ pub async fn pipeline_status_rpc(})?;let is_paused = config.scheduler_gate.mode == SchedulerGateMode::Off;+ let (gate_paused, gate_pause_reason) =+ gate_pause_state(crate::openhuman::cron::scheduler_gate::gate::current_policy());let is_syncing = pipeline_jobs.running > 0;// #002: read the degradation snapshot (set by the embed / extract stages)@@ -436,6 +482,8 @@ pub async fn pipeline_status_rpc(pipeline_jobs,is_syncing,is_paused,+ gate_paused,+ gate_pause_reason,degraded,first_blocking_cause,extraction_coverage,diff --git a/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rs b/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rsindex 280c698ad3..99590ea95a 100644--- a/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rs+++ b/src/openhuman/memory/tree/tree/rpc_tests_part_02_tests.rs@@ -476,6 +476,9 @@ async fn pipeline_status_returns_idle_for_empty_store() {assert_eq!(out.pipeline_jobs.failed, 0);assert!(!out.is_syncing);assert!(!out.is_paused);+ // No gate sampler runs in unit tests, so the live policy is `Normal`.+ assert!(!out.gate_paused);+ assert!(out.gate_pause_reason.is_none());assert_eq!(out.wiki_size_bytes, 0, "no content dir yet");assert!(out.reason.is_none());}@@ -598,3 +601,27 @@ async fn set_enabled_toggles_scheduler_gate_mode() {assert_eq!(on.mode, "auto");assert_eq!(cfg.scheduler_gate.mode, SchedulerGateMode::Auto);}++/// The live gate verdict rides on the wire beside the configured mode+/// (openhuman#6025 review): every pause reason maps to the slug the module+/// host reports, and every running policy maps to "not paused".+#[test]+fn gate_pause_state_maps_the_live_policy() {+ use crate::openhuman::cron::scheduler_gate::{PauseReason, Policy};++ for (reason, slug) in [+ (PauseReason::UserDisabled, "user_disabled"),+ (PauseReason::OnBattery, "on_battery"),+ (PauseReason::CpuPressure, "cpu_pressure"),+ (PauseReason::SignedOut, "signed_out"),+ (PauseReason::Unknown, "unknown"),+ ] {+ assert_eq!(+ super::gate_pause_state(Policy::Paused { reason }),+ (true, Some(slug.to_string()))+ );+ }+ for policy in [Policy::Aggressive, Policy::Normal, Policy::Throttled] {+ assert_eq!(super::gate_pause_state(policy), (false, None));+ }+}