§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:
2026-07-18 02:48:46 -04:00
parent 86e3724310
commit 6f31415ed6
1056 changed files with 8410 additions and 18307 deletions
@@ -227,7 +227,7 @@ fn set_default_model_allowed_when_agent_chat_kind() {
fn slash_model_valid_dispatches_set_default_model_with_switch_and_persist() {
let mut app = test_app_with_agent();
let id = AgentId(0);
let model_id = acp::ModelId::new(std::sync::Arc::from("grok-4.5"));
let model_id = acp::ModelId::new(std::sync::Arc::from("kigi-4.5"));
app.agents
.get_mut(&id)
.unwrap()
@@ -236,9 +236,9 @@ fn slash_model_valid_dispatches_set_default_model_with_switch_and_persist() {
.available
.insert(
model_id.clone(),
acp::ModelInfo::new(model_id.clone(), "Grok 4.5".to_string()),
acp::ModelInfo::new(model_id.clone(), "Kigi 4.5".to_string()),
);
let effects = dispatch(Action::SendPrompt("/model Grok 4.5".into()), &mut app);
let effects = dispatch(Action::SendPrompt("/model Kigi 4.5".into()), &mut app);
assert_eq!(
effects.len(),
2,
@@ -904,8 +904,8 @@ fn clear_default_model_persists_but_keeps_live_current() {
use agent_client_protocol as acp;
use std::sync::Arc;
let mut app = test_app_with_agent();
let id = acp::ModelId::new(Arc::from("grok-test"));
let info = acp::ModelInfo::new(id.clone(), "Grok Test".to_string());
let id = acp::ModelId::new(Arc::from("kigi-test"));
let info = acp::ModelInfo::new(id.clone(), "Kigi Test".to_string());
let agent_id = AgentId(0);
app.agents
.get_mut(&agent_id)
@@ -949,8 +949,8 @@ fn set_default_model_resolves_known_name() {
use agent_client_protocol as acp;
use std::sync::Arc;
let mut app = test_app_with_agent();
let id = acp::ModelId::new(Arc::from("grok-4.5"));
let info = acp::ModelInfo::new(id.clone(), "Grok 4.5".to_string());
let id = acp::ModelId::new(Arc::from("kigi-4.5"));
let info = acp::ModelInfo::new(id.clone(), "Kigi 4.5".to_string());
let agent_id = AgentId(0);
app.agents
.get_mut(&agent_id)
@@ -963,7 +963,7 @@ fn set_default_model_resolves_known_name() {
assert_eq!(effects.len(), 2);
assert!(
matches!(& effects[0], Effect::PersistSetting { key : "default_model", value :
crate ::settings::SettingValue::String(s), .. } if s == "grok-4.5")
crate ::settings::SettingValue::String(s), .. } if s == "kigi-4.5")
);
assert!(matches!(& effects[1], Effect::SwitchModel { model_id : mid, .. } if mid == & id));
assert_eq!(app.agents[&agent_id].session.models.current, Some(id));
@@ -976,8 +976,8 @@ fn set_default_model_idempotent_when_already_current() {
use agent_client_protocol as acp;
use std::sync::Arc;
let mut app = test_app_with_agent();
let id = acp::ModelId::new(Arc::from("grok-already"));
let info = acp::ModelInfo::new(id.clone(), "Grok Already".to_string());
let id = acp::ModelId::new(Arc::from("kigi-already"));
let info = acp::ModelInfo::new(id.clone(), "Kigi Already".to_string());
let agent_id = AgentId(0);
app.agents
.get_mut(&agent_id)
@@ -2666,16 +2666,16 @@ fn dispatch_cycle_mode_refreshes_open_modal_snapshot() {
"current_value_for must read the refreshed snapshot",
);
}
/// `dispatch(Action::SetTheme("grokday"), &mut app)` emits
/// `dispatch(Action::SetTheme("kigiday"), &mut app)` emits
/// exactly one `Effect::PersistSetting`, mutates
/// `app.current_ui.theme`, fires a toast, and toggles AUTO_MODE
/// off (kind is concrete).
///
/// Note: we persist `grokday` (a non-truecolor theme) here
/// Note: we persist `kigiday` (a non-truecolor theme) here
/// because `Effect::PersistSetting`'s payload is `&'static str`
/// from the registry's canonical table — the persisted CANONICAL
/// is what we're asserting, NOT the live theme cache (which
/// `clamp_to_terminal` might fold to GrokNight in non-truecolor
/// `clamp_to_terminal` might fold to KigiNight in non-truecolor
/// test environments). Persist + canonical contract is the test
/// invariant; the cache contract is exercised separately by the
/// `*_applies_when_*` tests.
@@ -2685,8 +2685,8 @@ fn set_theme_emits_persist_setting_with_correct_payload() {
with_theme_test_env(|| {
let mut app = test_app_with_agent();
assert_eq!(app.current_ui.theme, None);
crate::theme::cache::set(crate::theme::ThemeKind::GrokNight);
let effects = dispatch(Action::SetTheme("grokday".into()), &mut app);
crate::theme::cache::set(crate::theme::ThemeKind::KigiNight);
let effects = dispatch(Action::SetTheme("kigiday".into()), &mut app);
assert_eq!(effects.len(), 1);
match &effects[0] {
Effect::PersistSetting {
@@ -2695,12 +2695,12 @@ fn set_theme_emits_persist_setting_with_correct_payload() {
rollback_value,
} => {
assert_eq!(*key, "theme");
assert_eq!(*value, SettingValue::Enum("grokday"));
assert_eq!(*rollback_value, SettingValue::Enum("groknight"));
assert_eq!(*value, SettingValue::Enum("kigiday"));
assert_eq!(*rollback_value, SettingValue::Enum("kiginight"));
}
other => panic!("expected PersistSetting, got {other:?}"),
}
assert_eq!(app.current_ui.theme.as_deref(), Some("grokday"));
assert_eq!(app.current_ui.theme.as_deref(), Some("kigiday"));
assert!(
!crate::theme::cache::is_auto_mode(),
"concrete theme commit must disable AUTO_MODE",
@@ -2708,7 +2708,7 @@ fn set_theme_emits_persist_setting_with_correct_payload() {
});
}
/// Same payload contract as `set_theme_emits_persist_setting_with_correct_payload`
/// for the auto-dark sibling. Uses `grokday` to avoid the
/// for the auto-dark sibling. Uses `kigiday` to avoid the
/// `clamp_to_terminal` ambiguity in non-truecolor test envs;
/// `apply_kind` doesn't fire here anyway (parent theme is not
/// auto by default) but using a non-truecolor canonical keeps
@@ -2718,7 +2718,7 @@ fn set_auto_dark_theme_emits_persist_setting_with_correct_payload() {
use crate::settings::SettingValue;
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let effects = dispatch(Action::SetAutoDarkTheme("grokday".into()), &mut app);
let effects = dispatch(Action::SetAutoDarkTheme("kigiday".into()), &mut app);
assert_eq!(effects.len(), 1);
match &effects[0] {
Effect::PersistSetting {
@@ -2727,12 +2727,12 @@ fn set_auto_dark_theme_emits_persist_setting_with_correct_payload() {
rollback_value,
} => {
assert_eq!(*key, "auto_dark_theme");
assert_eq!(*value, SettingValue::Enum("grokday"));
assert_eq!(*rollback_value, SettingValue::Enum("groknight"));
assert_eq!(*value, SettingValue::Enum("kigiday"));
assert_eq!(*rollback_value, SettingValue::Enum("kiginight"));
}
other => panic!("expected PersistSetting, got {other:?}"),
}
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("grokday"));
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("kigiday"));
});
}
#[test]
@@ -2740,7 +2740,7 @@ fn set_auto_light_theme_emits_persist_setting_with_correct_payload() {
use crate::settings::SettingValue;
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let effects = dispatch(Action::SetAutoLightTheme("groknight".into()), &mut app);
let effects = dispatch(Action::SetAutoLightTheme("kiginight".into()), &mut app);
assert_eq!(effects.len(), 1);
match &effects[0] {
Effect::PersistSetting {
@@ -2749,14 +2749,14 @@ fn set_auto_light_theme_emits_persist_setting_with_correct_payload() {
rollback_value,
} => {
assert_eq!(*key, "auto_light_theme");
assert_eq!(*value, SettingValue::Enum("groknight"));
assert_eq!(*rollback_value, SettingValue::Enum("grokday"));
assert_eq!(*value, SettingValue::Enum("kiginight"));
assert_eq!(*rollback_value, SettingValue::Enum("kigiday"));
}
other => panic!("expected PersistSetting, got {other:?}"),
}
assert_eq!(
app.current_ui.auto_light_theme.as_deref(),
Some("groknight"),
Some("kiginight"),
);
});
}
@@ -2809,11 +2809,11 @@ fn preview_auto_light_theme_emits_no_persist_and_no_current_ui_mutation() {
/// Auto-theme commit applies the live theme **only** when
/// `theme="auto"` AND the system is in the matching mode.
///
/// Scenario: `theme="groknight"` (concrete) + system=Dark. User
/// commits `auto_dark_theme="grokday"`. The setting is dormant
/// Scenario: `theme="kiginight"` (concrete) + system=Dark. User
/// commits `auto_dark_theme="kigiday"`. The setting is dormant
/// (parent theme is concrete, not auto), so the live display
/// must stay on GrokNight even though we're committing a
/// different theme. Uses `grokday` to avoid `clamp_to_terminal`
/// must stay on KigiNight even though we're committing a
/// different theme. Uses `kigiday` to avoid `clamp_to_terminal`
/// ambiguity in non-truecolor envs.
#[test]
fn set_auto_dark_theme_does_not_apply_when_theme_is_not_auto() {
@@ -2822,28 +2822,28 @@ fn set_auto_dark_theme_does_not_apply_when_theme_is_not_auto() {
crate::theme::system_appearance::SystemAppearance::Dark,
));
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetTheme("groknight".into()), &mut app);
let _ = dispatch(Action::SetTheme("kiginight".into()), &mut app);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokNight,
crate::theme::ThemeKind::KigiNight,
);
let _ = dispatch(Action::SetAutoDarkTheme("grokday".into()), &mut app);
let _ = dispatch(Action::SetAutoDarkTheme("kigiday".into()), &mut app);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokNight,
crate::theme::ThemeKind::KigiNight,
"auto_dark_theme commit must NOT change live display when theme is not auto",
);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("grokday"));
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("kigiday"));
});
}
/// Auto-theme commit DOES apply the live theme when both
/// (a) parent theme = auto AND (b) system matches.
///
/// Uses `GrokDay` (non-truecolor-requiring) for the dark-mode
/// Uses `KigiDay` (non-truecolor-requiring) for the dark-mode
/// fixture: the test environment's color detection may not report
/// truecolor support, and `Theme::apply_kind` clamps
/// truecolor-only themes (TokyoNight, RosePineMoon) down to
/// GrokNight. Using a non-truecolor theme avoids the clamp
/// KigiNight. Using a non-truecolor theme avoids the clamp
/// uncertainty. The "live apply" contract is what we're testing
/// — the specific theme picked is incidental.
#[test]
@@ -2857,21 +2857,21 @@ fn set_auto_dark_theme_applies_when_theme_is_auto_and_system_is_dark() {
assert!(crate::theme::cache::is_auto_mode());
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokNight,
crate::theme::ThemeKind::KigiNight,
);
let _ = dispatch(Action::SetAutoDarkTheme("grokday".into()), &mut app);
let _ = dispatch(Action::SetAutoDarkTheme("kigiday".into()), &mut app);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokDay,
crate::theme::ThemeKind::KigiDay,
"auto_dark_theme commit must update live display when theme=auto + system=Dark",
);
});
}
/// Auto-theme commit does NOT apply when system is in the
/// non-matching mode (auto_dark_theme + system=Light).
/// Uses `groknight` for the auto_dark_theme
/// Uses `kiginight` for the auto_dark_theme
/// value to avoid `clamp_to_terminal` ambiguity (we want a
/// concrete kind that's clearly different from GrokDay, the
/// concrete kind that's clearly different from KigiDay, the
/// active resolved theme).
#[test]
fn set_auto_dark_theme_does_not_apply_when_system_is_light() {
@@ -2883,20 +2883,20 @@ fn set_auto_dark_theme_does_not_apply_when_system_is_light() {
let _ = dispatch(Action::SetTheme("auto".into()), &mut app);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokDay,
crate::theme::ThemeKind::KigiDay,
);
let _ = dispatch(Action::SetAutoDarkTheme("groknight".into()), &mut app);
let _ = dispatch(Action::SetAutoDarkTheme("kiginight".into()), &mut app);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokDay,
crate::theme::ThemeKind::KigiDay,
"auto_dark_theme commit must NOT change live display when system=Light",
);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("groknight"),);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("kiginight"),);
});
}
/// Symmetric to the dark test: `set_auto_light_theme` applies only
/// when theme=auto + system=Light. Uses a non-truecolor theme
/// (`groknight`) for the same clamp reason as the dark variant.
/// (`kiginight`) for the same clamp reason as the dark variant.
#[test]
fn set_auto_light_theme_applies_when_theme_is_auto_and_system_is_light() {
with_theme_test_env(|| {
@@ -2907,12 +2907,12 @@ fn set_auto_light_theme_applies_when_theme_is_auto_and_system_is_light() {
let _ = dispatch(Action::SetTheme("auto".into()), &mut app);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokDay,
crate::theme::ThemeKind::KigiDay,
);
let _ = dispatch(Action::SetAutoLightTheme("groknight".into()), &mut app);
let _ = dispatch(Action::SetAutoLightTheme("kiginight".into()), &mut app);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokNight,
crate::theme::ThemeKind::KigiNight,
"auto_light_theme must update display when theme=auto + system=Light",
);
});
@@ -2986,7 +2986,7 @@ fn set_auto_light_theme_rejects_auto_value() {
fn set_theme_toast_format_uses_display_name() {
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetTheme("grokday".into()), &mut app);
let _ = dispatch(Action::SetTheme("kigiday".into()), &mut app);
let toast = read_toast(&app);
assert!(
toast.contains("Theme"),
@@ -2994,7 +2994,7 @@ fn set_theme_toast_format_uses_display_name() {
);
assert!(
toast.contains("Kigi Day"),
"toast must use display name `Kigi Day`, not canonical `grokday`, got: {toast:?}",
"toast must use display name `Kigi Day`, not canonical `kigiday`, got: {toast:?}",
);
assert!(toast.contains('\u{2713}'), "toast must contain the ✓ glyph");
});
@@ -3003,7 +3003,7 @@ fn set_theme_toast_format_uses_display_name() {
fn set_auto_dark_theme_toast_format_uses_display_name() {
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetAutoDarkTheme("grokday".into()), &mut app);
let _ = dispatch(Action::SetAutoDarkTheme("kigiday".into()), &mut app);
let toast = read_toast(&app);
assert!(toast.contains("Auto dark theme"));
assert!(toast.contains("Kigi Day"));
@@ -3014,7 +3014,7 @@ fn set_auto_dark_theme_toast_format_uses_display_name() {
fn set_auto_light_theme_toast_format_uses_display_name() {
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetAutoLightTheme("groknight".into()), &mut app);
let _ = dispatch(Action::SetAutoLightTheme("kiginight".into()), &mut app);
let toast = read_toast(&app);
assert!(toast.contains("Auto light theme"));
assert!(toast.contains("Kigi Night"));
@@ -3024,7 +3024,7 @@ fn set_auto_light_theme_toast_format_uses_display_name() {
/// reverts `app.current_ui.theme` AND the live cache (mirror of
/// `rollback_known_key_reverts_cache_and_no_effect`).
///
/// Uses non-truecolor themes (`grokday` ↔ `groknight`) to avoid
/// Uses non-truecolor themes (`kigiday` ↔ `kiginight`) to avoid
/// the `clamp_to_terminal` interaction in test environments that
/// don't report truecolor support.
#[test]
@@ -3032,28 +3032,28 @@ fn rollback_theme_reverts_current_ui_and_cache() {
use crate::settings::SettingValue;
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetTheme("grokday".into()), &mut app);
assert_eq!(app.current_ui.theme.as_deref(), Some("grokday"));
let _ = dispatch(Action::SetTheme("kigiday".into()), &mut app);
assert_eq!(app.current_ui.theme.as_deref(), Some("kigiday"));
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokDay,
crate::theme::ThemeKind::KigiDay,
);
let _ = dispatch(
Action::TaskComplete(TaskResult::SettingPersistFailed {
key: "theme",
rollback_value: SettingValue::Enum("groknight"),
rollback_value: SettingValue::Enum("kiginight"),
error: "disk full".into(),
}),
&mut app,
);
assert_eq!(
app.current_ui.theme.as_deref(),
Some("groknight"),
Some("kiginight"),
"rollback must update app.current_ui.theme",
);
assert_eq!(
crate::theme::cache::current_kind(),
crate::theme::ThemeKind::GrokNight,
crate::theme::ThemeKind::KigiNight,
"rollback must update the live theme cache too",
);
});
@@ -3063,17 +3063,17 @@ fn rollback_auto_dark_theme_reverts_current_ui() {
use crate::settings::SettingValue;
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetAutoDarkTheme("grokday".into()), &mut app);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("grokday"));
let _ = dispatch(Action::SetAutoDarkTheme("kigiday".into()), &mut app);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("kigiday"));
let _ = dispatch(
Action::TaskComplete(TaskResult::SettingPersistFailed {
key: "auto_dark_theme",
rollback_value: SettingValue::Enum("groknight"),
rollback_value: SettingValue::Enum("kiginight"),
error: "disk full".into(),
}),
&mut app,
);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("groknight"),);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("kiginight"),);
});
}
#[test]
@@ -3081,20 +3081,20 @@ fn rollback_auto_light_theme_reverts_current_ui() {
use crate::settings::SettingValue;
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetAutoLightTheme("groknight".into()), &mut app);
let _ = dispatch(Action::SetAutoLightTheme("kiginight".into()), &mut app);
assert_eq!(
app.current_ui.auto_light_theme.as_deref(),
Some("groknight"),
Some("kiginight"),
);
let _ = dispatch(
Action::TaskComplete(TaskResult::SettingPersistFailed {
key: "auto_light_theme",
rollback_value: SettingValue::Enum("grokday"),
rollback_value: SettingValue::Enum("kigiday"),
error: "disk full".into(),
}),
&mut app,
);
assert_eq!(app.current_ui.auto_light_theme.as_deref(), Some("grokday"));
assert_eq!(app.current_ui.auto_light_theme.as_deref(), Some("kigiday"));
});
}
/// Edge case — if the rollback value is
@@ -3109,8 +3109,8 @@ fn rollback_auto_dark_theme_with_auto_value_clears_to_none() {
use crate::settings::SettingValue;
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetAutoDarkTheme("grokday".into()), &mut app);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("grokday"));
let _ = dispatch(Action::SetAutoDarkTheme("kigiday".into()), &mut app);
assert_eq!(app.current_ui.auto_dark_theme.as_deref(), Some("kigiday"));
let _ = dispatch(
Action::TaskComplete(TaskResult::SettingPersistFailed {
key: "auto_dark_theme",
@@ -3131,10 +3131,10 @@ fn rollback_auto_light_theme_with_auto_value_clears_to_none() {
use crate::settings::SettingValue;
with_theme_test_env(|| {
let mut app = test_app_with_agent();
let _ = dispatch(Action::SetAutoLightTheme("groknight".into()), &mut app);
let _ = dispatch(Action::SetAutoLightTheme("kiginight".into()), &mut app);
assert_eq!(
app.current_ui.auto_light_theme.as_deref(),
Some("groknight"),
Some("kiginight"),
);
let _ = dispatch(
Action::TaskComplete(TaskResult::SettingPersistFailed {