Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(task-sources): mark the dead agent tools, and test the gate through the scheduler

M3gA-Minde7bf9a240c2e
diff --git a/src/openhuman/integrations/task_sources/periodic_tests.rs b/src/openhuman/integrations/task_sources/periodic_tests.rs
index a77f348cde..a6f56909cb 100644
--- a/src/openhuman/integrations/task_sources/periodic_tests.rs
+++ b/src/openhuman/integrations/task_sources/periodic_tests.rs
@@ -87,27 +87,89 @@ fn no_provider_can_fetch_today() {
}
}
-/// The gate the periodic loop applies, asserted on the same predicate the
-/// loop reads. An unfetchable source is skipped before `run_source_once` can
-/// record a `store::record_fetch` row or publish `TaskSourceFetchFailed`.
-#[test]
-fn scheduler_skips_a_source_whose_provider_cannot_fetch() {
- for provider in [
+/// Drives a real `run_one_tick` over a persisted, enabled, due source whose
+/// provider cannot fetch, and asserts the tick recorded **nothing**.
+///
+/// The observable is the source row itself: the failure arm of
+/// `pipeline::run_source_once` calls `store::record_fetch`, which stamps
+/// `last_fetch_at` and `last_status`. Both staying `None` after a tick is
+/// proof the source was skipped before `run_source_once` ran.
+///
+/// This asserts through the scheduler rather than on the predicate, on
+/// purpose: a test that only checked `can_fetch()` would still pass if the
+/// guard were deleted from `run_one_tick`, which is the exact regression this
+/// PR exists to prevent.
+///
+/// The config is scoped onto the embedder seam that `load_config_with_timeout`
+/// prefers, so the tick reads this workspace instead of doing live, racy disk
+/// I/O against `~/.openhuman` — the same approach as `sandbox/schemas_tests.rs`.
+#[tokio::test]
+async fn a_tick_over_an_unfetchable_source_records_nothing() {
+ use crate::core::runtime::context::CoreContext;
+ use crate::core::runtime::DomainSet;
+
+ let tmp = tempfile::TempDir::new().expect("tempdir");
+ let workspace = tmp.path().join("workspace");
+ std::fs::create_dir_all(&workspace).expect("workspace");
+ let config = crate::openhuman::config::Config {
+ workspace_dir: workspace.clone(),
+ action_dir: workspace,
+ config_path: tmp.path().join("config.toml"),
+ ..Default::default()
+ };
+ assert!(
+ config.task_sources.enabled,
+ "precondition: the domain must be on, or the tick returns before the loop"
+ );
+
+ // `add_source` mints the id, and it is fresh per run — so the
+ // process-global last-poll map cannot make this source look recently
+ // polled because of another test.
+ let stored = super::super::store::add_source(
+ &config,
ProviderSlug::Github,
- ProviderSlug::Notion,
- ProviderSlug::Linear,
- ProviderSlug::Clickup,
- ] {
- let s = source_for("ts-gate-xyz", 1800, provider);
- assert!(
- s.enabled && is_due(&s),
- "precondition: this source would otherwise be polled"
- );
- assert!(
- !s.provider.can_fetch(),
- "so the ONLY thing standing between it and a recorded failure is the gate"
- );
- }
+ None,
+ None,
+ FilterSpec::Github {
+ repo: None,
+ labels: vec![],
+ assignee_is_me: true,
+ state: None,
+ fetch_mode: Default::default(),
+ extra: json!({}),
+ },
+ 1800,
+ SourceTarget::TodoOnly,
+ 25,
+ )
+ .expect("persist the source");
+ let id = stored.id.clone();
+
+ assert!(stored.enabled, "precondition: the source is enabled");
+ assert!(is_due(&stored), "precondition: the source is due");
+ assert!(
+ !stored.provider.can_fetch(),
+ "precondition: its provider has no fetch path, so the gate must skip it"
+ );
+
+ CoreContext::scope(
+ CoreContext::for_test_with_config(DomainSet::full(), config.clone()),
+ run_one_tick(),
+ )
+ .await
+ .expect("a tick must not fail");
+
+ let after = super::super::store::get_source(&config, &id).expect("re-read the source");
+ assert!(
+ after.last_fetch_at.is_none(),
+ "the tick must not have stamped a fetch time: {:?}",
+ after.last_fetch_at
+ );
+ assert!(
+ after.last_status.is_none(),
+ "and must not have recorded a status — a recorded failure is the bug: {:?}",
+ after.last_status
+ );
}
/// The other half: the manual path is untouched. `run_source_once` — which the
diff --git a/src/openhuman/integrations/task_sources/tools.rs b/src/openhuman/integrations/task_sources/tools.rs
index 69a7efe332..56d894002e 100644
--- a/src/openhuman/integrations/task_sources/tools.rs
+++ b/src/openhuman/integrations/task_sources/tools.rs
@@ -161,10 +161,11 @@ impl Tool for TaskSourceFetchTool {
}
fn description(&self) -> &str {
- "Fetch one task source now (by `id`) instead of waiting for its poll \
- interval. Returns counts of tasks fetched, newly routed, and skipped \
- as duplicates. Use when the user wants the latest issues/tasks pulled \
- immediately."
+ "UNAVAILABLE: the task-fetch path was removed with \
+ `ComposioProvider::fetch_tasks` (tinymemory v1.13.4), so this call always fails — \
+ do not call it. When it works again it fetches one task source now (by `id`) \
+ instead of waiting for its poll interval, returning counts of tasks fetched, \
+ newly routed, and skipped as duplicates."
}
fn parameters_schema(&self) -> serde_json::Value {
@@ -253,10 +254,11 @@ impl Tool for TaskSourcePreviewFilterTool {
}
fn description(&self) -> &str {
- "Dry-run a task-source `filter` for a `provider` and return the tasks \
- it would match, WITHOUT creating a persistent source or ingesting \
- anything. Use to validate a filter before `task_source_add`. The \
- `filter` object is provider-tagged (e.g. \
+ "UNAVAILABLE: the task-fetch path was removed with \
+ `ComposioProvider::fetch_tasks` (tinymemory v1.13.4), so this call always fails — \
+ do not call it. When it works again it dry-runs a task-source `filter` for a \
+ `provider` and returns the tasks it would match, WITHOUT creating a persistent \
+ source or ingesting anything. The `filter` object is provider-tagged (e.g. \
`{ \"provider\": \"github\", \"repo\": \"owner/name\", \"labels\": [\"bug\"] }`)."
}
diff --git a/src/openhuman/integrations/task_sources/tools_tests.rs b/src/openhuman/integrations/task_sources/tools_tests.rs
index 896537c0aa..02ddbd8b4d 100644
--- a/src/openhuman/integrations/task_sources/tools_tests.rs
+++ b/src/openhuman/integrations/task_sources/tools_tests.rs
@@ -61,3 +61,44 @@ fn parse_provider_rejects_unknown() {
let err = parse_provider(&json!({ "provider": "jira" })).expect_err("unknown provider");
assert!(err.to_string().contains("provider"));
}
+
+// ── the unavailability marker on the agent surface (issue #6118) ────────────
+
+/// The two agent tools backed by the dead fetch path must declare themselves
+/// unavailable in their **own** `description()`.
+///
+/// The `ControllerSchema` descriptions amended alongside this do not reach
+/// here: `Tool::description` is an independent hard-coded string, so a model
+/// choosing a tool reads this and nothing else. Without the marker the agent
+/// is still advised to call something that deterministically fails.
+#[test]
+fn the_two_dead_agent_tools_declare_themselves_unavailable() {
+ let fetch = TaskSourceFetchTool::new(cfg());
+ assert!(
+ fetch.description().starts_with("UNAVAILABLE:"),
+ "task_source_fetch cannot succeed: {}",
+ fetch.description()
+ );
+ let preview = TaskSourcePreviewFilterTool::new(cfg());
+ assert!(
+ preview.description().starts_with("UNAVAILABLE:"),
+ "task_source_preview_filter cannot succeed: {}",
+ preview.description()
+ );
+}
+
+/// The agent tools that still work must NOT carry the marker — the same
+/// both-directions check the schema tests make, so this cannot degenerate into
+/// marking the whole domain dead.
+#[test]
+fn the_working_agent_tools_are_not_marked_unavailable() {
+ assert!(!TaskSourceListTool::new(cfg())
+ .description()
+ .contains("UNAVAILABLE"));
+ assert!(!TaskSourceStatusTool::new(cfg())
+ .description()
+ .contains("UNAVAILABLE"));
+ assert!(!TaskSourceAddTool::new(cfg())
+ .description()
+ .contains("UNAVAILABLE"));
+}