style: applied uniform style across the new rag and mcp hook implementation

This commit is contained in:
Dark-Alex-17 committed 2026-09-17 14:39:33 -06:00
1 parent 74e7bc54eb
commit 08dfbac6f6
7 files changed
+13 -64

No files matched your search

-3
View File
@@ -356,9 +356,6 @@ impl Agent {
}
};
// Resolved from the config under construction: no context carries
// this agent yet, but its whitelist gate and hooks must still apply
// to the RAG builds below.
let rag_sync_hooks = RagSyncHooks::resolve_for_agent(
&app.hooks,
&agent_config.global_hooks,
-11
View File
@@ -95,22 +95,11 @@ impl McpFactory {
) -> Result<Arc<ConnectedServer>> {
let key = McpServerKey::from_spec(name, spec);
// Reuse of a live server fires no hooks; only a real spawn below
// reports anything. The live probe and the reconnect read share one
// lock section so a racing first connect that inserts between them
// cannot be misreported as a reconnect. The spawn await below stays
// outside the lock, so two racing first connects may still both
// spawn (no singleflight); the loser then fires a second plain
// `connected` (no RECONNECT flag) and its insert overwrites the
// winner's map entry.
let reconnect = {
let map = self.active.lock();
if let Some(existing) = map.get(&key).and_then(|weak| weak.upgrade()) {
return Ok(existing);
}
// The live probe failed, so an entry still present for this key
// is a dead weak: the key was connected earlier in this process
// and the spawn below is a reconnect.
map.contains_key(&key)
};
+5 -4
View File
@@ -54,6 +54,7 @@ use crate::hooks::{self, HookEvent};
use anyhow::{Context, Error, Result, bail};
use colored::Colorize;
use gman::providers::SupportedProvider;
use hooks::{McpServerHooks, RagSyncHooks};
use indexmap::IndexMap;
use indoc::formatdoc;
use inquire::{Confirm, MultiSelect, Text, list_option::ListOption, validator::Validation};
@@ -4411,7 +4412,7 @@ impl RequestContext {
if !server_ids.is_empty() {
let app_ref = &self.app;
let mcp_hooks = hooks::McpServerHooks::resolve(self);
let mcp_hooks = McpServerHooks::resolve(self);
let acquire_all = async {
let mut handles = Vec::new();
let mut auth_required = Vec::new();
@@ -5350,7 +5351,7 @@ impl RequestContext {
let vault = self.app.vault.clone();
let rag_cache = self.rag_cache();
let working_mode = self.working_mode;
let sync_hooks = hooks::RagSyncHooks::resolve(self);
let sync_hooks = RagSyncHooks::resolve(self);
let (rag, rag_key): (Arc<Rag>, Option<RagKey>) = match rag {
None => {
@@ -5484,7 +5485,7 @@ impl RequestContext {
false,
&self.app.config,
abort_signal,
hooks::RagSyncHooks::resolve(self),
RagSyncHooks::resolve(self),
)
.await?;
self.rag = Some(Arc::new(rag));
@@ -5521,7 +5522,7 @@ impl RequestContext {
true,
&self.app.config,
abort_signal,
hooks::RagSyncHooks::resolve(self),
RagSyncHooks::resolve(self),
)
.await?;
self.rag = Some(Arc::new(rag));