§9 acceptance: grep-zero sweep — every internal x.ai/grok identifier renamed
The PRD's first acceptance gate now holds: grep -RinE '\bx\.ai\b|grok' crates/ --include='*.rs' → 0 matches (exempt: NOTICE and third-party license archives, README provenance, and the required 'Based on Grok Build Open Source' attribution, now sourced from version_attribution.txt). Wire-visible renames (both sides in this repo, changed in lockstep): - Auth method id 'grok.com' → 'kimi-code' (AuthMethodKind::KimiCode). - Every x.ai/* and _x.ai/* ACP ext method and meta key → kigi/* / _kigi/* (~200 names; grokShell → kigiShell). Session-file replay keeps a read-side alias for the legacy '_x.ai/session/update' method so existing updates.jsonl histories load; writes emit only the new name (both directions test-pinned). - Agent types grok-build* → kigi* with a documented legacy-prefix alias at resolution time so persisted sessions keep resolving. - ToolNamespace/BuiltinAgentName GrokBuild* → Kigi* (wire snake_case kigi/kigi_concise/kigi_hashline; schema regenerated); grok_build implementation dirs renamed to kigi*. - x-grok-* headers → x-kigi-*, __GROK_* sentinels → __KIGI_*, themes grokday/groknight → kigiday/kiginight (old persisted values fall back to the default theme), web_fetch allowlist xAI hosts → kimi.com + moonshot platforms, changelog CDN → this repo, grok-build changelog archives deleted. - BYOK default endpoint removed: [endpoints] api_base_url is now truly optional with NO default — consumers fail fast with the flag name when unset (no silent x.ai egress). Mock harnesses inject it explicitly. - System-prompt identity fixed: 'released by xAI' → 'an unofficial community CLI for Kimi' (template + regenerated encrypted form). Also repaired pre-existing grok-era test debt found by the sweep: the stale trace_classify default-model pin, the grok-pager UA label test, pty-harness stale-binary reuse and non-hermetic moonshot routing (a PTY test could previously reach the real api.moonshot.cn), and the outdated oauth fixture scope key. Gates: §9 grep 0; fmt clean; workspace check/clippy 0/0 (-D warnings); FULL cargo test --workspace: 234 suites, 21,961 passed, 0 failed; deny advisories ok.
This commit is contained in:
1 parent
86e3724310
commit
6f31415ed6
1056 files changed
+8410
-18307
No files matched your search
@@ -230,8 +230,8 @@ pub struct SubagentsConfig {
|
||||
///
|
||||
/// ```toml
|
||||
/// [subagents.models]
|
||||
/// explore = "grok-3-fast"
|
||||
/// plan = "grok-3"
|
||||
/// explore = "kigi-3-fast"
|
||||
/// plan = "kigi-3"
|
||||
/// ```
|
||||
#[serde(default)]
|
||||
pub models: std::collections::HashMap<String, String>,
|
||||
@@ -252,7 +252,7 @@ pub struct SubagentsConfig {
|
||||
/// [subagents.roles.researcher]
|
||||
/// description = "Deep research agent"
|
||||
/// default_capability_mode = "read-only"
|
||||
/// model = "grok-3"
|
||||
/// model = "kigi-3"
|
||||
///
|
||||
/// [subagents.roles.implementer]
|
||||
/// description = "Implementation agent with full access"
|
||||
@@ -735,7 +735,7 @@ fn walk_toml(
|
||||
}
|
||||
}
|
||||
/// The `[skills]` table from an effective config, shared by the reload
|
||||
/// dispatch and `grok inspect`.
|
||||
/// dispatch and `kigi inspect`.
|
||||
pub(crate) use crate::config::reloader::parse_skills_config;
|
||||
/// Effective config: layers + campaign overlay (remote cache + `KIGI_CAMPAIGNS_OVERRIDE`).
|
||||
pub use crate::util::config::load_effective_config;
|
||||
@@ -946,9 +946,9 @@ fn apply_requirements_inner(
|
||||
enforce_str!("cli", "channel", config.cli.channel);
|
||||
enforce_str!("cli", "minimum_version", config.cli.minimum_version);
|
||||
if let Some(val) = req_str(req, "endpoints", "api_base_url")
|
||||
&& config.endpoints.api_base_url != val
|
||||
&& config.endpoints.api_base_url.as_deref() != Some(val)
|
||||
{
|
||||
config.endpoints.api_base_url = val.to_owned();
|
||||
config.endpoints.api_base_url = Some(val.to_owned());
|
||||
push("endpoints.api_base_url", val.to_owned());
|
||||
}
|
||||
if let Some(val) = req_str(req, "endpoints", "coding_api_base_url")
|
||||
@@ -1128,7 +1128,7 @@ pub use kigi_workspace::project_config::find_project_configs;
|
||||
/// ([`find_project_configs`], extending `paths` and `disabled`) plus the
|
||||
/// imported `enabledPlugins` merge.
|
||||
///
|
||||
/// Shared by `reload_plugins_impl`, `x.ai/commands/list`, and the agent's
|
||||
/// Shared by `reload_plugins_impl`, `kigi/commands/list`, and the agent's
|
||||
/// eager plugin-registry fan-out so all three discover the same plugins for a
|
||||
/// given cwd. Centralizing it prevents the paths/disabled/discovered-command
|
||||
/// drift those callers would otherwise accumulate.
|
||||
|
||||
@@ -44,7 +44,7 @@ pub enum ConfigUpdate {
|
||||
/// Strictly additive to [`Self::McpServersChanged`] — the unit
|
||||
/// variant continues to fire for global-config edits. The two
|
||||
/// cases are split so per-project reloads don't
|
||||
/// grok process sharing the home dir). The agent should consult the cache
|
||||
/// kigi process sharing the home dir). The agent should consult the cache
|
||||
/// thrash unrelated sessions.
|
||||
ProjectMcpServersChanged {
|
||||
/// The project root whose `.kigi/`, `.mcp.json`, or
|
||||
@@ -70,7 +70,7 @@ pub enum ConfigUpdate {
|
||||
/// drop redundant `ProjectMcpServersChanged` dispatches on
|
||||
/// the reloader doesn't have.
|
||||
ModelsCacheChanged,
|
||||
/// Updated UI settings — agent broadcasts `x.ai/config_changed` to IPC clients.
|
||||
/// Updated UI settings — agent broadcasts `kigi/config_changed` to IPC clients.
|
||||
Ui {
|
||||
theme: Option<String>,
|
||||
yolo: bool,
|
||||
@@ -494,7 +494,7 @@ pub(crate) fn hash_auth_key(key: &str) -> u64 {
|
||||
/// Extract the `[skills]` table from an effective config.
|
||||
///
|
||||
/// Consumers: the reload dispatch above (change detection →
|
||||
/// `ConfigUpdate::Skills`) and `grok inspect` (via the `crate::config`
|
||||
/// `ConfigUpdate::Skills`) and `kigi inspect` (via the `crate::config`
|
||||
/// re-export), so both honor the same paths/ignore/disabled as a live
|
||||
/// session. Session spawn parses the same table separately through the typed
|
||||
/// `Config.skills` (agent/config.rs) — keep these in sync rather than adding
|
||||
@@ -906,14 +906,14 @@ ignore = ["/tmp"]
|
||||
[ui]
|
||||
theme = "dark"
|
||||
yolo = true
|
||||
fork_secondary_model = "grok-4.5"
|
||||
fork_secondary_model = "kigi-4.5"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
let (theme, yolo, fork) = extract_ui_fields(&config);
|
||||
assert_eq!(theme.as_deref(), Some("dark"));
|
||||
assert!(yolo);
|
||||
assert_eq!(fork.as_deref(), Some("grok-4.5"));
|
||||
assert_eq!(fork.as_deref(), Some("kigi-4.5"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -936,7 +936,7 @@ fork_secondary_model = "grok-4.5"
|
||||
let b: toml::Value = toml::from_str(
|
||||
r#"
|
||||
[model.my-custom]
|
||||
model = "grok-4.5"
|
||||
model = "kigi-4.5"
|
||||
base_url = "https://api.example.com/v1"
|
||||
"#,
|
||||
)
|
||||
@@ -946,8 +946,8 @@ base_url = "https://api.example.com/v1"
|
||||
|
||||
#[test]
|
||||
fn models_changed_detects_default_change() {
|
||||
let a: toml::Value = toml::from_str("[models]\ndefault = \"grok-code-fast-1\"").unwrap();
|
||||
let b: toml::Value = toml::from_str("[models]\ndefault = \"grok-code-slow-1\"").unwrap();
|
||||
let a: toml::Value = toml::from_str("[models]\ndefault = \"kigi-code-fast-1\"").unwrap();
|
||||
let b: toml::Value = toml::from_str("[models]\ndefault = \"kigi-code-slow-1\"").unwrap();
|
||||
assert_ne!(a.get("models"), b.get("models"));
|
||||
}
|
||||
|
||||
|
||||
@@ -111,18 +111,18 @@ fn with_env_var_opt<T>(name: &str, value: Option<&str>, f: impl FnOnce() -> T) -
|
||||
result.unwrap_or_else(|p| std::panic::resume_unwind(p))
|
||||
}
|
||||
/// Run `f` with KIGI_MEMORY explicitly unset.
|
||||
fn without_grok_memory<T>(f: impl FnOnce() -> T) -> T {
|
||||
fn without_kigi_memory<T>(f: impl FnOnce() -> T) -> T {
|
||||
let _guard = MEMORY_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
with_env_var_opt("KIGI_MEMORY", None, f)
|
||||
}
|
||||
/// Run `f` with KIGI_MEMORY set to a specific value.
|
||||
fn with_grok_memory<T>(value: &str, f: impl FnOnce() -> T) -> T {
|
||||
fn with_kigi_memory<T>(value: &str, f: impl FnOnce() -> T) -> T {
|
||||
let _guard = MEMORY_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
with_env_var_opt("KIGI_MEMORY", Some(value), f)
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_default_disabled() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let mem = MemoryConfig::resolve(false, false, &config, None);
|
||||
assert!(! mem.enabled);
|
||||
@@ -130,7 +130,7 @@ fn memory_config_default_disabled() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_cli_flag_enables() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let mem = MemoryConfig::resolve(true, false, &config, None);
|
||||
assert!(mem.enabled);
|
||||
@@ -138,7 +138,7 @@ fn memory_config_cli_flag_enables() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_from_toml() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = true").unwrap();
|
||||
let mem = MemoryConfig::resolve(false, false, &config, None);
|
||||
assert!(mem.enabled);
|
||||
@@ -146,7 +146,7 @@ fn memory_config_from_toml() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_toml_disabled() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = false").unwrap();
|
||||
let mem = MemoryConfig::resolve(false, false, &config, None);
|
||||
assert!(! mem.enabled);
|
||||
@@ -154,7 +154,7 @@ fn memory_config_toml_disabled() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_env_var_enables() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"1",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -165,7 +165,7 @@ fn memory_config_env_var_enables() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_env_var_true_enables() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"true",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -176,7 +176,7 @@ fn memory_config_env_var_true_enables() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_env_var_zero_does_not_enable() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"0",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -187,7 +187,7 @@ fn memory_config_env_var_zero_does_not_enable() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_env_var_false_does_not_enable() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"false",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -198,7 +198,7 @@ fn memory_config_env_var_false_does_not_enable() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_cli_overrides_toml_disabled() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = false").unwrap();
|
||||
let mem = MemoryConfig::resolve(true, false, &config, None);
|
||||
assert!(mem.enabled, "CLI flag should override config file");
|
||||
@@ -206,7 +206,7 @@ fn memory_config_cli_overrides_toml_disabled() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_env_zero_force_disables_toml_enabled() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"0",
|
||||
|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = true")
|
||||
@@ -221,7 +221,7 @@ fn memory_config_env_zero_force_disables_toml_enabled() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_env_false_force_disables_toml_enabled() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"false",
|
||||
|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = true")
|
||||
@@ -236,7 +236,7 @@ fn memory_config_env_false_force_disables_toml_enabled() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_cli_flag_overrides_env_disable() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"0",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -249,7 +249,7 @@ fn memory_config_cli_flag_overrides_env_disable() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_no_memory_overrides_all() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"1",
|
||||
|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = true")
|
||||
@@ -264,7 +264,7 @@ fn memory_config_no_memory_overrides_all() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_no_memory_alone_disables() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let mem = MemoryConfig::resolve(false, true, &config, None);
|
||||
assert!(! mem.enabled, "--no-memory alone should disable");
|
||||
@@ -272,7 +272,7 @@ fn memory_config_no_memory_alone_disables() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_no_memory_overrides_env_enable() {
|
||||
with_grok_memory(
|
||||
with_kigi_memory(
|
||||
"1",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -283,7 +283,7 @@ fn memory_config_no_memory_overrides_env_enable() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_no_memory_overrides_toml_enabled() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = true").unwrap();
|
||||
let mem = MemoryConfig::resolve(false, true, &config, None);
|
||||
assert!(! mem.enabled, "--no-memory should override TOML enabled=true");
|
||||
@@ -291,7 +291,7 @@ fn memory_config_no_memory_overrides_toml_enabled() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_no_memory_overrides_remote_enabled() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
memory_enabled: Some(true),
|
||||
@@ -303,7 +303,7 @@ fn memory_config_no_memory_overrides_remote_enabled() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_defaults_are_correct() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let mem = MemoryConfig::resolve(false, false, &config, None);
|
||||
assert_eq!(mem.index.max_chunk_chars, 1600);
|
||||
@@ -352,7 +352,7 @@ fn memory_config_defaults_are_correct() {
|
||||
/// (unknown fields are silently ignored by serde default).
|
||||
#[test]
|
||||
fn memory_config_watcher_debounce_ms_in_toml_is_silently_ignored() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = "[memory.watcher]\nenabled = true\ndebounce_ms = 2000\n";
|
||||
let config: toml::Value = toml::from_str(toml_str).unwrap();
|
||||
let mem = MemoryConfig::resolve(false, false, &config, None);
|
||||
@@ -362,7 +362,7 @@ fn memory_config_watcher_debounce_ms_in_toml_is_silently_ignored() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_full_toml_parsing() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory]
|
||||
enabled = true
|
||||
@@ -402,7 +402,7 @@ save_on_end = false
|
||||
[compaction.memory_flush]
|
||||
enabled = false
|
||||
soft_threshold_tokens = 8000
|
||||
flush_model = "grok-4"
|
||||
flush_model = "kigi-4"
|
||||
max_flush_write_chars = 16000
|
||||
idle_timeout_secs = 300
|
||||
semantic_dedup_threshold = 0.85
|
||||
@@ -433,7 +433,7 @@ hard_clear_age_turns = 20
|
||||
assert!(! mem.session.save_on_end);
|
||||
assert!(! mem.flush.enabled);
|
||||
assert_eq!(mem.flush.soft_threshold_tokens, 8000);
|
||||
assert_eq!(mem.flush.flush_model.as_deref(), Some("grok-4"));
|
||||
assert_eq!(mem.flush.flush_model.as_deref(), Some("kigi-4"));
|
||||
assert_eq!(mem.flush.max_flush_write_chars, 16000);
|
||||
assert_eq!(mem.flush.idle_timeout_secs, Some(300));
|
||||
assert_eq!(mem.flush.semantic_dedup_threshold, Some(0.85));
|
||||
@@ -444,7 +444,7 @@ hard_clear_age_turns = 20
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_partial_toml_uses_defaults_for_missing() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory]
|
||||
enabled = true
|
||||
@@ -465,7 +465,7 @@ max_chunk_chars = 3200
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_remote_settings_enable() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
memory_enabled: Some(true),
|
||||
@@ -477,7 +477,7 @@ fn memory_config_remote_settings_enable() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_remote_settings_pruning() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
pruning_enabled: Some(true),
|
||||
@@ -491,7 +491,7 @@ fn memory_config_remote_settings_pruning() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_remote_settings_initial_injection() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
memory_initial_injection_enabled: Some(false),
|
||||
@@ -505,7 +505,7 @@ fn memory_config_remote_settings_initial_injection() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_local_initial_injection_overrides_remote() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory.initial_injection]
|
||||
enabled = true
|
||||
@@ -524,7 +524,7 @@ min_score = 0.25
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_local_disabled_blocks_remote_enable() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config: toml::Value = toml::from_str("[memory]\nenabled = false").unwrap();
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
memory_enabled: Some(true),
|
||||
@@ -538,7 +538,7 @@ fn memory_config_local_disabled_blocks_remote_enable() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_local_overrides_remote() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory.search]
|
||||
max_results = 20
|
||||
@@ -554,7 +554,7 @@ max_results = 20
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_remote_none_is_noop() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let mem_without = MemoryConfig::resolve(false, false, &config, None);
|
||||
let mem_with_empty = MemoryConfig::resolve(
|
||||
@@ -569,7 +569,7 @@ fn memory_config_remote_none_is_noop() {
|
||||
}
|
||||
#[test]
|
||||
fn flush_semantic_dedup_threshold_from_remote_when_no_local_flush() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
flush_semantic_dedup_threshold: Some(0.85),
|
||||
@@ -584,7 +584,7 @@ fn flush_semantic_dedup_threshold_from_remote_when_no_local_flush() {
|
||||
}
|
||||
#[test]
|
||||
fn flush_semantic_dedup_threshold_clamped_from_remote() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
flush_semantic_dedup_threshold: Some(1.5),
|
||||
@@ -608,7 +608,7 @@ fn flush_semantic_dedup_threshold_clamped_from_remote() {
|
||||
}
|
||||
#[test]
|
||||
fn flush_semantic_dedup_threshold_local_blocks_remote() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[compaction.memory_flush]
|
||||
enabled = true
|
||||
@@ -628,7 +628,7 @@ semantic_dedup_threshold = 0.88
|
||||
}
|
||||
#[test]
|
||||
fn flush_semantic_dedup_threshold_defaults_to_none() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let mem = MemoryConfig::resolve(false, false, &config, None);
|
||||
assert_eq!(
|
||||
@@ -639,7 +639,7 @@ fn flush_semantic_dedup_threshold_defaults_to_none() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_dream_config_defaults() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let mem = MemoryConfig::resolve(false, false, &config, None);
|
||||
assert!(mem.dream.enabled);
|
||||
@@ -651,7 +651,7 @@ fn memory_dream_config_defaults() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_dream_config_toml_parsing() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory.dream]
|
||||
enabled = true
|
||||
@@ -671,7 +671,7 @@ check_interval_secs = 600
|
||||
}
|
||||
#[test]
|
||||
fn memory_dream_config_remote_override_when_toml_absent() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
dream_enabled: Some(true),
|
||||
@@ -690,7 +690,7 @@ fn memory_dream_config_remote_override_when_toml_absent() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_dream_config_remote_ignored_when_toml_present() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory.dream]
|
||||
enabled = false
|
||||
@@ -853,7 +853,7 @@ fn effective_half_life_disabled_legacy_recency_out_of_range_ignored() {
|
||||
}
|
||||
#[test]
|
||||
fn mmr_lambda_clamped_above_one() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory]
|
||||
enabled = true
|
||||
@@ -873,7 +873,7 @@ lambda = 2.0
|
||||
}
|
||||
#[test]
|
||||
fn mmr_lambda_clamped_below_zero() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory]
|
||||
enabled = true
|
||||
@@ -893,7 +893,7 @@ lambda = -0.5
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_remote_temporal_decay() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
memory_temporal_decay_enabled: Some(false),
|
||||
@@ -907,7 +907,7 @@ fn memory_config_remote_temporal_decay() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_remote_mmr() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
memory_mmr_enabled: Some(true),
|
||||
@@ -921,7 +921,7 @@ fn memory_config_remote_mmr() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_remote_mmr_lambda_clamped() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
memory_mmr_lambda: Some(5.0),
|
||||
@@ -936,7 +936,7 @@ fn memory_config_remote_mmr_lambda_clamped() {
|
||||
}
|
||||
#[test]
|
||||
fn memory_config_local_search_blocks_remote_temporal_decay_and_mmr() {
|
||||
without_grok_memory(|| {
|
||||
without_kigi_memory(|| {
|
||||
let toml_str = r#"
|
||||
[memory.search]
|
||||
max_results = 8
|
||||
@@ -962,18 +962,18 @@ max_results = 8
|
||||
/// Mutex to serialize tests that touch the KIGI_SUBAGENTS env var.
|
||||
static SUBAGENTS_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
/// Run `f` with KIGI_SUBAGENTS explicitly unset.
|
||||
fn without_grok_subagents<T>(f: impl FnOnce() -> T) -> T {
|
||||
fn without_kigi_subagents<T>(f: impl FnOnce() -> T) -> T {
|
||||
let _guard = SUBAGENTS_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
with_env_var_opt("KIGI_SUBAGENTS", None, f)
|
||||
}
|
||||
/// Run `f` with KIGI_SUBAGENTS set to a specific value.
|
||||
fn with_grok_subagents<T>(value: &str, f: impl FnOnce() -> T) -> T {
|
||||
fn with_kigi_subagents<T>(value: &str, f: impl FnOnce() -> T) -> T {
|
||||
let _guard = SUBAGENTS_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
with_env_var_opt("KIGI_SUBAGENTS", Some(value), f)
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_default_enabled() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let sa = SubagentsConfig::resolve(false, &config, None);
|
||||
assert!(sa.enabled);
|
||||
@@ -981,7 +981,7 @@ fn subagents_config_default_enabled() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_cli_flag_enables() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let sa = SubagentsConfig::resolve(true, &config, None);
|
||||
assert!(sa.enabled);
|
||||
@@ -989,7 +989,7 @@ fn subagents_config_cli_flag_enables() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_env_var_enables() {
|
||||
with_grok_subagents(
|
||||
with_kigi_subagents(
|
||||
"1",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -1000,7 +1000,7 @@ fn subagents_config_env_var_enables() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_env_var_disables() {
|
||||
with_grok_subagents(
|
||||
with_kigi_subagents(
|
||||
"0",
|
||||
|| {
|
||||
let config: toml::Value = toml::from_str("[subagents]\nenabled = true")
|
||||
@@ -1012,7 +1012,7 @@ fn subagents_config_env_var_disables() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_toml_enables() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config: toml::Value = toml::from_str("[subagents]\nenabled = true").unwrap();
|
||||
let sa = SubagentsConfig::resolve(false, &config, None);
|
||||
assert!(sa.enabled);
|
||||
@@ -1020,7 +1020,7 @@ fn subagents_config_toml_enables() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_local_disabled_wins() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config: toml::Value = toml::from_str("[subagents]\nenabled = false")
|
||||
.unwrap();
|
||||
let sa = SubagentsConfig::resolve(false, &config, None);
|
||||
@@ -1029,7 +1029,7 @@ fn subagents_config_local_disabled_wins() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_env_var_disables_default() {
|
||||
with_grok_subagents(
|
||||
with_kigi_subagents(
|
||||
"0",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -1044,7 +1044,7 @@ fn subagents_config_env_var_disables_default() {
|
||||
/// as an unknown key and have no effect on resolution.
|
||||
#[test]
|
||||
fn subagents_config_remote_settings_key_is_ignored() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let _settings: crate::util::config::RemoteSettings = serde_json::from_str(
|
||||
r#"{"subagents_enabled": false}"#,
|
||||
)
|
||||
@@ -1056,7 +1056,7 @@ fn subagents_config_remote_settings_key_is_ignored() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_cli_flag_overrides_env_var() {
|
||||
with_grok_subagents(
|
||||
with_kigi_subagents(
|
||||
"0",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -1067,28 +1067,28 @@ fn subagents_config_cli_flag_overrides_env_var() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_models_parsed() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config: toml::Value = toml::from_str(
|
||||
r#"
|
||||
[subagents]
|
||||
enabled = true
|
||||
|
||||
[subagents.models]
|
||||
explore = "grok-3-fast"
|
||||
plan = "grok-4.5"
|
||||
explore = "kigi-3-fast"
|
||||
plan = "kigi-4.5"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
let sa = SubagentsConfig::resolve(false, &config, None);
|
||||
assert!(sa.enabled);
|
||||
assert_eq!(sa.models.len(), 2);
|
||||
assert_eq!(sa.models.get("explore").unwrap(), "grok-3-fast");
|
||||
assert_eq!(sa.models.get("plan").unwrap(), "grok-4.5");
|
||||
assert_eq!(sa.models.get("explore").unwrap(), "kigi-3-fast");
|
||||
assert_eq!(sa.models.get("plan").unwrap(), "kigi-4.5");
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_models_empty_when_missing() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config: toml::Value = toml::from_str("[subagents]\nenabled = true").unwrap();
|
||||
let sa = SubagentsConfig::resolve(false, &config, None);
|
||||
assert!(sa.enabled);
|
||||
@@ -1097,11 +1097,11 @@ fn subagents_config_models_empty_when_missing() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_models_without_enabled() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config: toml::Value = toml::from_str(
|
||||
r#"
|
||||
[subagents.models]
|
||||
explore = "grok-3-fast"
|
||||
explore = "kigi-3-fast"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -1110,30 +1110,30 @@ fn subagents_config_models_without_enabled() {
|
||||
! sa.enabled, "explicit [subagents] section without enabled should be false"
|
||||
);
|
||||
assert_eq!(sa.models.len(), 1);
|
||||
assert_eq!(sa.models.get("explore").unwrap(), "grok-3-fast");
|
||||
assert_eq!(sa.models.get("explore").unwrap(), "kigi-3-fast");
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_models_with_env_var_enables() {
|
||||
with_grok_subagents(
|
||||
with_kigi_subagents(
|
||||
"1",
|
||||
|| {
|
||||
let config: toml::Value = toml::from_str(
|
||||
r#"
|
||||
[subagents.models]
|
||||
explore = "grok-3-fast"
|
||||
explore = "kigi-3-fast"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
let sa = SubagentsConfig::resolve(false, &config, None);
|
||||
assert!(sa.enabled, "KIGI_SUBAGENTS=1 should enable");
|
||||
assert_eq!(sa.models.get("explore").unwrap(), "grok-3-fast");
|
||||
assert_eq!(sa.models.get("explore").unwrap(), "kigi-3-fast");
|
||||
},
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_toggle_mixed_values() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config: toml::Value = toml::from_str(
|
||||
r#"
|
||||
[subagents]
|
||||
@@ -1158,7 +1158,7 @@ fn subagents_config_toggle_mixed_values() {
|
||||
}
|
||||
#[test]
|
||||
fn subagents_config_toggle_missing_defaults_to_empty() {
|
||||
without_grok_subagents(|| {
|
||||
without_kigi_subagents(|| {
|
||||
let config: toml::Value = toml::from_str("[subagents]\nenabled = true").unwrap();
|
||||
let sa = SubagentsConfig::resolve(false, &config, None);
|
||||
assert!(sa.enabled);
|
||||
@@ -1267,7 +1267,7 @@ fn model_overrides_local_image_description_wins_over_remote() {
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn model_overrides_default_image_description_is_grok_build() {
|
||||
fn model_overrides_default_image_description_is_kigi() {
|
||||
with_model_overrides_env(
|
||||
None,
|
||||
None,
|
||||
@@ -1282,7 +1282,7 @@ fn model_overrides_default_image_description_is_grok_build() {
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn model_overrides_default_session_summary_is_grok_build() {
|
||||
fn model_overrides_default_session_summary_is_kigi() {
|
||||
with_model_overrides_env(
|
||||
None,
|
||||
None,
|
||||
@@ -1632,17 +1632,17 @@ fn model_overrides_prompt_suggestion_blank_values_are_unset() {
|
||||
/// Lock shared by every test that touches the env var read by
|
||||
/// `ToolsConfig::resolve`, so tests can't race.
|
||||
static TOOLS_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
fn without_grok_respect_gitignore<T>(f: impl FnOnce() -> T) -> T {
|
||||
fn without_kigi_respect_gitignore<T>(f: impl FnOnce() -> T) -> T {
|
||||
let _guard = TOOLS_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
with_env_var_opt("KIGI_RESPECT_GITIGNORE", None, f)
|
||||
}
|
||||
fn with_grok_respect_gitignore<T>(value: &str, f: impl FnOnce() -> T) -> T {
|
||||
fn with_kigi_respect_gitignore<T>(value: &str, f: impl FnOnce() -> T) -> T {
|
||||
let _guard = TOOLS_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
|
||||
with_env_var_opt("KIGI_RESPECT_GITIGNORE", Some(value), f)
|
||||
}
|
||||
#[test]
|
||||
fn tools_config_default_disabled() {
|
||||
without_grok_respect_gitignore(|| {
|
||||
without_kigi_respect_gitignore(|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
let tc = ToolsConfig::resolve(&config);
|
||||
assert!(! tc.respect_gitignore);
|
||||
@@ -1650,7 +1650,7 @@ fn tools_config_default_disabled() {
|
||||
}
|
||||
#[test]
|
||||
fn tools_config_toml_disables() {
|
||||
without_grok_respect_gitignore(|| {
|
||||
without_kigi_respect_gitignore(|| {
|
||||
let config: toml::Value = toml::from_str("[tools]\nrespect_gitignore = false")
|
||||
.unwrap();
|
||||
let tc = ToolsConfig::resolve(&config);
|
||||
@@ -1659,7 +1659,7 @@ fn tools_config_toml_disables() {
|
||||
}
|
||||
#[test]
|
||||
fn tools_config_env_var_disables() {
|
||||
with_grok_respect_gitignore(
|
||||
with_kigi_respect_gitignore(
|
||||
"0",
|
||||
|| {
|
||||
let config = toml::Value::Table(toml::map::Map::new());
|
||||
@@ -1670,7 +1670,7 @@ fn tools_config_env_var_disables() {
|
||||
}
|
||||
#[test]
|
||||
fn tools_config_env_var_overrides_toml() {
|
||||
with_grok_respect_gitignore(
|
||||
with_kigi_respect_gitignore(
|
||||
"1",
|
||||
|| {
|
||||
let config: toml::Value = toml::from_str(
|
||||
@@ -1684,7 +1684,7 @@ fn tools_config_env_var_overrides_toml() {
|
||||
}
|
||||
#[test]
|
||||
fn tools_config_env_false_overrides_toml_true() {
|
||||
with_grok_respect_gitignore(
|
||||
with_kigi_respect_gitignore(
|
||||
"false",
|
||||
|| {
|
||||
let config: toml::Value = toml::from_str("[tools]\nrespect_gitignore = true")
|
||||
@@ -1703,7 +1703,7 @@ fn roles_parse_from_toml() {
|
||||
[roles.researcher]
|
||||
description = "Deep research agent"
|
||||
default_capability_mode = "read-only"
|
||||
model = "grok-3"
|
||||
model = "kigi-3"
|
||||
|
||||
[roles.implementer]
|
||||
description = "Implementation agent"
|
||||
@@ -1715,7 +1715,7 @@ fn roles_parse_from_toml() {
|
||||
let researcher = cfg.get_role("researcher").unwrap();
|
||||
assert_eq!(researcher.description, "Deep research agent");
|
||||
assert_eq!(researcher.default_capability_mode.as_deref(), Some("read-only"));
|
||||
assert_eq!(researcher.model.as_deref(), Some("grok-3"));
|
||||
assert_eq!(researcher.model.as_deref(), Some("kigi-3"));
|
||||
assert!(researcher.prompt_file.is_none());
|
||||
let implementer = cfg.get_role("implementer").unwrap();
|
||||
assert_eq!(implementer.description, "Implementation agent");
|
||||
@@ -1777,7 +1777,7 @@ fn validate_roles_passes_valid_config() {
|
||||
[roles.good]
|
||||
description = "Valid role"
|
||||
default_capability_mode = "read-write"
|
||||
model = "grok-3"
|
||||
model = "kigi-3"
|
||||
"#;
|
||||
let cfg: SubagentsConfig = toml::from_str(toml_str).unwrap();
|
||||
assert!(cfg.validate_roles().is_empty());
|
||||
@@ -2068,7 +2068,7 @@ fn roles_coexist_with_models_and_toggle() {
|
||||
let toml_str = r#"
|
||||
enabled = true
|
||||
[models]
|
||||
explore = "grok-fast"
|
||||
explore = "kigi-fast"
|
||||
[toggle]
|
||||
plan = false
|
||||
[roles.researcher]
|
||||
@@ -2077,7 +2077,7 @@ fn roles_coexist_with_models_and_toggle() {
|
||||
"#;
|
||||
let cfg: SubagentsConfig = toml::from_str(toml_str).unwrap();
|
||||
assert!(cfg.enabled);
|
||||
assert_eq!(cfg.models.get("explore").map(| s | s.as_str()), Some("grok-fast"));
|
||||
assert_eq!(cfg.models.get("explore").map(| s | s.as_str()), Some("kigi-fast"));
|
||||
assert!(! cfg.is_subagent_enabled("plan"));
|
||||
assert!(cfg.get_role("researcher").is_some());
|
||||
}
|
||||
@@ -2255,10 +2255,10 @@ coding_api_base_url = "https://cli-chat-proxy.kigi.com/v1"
|
||||
[model.kigi-build]
|
||||
base_url = "https://inference.acme-corp.example/xai/v1"
|
||||
env_key = "ANTHROPIC_AUTH_TOKEN"
|
||||
model = "grok-4.5"
|
||||
model = "kigi-4.5"
|
||||
|
||||
[models]
|
||||
default = "grok-4.5"
|
||||
default = "kigi-4.5"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -2376,7 +2376,10 @@ fn apply_requirements_value_overrides_user_settings() {
|
||||
Some("https://managed-proxy.example/v1"), cfg.endpoints.coding_api_base_url
|
||||
.as_deref()
|
||||
);
|
||||
assert_eq!("https://managed-api.example/v1", cfg.endpoints.api_base_url);
|
||||
assert_eq!(
|
||||
Some("https://managed-api.example/v1"),
|
||||
cfg.endpoints.api_base_url.as_deref()
|
||||
);
|
||||
assert_eq!(
|
||||
Some("https://managed-models.example/v1"), cfg.endpoints.models_base_url
|
||||
.as_deref()
|
||||
@@ -2496,7 +2499,7 @@ fn validate_hooks_path_rejects_traversal_attack() {
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn validate_hooks_path_accepts_grok_hooks_subdir() {
|
||||
fn validate_hooks_path_accepts_kigi_hooks_subdir() {
|
||||
let kigi_home = crate::util::kigi_home::kigi_home();
|
||||
let valid_path = kigi_home.join("hooks").join("my-hooks");
|
||||
let _ = std::fs::create_dir_all(&valid_path);
|
||||
@@ -2532,7 +2535,7 @@ fn managed_settings_disables_features_and_requirements_overrides() {
|
||||
assert!(cfg.ui.yolo);
|
||||
}
|
||||
/// REGRESSION: external managed-settings.json is advisory, not authoritative.
|
||||
/// disableBypassPermissionsMode (-> features.disable_yolo) must NOT clamp the user's own grok yolo.
|
||||
/// disableBypassPermissionsMode (-> features.disable_yolo) must NOT clamp the user's own kigi yolo.
|
||||
#[test]
|
||||
fn managed_settings_does_not_override_user_yolo() {
|
||||
use kigi_workspace::permission::resolution::ManagedSettingsFeatures;
|
||||
@@ -2582,10 +2585,10 @@ fn resolve_effective_plugins_config_gates_project_paths_on_folder_trust() {
|
||||
let _sim = simulate_release_build();
|
||||
let repo = tempfile::tempdir().unwrap();
|
||||
git2::Repository::init(repo.path()).unwrap();
|
||||
let grok = repo.path().join(".kigi");
|
||||
std::fs::create_dir_all(&grok).unwrap();
|
||||
let kigi = repo.path().join(".kigi");
|
||||
std::fs::create_dir_all(&kigi).unwrap();
|
||||
std::fs::write(
|
||||
grok.join("config.toml"),
|
||||
kigi.join("config.toml"),
|
||||
"[plugins]\npaths = [\"./proj-plugin\"]\ndisabled = [\"proj-bad\"]\n",
|
||||
)
|
||||
.unwrap();
|
||||
@@ -2648,10 +2651,10 @@ fn discover_plugins_excludes_untrusted_configpath_plugin_end_to_end() {
|
||||
std::fs::create_dir_all(&plugin_dir).unwrap();
|
||||
std::fs::write(plugin_dir.join("plugin.json"), r#"{"name":"cfgpath-probe"}"#)
|
||||
.unwrap();
|
||||
let grok = cwd.join(".kigi");
|
||||
std::fs::create_dir_all(&grok).unwrap();
|
||||
let kigi = cwd.join(".kigi");
|
||||
std::fs::create_dir_all(&kigi).unwrap();
|
||||
std::fs::write(
|
||||
grok.join("config.toml"),
|
||||
kigi.join("config.toml"),
|
||||
format!("[plugins]\npaths = ['{}']\n", plugin_dir.display()),
|
||||
)
|
||||
.unwrap();
|
||||
@@ -2711,9 +2714,9 @@ fn kill_switched_cold_cwd_stays_allowed_through_plugins_config_read() {
|
||||
let _sim = simulate_release_build();
|
||||
let repo = tempfile::tempdir().unwrap();
|
||||
git2::Repository::init(repo.path()).unwrap();
|
||||
let grok = repo.path().join(".kigi");
|
||||
std::fs::create_dir_all(&grok).unwrap();
|
||||
std::fs::write(grok.join("config.toml"), "[plugins]\npaths = [\"./proj-plugin\"]\n")
|
||||
let kigi = repo.path().join(".kigi");
|
||||
std::fs::create_dir_all(&kigi).unwrap();
|
||||
std::fs::write(kigi.join("config.toml"), "[plugins]\npaths = [\"./proj-plugin\"]\n")
|
||||
.unwrap();
|
||||
let cwd = repo.path();
|
||||
let remote = crate::util::config::RemoteSettings {
|
||||
|
||||
@@ -71,7 +71,7 @@ pub enum ConfigChangeEvent {
|
||||
AuthChanged,
|
||||
GlobalConfigChanged,
|
||||
/// `~/.kigi/models_cache.json` changed — the on-disk `/v1/models`
|
||||
/// catalog cache was rewritten, possibly by **another** grok process
|
||||
/// catalog cache was rewritten, possibly by **another** kigi process
|
||||
/// sharing the same `~/.kigi` (the writer may also be this process;
|
||||
/// the [`ModelsManager`](crate::agent::models::ModelsManager) dedupes
|
||||
/// by content before applying).
|
||||
@@ -229,7 +229,7 @@ impl ConfigFileWatcher {
|
||||
tracing::warn!(
|
||||
path = %kigi_home.display(),
|
||||
error = %e,
|
||||
"failed to watch grok home directory"
|
||||
"failed to watch kigi home directory"
|
||||
)
|
||||
})
|
||||
.ok()?;
|
||||
@@ -357,10 +357,10 @@ fn watch_cwd_dirs(debouncer: &mut Debouncer<AccessFilteredWatcher>, cwd: &Path)
|
||||
if let Err(e) = debouncer.watcher().watch(cwd, RecursiveMode::NonRecursive) {
|
||||
log_watch_error(&e, "failed to watch project cwd (non-recursive)");
|
||||
}
|
||||
let grok_dir = cwd.join(".kigi");
|
||||
let kigi_dir = cwd.join(".kigi");
|
||||
if let Err(e) = debouncer
|
||||
.watcher()
|
||||
.watch(&grok_dir, RecursiveMode::NonRecursive)
|
||||
.watch(&kigi_dir, RecursiveMode::NonRecursive)
|
||||
{
|
||||
log_watch_error(
|
||||
&e,
|
||||
@@ -376,8 +376,8 @@ fn unwatch_cwd_dirs(debouncer: &mut Debouncer<AccessFilteredWatcher>, cwd: &Path
|
||||
if let Err(e) = debouncer.watcher().unwatch(cwd) {
|
||||
tracing::debug!(error = %e, "failed to unwatch project cwd");
|
||||
}
|
||||
let grok_dir = cwd.join(".kigi");
|
||||
if let Err(e) = debouncer.watcher().unwatch(&grok_dir) {
|
||||
let kigi_dir = cwd.join(".kigi");
|
||||
if let Err(e) = debouncer.watcher().unwatch(&kigi_dir) {
|
||||
tracing::debug!(error = %e, "failed to unwatch project .kigi directory");
|
||||
}
|
||||
}
|
||||
@@ -752,7 +752,7 @@ mod tests {
|
||||
|
||||
/// A write to `<kigi_home>/models_cache.json` must surface as
|
||||
/// `ConfigChangeEvent::ModelsCacheChanged` so a long-running leader can
|
||||
/// hot-load a catalog fetched by another grok process.
|
||||
/// hot-load a catalog fetched by another kigi process.
|
||||
#[test]
|
||||
#[cfg_attr(
|
||||
target_os = "macos",
|
||||
@@ -845,11 +845,11 @@ mod tests {
|
||||
fn project_cwd_toml_triggers_reload() {
|
||||
let kigi_home = TempDir::new().unwrap();
|
||||
let cwd = TempDir::new().unwrap();
|
||||
let project_grok = cwd.path().join(".kigi");
|
||||
fs::create_dir_all(&project_grok).unwrap();
|
||||
let project_kigi = cwd.path().join(".kigi");
|
||||
fs::create_dir_all(&project_kigi).unwrap();
|
||||
// Seed the file before the watcher starts so we observe the
|
||||
// modification rather than the creation event.
|
||||
fs::write(project_grok.join("config.toml"), "").unwrap();
|
||||
fs::write(project_kigi.join("config.toml"), "").unwrap();
|
||||
|
||||
let (_w, mut rx) = ConfigFileWatcher::start(
|
||||
kigi_home.path(),
|
||||
@@ -860,7 +860,7 @@ mod tests {
|
||||
.expect("watcher should start");
|
||||
|
||||
fs::write(
|
||||
project_grok.join("config.toml"),
|
||||
project_kigi.join("config.toml"),
|
||||
"[mcp_servers.x]\ncommand = \"/bin/true\"",
|
||||
)
|
||||
.unwrap();
|
||||
@@ -983,9 +983,9 @@ mod tests {
|
||||
fn watch_path_dynamic_registration() {
|
||||
let kigi_home = TempDir::new().unwrap();
|
||||
let new_cwd = TempDir::new().unwrap();
|
||||
let project_grok = new_cwd.path().join(".kigi");
|
||||
fs::create_dir_all(&project_grok).unwrap();
|
||||
fs::write(project_grok.join("config.toml"), "").unwrap();
|
||||
let project_kigi = new_cwd.path().join(".kigi");
|
||||
fs::create_dir_all(&project_kigi).unwrap();
|
||||
fs::write(project_kigi.join("config.toml"), "").unwrap();
|
||||
|
||||
let (mut watcher, mut rx) = ConfigFileWatcher::start(
|
||||
kigi_home.path(),
|
||||
@@ -998,7 +998,7 @@ mod tests {
|
||||
watcher.watch_path(new_cwd.path());
|
||||
|
||||
fs::write(
|
||||
project_grok.join("config.toml"),
|
||||
project_kigi.join("config.toml"),
|
||||
"[mcp_servers.y]\ncommand = \"/bin/true\"",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
Reference in new issue
Block a user