Skip to content

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

fix(mcp): retry failed server refresh once before falling back to stale rows

Steven Enamakelda96456f7a1c
diff --git a/app/src/components/channels/mcp/CustomServersPanel.tsx b/app/src/components/channels/mcp/CustomServersPanel.tsx
index 67bebca9f3..148aee2ebd 100644
--- a/app/src/components/channels/mcp/CustomServersPanel.tsx
+++ b/app/src/components/channels/mcp/CustomServersPanel.tsx
@@ -66,16 +66,18 @@ const CustomServersPanel = ({
// already committed by the time we refresh, so a reload failure must not
// reject back into the form and report the add/edit as failed (letting the
// user "retry" an operation that already succeeded). A failed reload — signaled
- // by a `false` result or, defensively, a rejection — is logged; the next 5s
- // status poll reconciles the view. It is not surfaced as a mutation failure.
+ // by a `false` result or, defensively, a rejection — is retried once. It is
+ // not surfaced as a mutation failure.
const safeRefresh = async (stage: string, serverId: string) => {
- try {
- const ok = await onChanged();
- if (!ok)
- log('%s refresh incomplete for %s — rows may be stale until next poll', stage, serverId);
- } catch (err) {
- log('%s refresh threw for %s: %o', stage, serverId, err);
+ for (let attempt = 1; attempt <= 2; attempt += 1) {
+ try {
+ if (await onChanged()) return;
+ log('%s refresh incomplete for %s (attempt %d)', stage, serverId, attempt);
+ } catch (err) {
+ log('%s refresh threw for %s (attempt %d): %o', stage, serverId, attempt, err);
+ }
}
+ log('%s refresh still incomplete for %s — rows may remain stale', stage, serverId);
};
const handleAdd = async (params: CustomServerParams) => {
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index 452d6415ae..1bea341a94 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -354,6 +354,11 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| 8.4.4 | Same-Topic Contradiction (replace) | RU | `src/openhuman/agent/tools/save_preference_tests.rs::recategorising_moves_pref_between_namespaces` | ✅ | `ON CONFLICT REPLACE`; a topic lives in exactly one scope |
| 8.4.5 | Cross-Topic Contradiction Surfacing | RU | `src/openhuman/agent/tools/save_preference_tests.rs::save_surfaces_related_preference_for_contradiction_check` | ✅ | Related prefs surfaced in the tool result for the chat agent to resolve |
| 8.4.6 | vector_chunks Model-Signature Recall Guard | RU | `src/openhuman/memory/store/namespace_store/query_tests.rs::vector_recall_excludes_other_model_signature` | ✅ | Excludes cross-model vectors; dim-guards legacy rows |
+| 8.4.7 | Lane C — Auto-recall of User Facts (gated) | RU | `src/openhuman/memory/auto_recall/{gate_tests,auto_recall_tests}.rs`, `src/openhuman/agent/harness/session/turn_tests_part_05_tests.rs::auto_recall_*` | ✅ | #6040: lexical gate, bounded `fast_retrieve` via the guard, block rides the user message; `hooks.auto_recall` switch |
+| 8.4.8 | Lane C Boot Warm-up | RU | `src/openhuman/memory/auto_recall/warm_tests.rs` | ✅ | One bounded retrieval after the memory module loads; failure/timeout are log-only |
+| 8.4.9 | Memory-Access Instruction (ungated) | RU | `src/openhuman/agent/harness/session/builder/builder_tests_part_01_tests.rs::memory_access_instruction_is_present_with_learning_disabled`, `src/openhuman/agent/learning/prompt_sections_tests_2_tests.rs` | ✅ | Added whenever a retrieval tool is visible, independent of `learning.enabled`; forbids claiming absence unsearched |
+| 8.4.10 | Memory-Write Instruction + `memory_store` defaults | RU | `src/openhuman/agent/learning/prompt_sections_tests_2_tests.rs::memory_write_*`, `src/openhuman/agent/learning/prompt_sections_tests_2_tests.rs::write_tool_gate_*`, `src/openhuman/agent/harness/session/builder/builder_tests_part_03_tests.rs::memory_write_instruction_*`, `src/openhuman/memory/tools/store_tests.rs::resolve_*` | ✅ | #6048: "remember X" must be a write before the reply; section keyed on write-tool visibility, not `learning.enabled`; `memory_store` namespace/key optional |
+| 8.4.11 | Lane C — Notes leg (`global` namespace) + hint | RU | `src/openhuman/memory/auto_recall/auto_recall_tests_part_02_tests.rs` (all), `src/openhuman/memory/auto_recall/auto_recall_tests.rs::from_guard_reads_through_the_guarded_retrieval_family`, `src/openhuman/agent/harness/session/turn_tests_part_05_tests.rs::auto_recall_injects_a_note_written_by_memory_store_when_the_tree_is_empty` | ✅ | #6063: a fact `memory_store` filed in `global` is recalled through `recall_namespace_scored` beside the tree walk (per-leg budget, absolute 0.35 floor, notes render first, `ExternalSync`/connector-keyed notes wrapped); block opens with the "pre-fetched, not a search" hint |
### 8.5 Long-term Goals
@@ -491,7 +496,8 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| 11.1.13 | MCP HTTP-remote auth (token / Bearer / OAuth) + redirect resolution | RU/VU | `src/openhuman/mcp/registry/connections.rs` (`build_http_auth*`, `resolve_final_url`), `src/openhuman/mcp/registry/oauth.rs` (PKCE/token/bundle/callback port), `app/src/components/channels/mcp/ConnectAuthModal.test.tsx` (#3495) | ✅ | Bearer/raw scheme + custom headers; redirect-final-URL resolved before auth; OAuth dynamic client registration + PKCE + refresh; tokens MERGED into stored env; credentials stored encrypted locally, never sent to backend |
| 11.1.14 | MCP "Help & configure" assistant | VU/RU | `app/src/components/channels/mcp/ConfigAssistantPanel.test.tsx`, `app/src/components/channels/mcp/ConfigHelpModal.test.tsx`, `src/openhuman/mcp/registry/ops.rs` (`invoke_config_assist_agent`) (#3495) | ✅ | Server-specific prompt offered as a one-click "Get step-by-step setup help" action (on-demand, no longer auto-run on open — #4272), running an agentic turn scoped to web_search_tool/web_fetch/curl only; markdown-rendered reply; per-MCP chat persisted while on the detail page |
| 11.1.15 | Agent uses connected MCP servers in chat | RU | `src/openhuman/agent/registry/agents/loader.rs` (`orchestrator_subagents_include_mcp_agent`, `mcp_agent_drives_connected_servers_without_install_or_shell`, `planner_has_readonly_mcp_discovery_not_execute`), `src/openhuman/agent/registry/agents/orchestrator/prompt.rs` (`connected_mcp_block_*`), `src/openhuman/agent/harness/session/turn_tests.rs` (`mcp_announcement_fires_once_for_new_server`), `src/openhuman/mcp/registry/{tools,connections}.rs` (#3495) | ✅ | `use_mcp_server` delegate → `mcp_agent` worker (discover→list→call); `mcp_registry_list_tools` read-only discovery; orchestrator `## Connected MCP Servers` prompt block + mid-session connect announcement on the user turn; planner read-only MCP discovery (no `tool_call`) |
-| 11.1.16 | Custom (hand-entered) MCP servers | RU/RI/VU | `src/openhuman/mcp/registry/custom.rs`, `src/openhuman/mcp/registry/store.rs` (`custom_provenance_round_trips`, `pre_migration_rows_backfill_to_registry_provenance`, `update_server_custom_fields_preserves_identity`), `tests/json_rpc_e2e.rs` (`mcp_clients_lifecycle` steps 8–12), `app/src/components/channels/mcp/CustomServersPanel.test.tsx`, `app/src/components/channels/mcp/CustomServerFormModal.test.tsx` | ✅ | `add_custom`/`update_custom` for servers no registry lists: stdio command+args or http_remote URL, validated (non-http scheme, reserved `__` keys, and case-variant duplicate headers rejected); `ServerProvenance` marks catalog vs hand-entered, backfills legacy rows to `registry`, and blocks `install` from clobbering a custom row; `update_custom` refuses registry installs and keeps identity across a rename; env values write-only — blank submitted value keeps the stored secret (case-insensitively for headers), removed row deletes the key; stored credentials (including `__oauth__`) are dropped and must be re-entered when the credential scope changes (transport switch or http origin change), never carried across; row + env writes are one serializable `BEGIN IMMEDIATE` transaction |
+| 11.1.16 | MCP supervisor observability (Event Log + notifications) | RU | `src/openhuman/mcp/registry/supervisor_events_tests.rs`, `src/core/events_tests.rs`, `src/openhuman/desktop/notifications/bus_tests_2_tests.rs`, `app/src/components/settings/panels/__tests__/EventLogPanel.test.tsx`, `vendor/tinymcp/crates/tinymcp/src/registry/supervisor/test.rs` (#5931) | ✅ | Supervisor tick reports map to MCP lifecycle events, Event Log details, and episode-aware notifications. |
+| 11.1.17 | Custom (hand-entered) MCP servers | RU/RI/VU | `src/openhuman/mcp/registry/custom.rs`, `src/openhuman/mcp/registry/store.rs` (`custom_provenance_round_trips`, `pre_migration_rows_backfill_to_registry_provenance`, `update_server_custom_fields_preserves_identity`), `tests/json_rpc_e2e.rs` (`mcp_clients_lifecycle` steps 8–12), `app/src/components/channels/mcp/CustomServersPanel.test.tsx`, `app/src/components/channels/mcp/CustomServerFormModal.test.tsx` | ✅ | `add_custom`/`update_custom` for servers no registry lists: stdio command+args or http_remote URL, validated (non-http scheme, reserved `__` keys, and case-variant duplicate headers rejected); `ServerProvenance` marks catalog vs hand-entered, backfills legacy rows to `registry`, and blocks `install` from clobbering a custom row; `update_custom` refuses registry installs and keeps identity across a rename; env values write-only — blank submitted value keeps the stored secret (case-insensitively for headers), removed row deletes the key; stored credentials (including `__oauth__`) are dropped and must be re-entered when the credential scope changes (transport switch or http origin change), never carried across; row + env writes are one serializable `BEGIN IMMEDIATE` transaction |
<!-- 11.1.9 Vault Markdown Writes — removed: Knowledge Vaults dropped (vault domain + VaultPanel deleted). -->
@@ -624,11 +630,28 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| 15.1.8 | Profile editor isolation UI (toggles, path rows) | VU | `app/src/components/settings/panels/ProfileEditorPage.test.tsx` | ✅ | Default-off render, dispatch payload, hydration, path rows shown/hidden |
| 15.1.9 | Cron profile picker UI (assign, clear, deleted fallback) | VU | `app/src/components/settings/panels/cron/` tests, `app/src/services/api/agentProfilesApi.test.ts` | ✅ | Create with/without id, edit prefill, clear→null, deleted-profile preserved, list label fallback |
+## 16. Embedded Library Harness (`openhuman_core::Harness`)
+
+### 16.1 One-call agent turns for a host process
+
+| ID | Feature | Layer | Test path(s) | Status | Notes |
+| ------ | -------------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
+| 16.1.1 | End-to-end turn with no transport and no background services | RI | `tests/harness_embed.rs` | ✅ | Real login-free `HostKind::Library` turn against a wiremock provider; asserts no RPC listener was bound and session/workspace isolation |
+| 16.1.2 | Turn wire contract (`TurnRequest` ↔ `inference.agent_chat`) | RU | `src/embed/agent_tests.rs` | ✅ | Field names and absent-option omission are checked against the registered controller schema |
+| 16.1.3 | Embedder-supplied config reaches handlers, not just boot | RU | `src/core/runtime/context.rs` (`*_embedder_config`) | ✅ | `CoreBuilder::config` is published on `CoreContext` and preferred by handler config resolution |
+| 16.1.4 | Workspace lifetime and credential isolation | RU | `src/embed/harness/workspace_tests.rs` | ✅ | Ephemeral workspace removal, persistent `Dir`, and safe `action_dir`/`config_path` placement |
+| 16.1.5 | Access tier sets the autonomy level **and** the turn origin | RU | `src/embed/harness/access_tests.rs` | ✅ | Pins fail-closed acting tools and `full()` access behavior |
+| 16.1.6 | Per-call provider route is never persisted | RU | `src/embed/harness/provider_tests.rs`, `src/embed/harness/builder_tests.rs` | ✅ | Ephemeral routes do not repoint the operator's installed provider configuration |
+| 16.1.7 | Session store (`Core::auth`) | RU | `src/embed/auth_tests.rs` | ✅ | Local-session token shape and signed-in/signed-out payload decoding |
+| 16.1.8 | MCP servers declared programmatically | RU | `src/embed/harness/mcp_tests.rs` | ✅ | stdio/HTTP exclusivity, env accumulation, filters, and auth |
+| 16.1.9 | Skill bundles installed into the workspace | RU | `src/embed/harness/skills_tests.rs` | ✅ | Bundles are copied rather than symlinked and inherit rules are enforced |
+| 16.1.10 | One harness per process | RU+RI | `src/embed/harness/builder_tests.rs`, `tests/harness_embed.rs` | ✅ | A second build returns `AlreadyRunning`; failed builds release the slot |
+
## Summary
| Status | Count |
| ---------------- | ------------------------------------------------ |
-| ✅ Covered | 79 |
+| ✅ Covered | 89 |
| 🟡 Partial | 27 |
| ❌ Missing | 26 |
| 🚫 Manual smoke | 11 |