§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
@@ -119,11 +119,11 @@ fn subagent_max_turns_definition_wins_else_inherits_parent() {
fn resume_worktree_action_covers_three_outcomes() {
use super::{ResumeWorktreeAction, resume_worktree_action};
assert_eq!(
resume_worktree_action(true, Some("refs/grok/subagents/x")),
resume_worktree_action(true, Some("refs/kigi/subagents/x")),
ResumeWorktreeAction::Rehydrate
);
assert_eq!(
resume_worktree_action(false, Some("refs/grok/subagents/x")),
resume_worktree_action(false, Some("refs/kigi/subagents/x")),
ResumeWorktreeAction::Rehydrate
);
assert_eq!(resume_worktree_action(true, None), ResumeWorktreeAction::Reuse);
@@ -1099,7 +1099,7 @@ fn dummy_tracker(
force_compact: Arc::new(AtomicBool::new(false)),
permission_handle: kigi_workspace::permission::PermissionHandle::allow_all(),
attribution_callback: None,
agent_name: "grok-build".to_string(),
agent_name: "kigi".to_string(),
session_default_agent_profile: None,
allowed_subagent_types: None,
hook_registry: None,
@@ -1938,7 +1938,7 @@ async fn bootstrap_fork_live_parent_chat_state_is_forked_with_marker() {
const MARKER: &str = "UNIQUE_LIVE_FORK_MARKER_xyz789";
let req = bootstrap_test_request(true);
let mut ctx = ctx_with_toggle(HashMap::new());
let chat = spawn_test_parent_chat_state("grok-4.5");
let chat = spawn_test_parent_chat_state("kigi-4.5");
chat.replace_conversation(
vec![
ConversationItem::system("parent system"),
@@ -2127,7 +2127,7 @@ async fn handle_subagent_request_rejects_nonexistent_cwd() {
#[tokio::test]
async fn handle_subagent_request_rejects_file_as_cwd() {
let tmp_dir = tempfile::TempDir::new().unwrap();
let tmp_file = tmp_dir.path().join("grok-test-cwd-file");
let tmp_file = tmp_dir.path().join("kigi-test-cwd-file");
std::fs::write(&tmp_file, b"not a directory").unwrap();
let ctx = ctx_with_toggle(HashMap::new());
let coordinator = std::cell::RefCell::new(SubagentCoordinator::new());
@@ -2359,7 +2359,7 @@ fn subagent_await_budget_default_and_override() {
fn summarize_tool_config_uses_name_override_and_strips_namespace() {
use kigi_tools::registry::types::{ToolConfig, ToolServerConfig};
use kigi_tools::types::tool::ToolKind;
let mut read = ToolConfig::from_id("GrokBuild:read_file");
let mut read = ToolConfig::from_id("Kigi:read_file");
read.kind = Some(ToolKind::Read);
let mut read_dup = ToolConfig::from_id("Codex:read_file");
read_dup.kind = Some(ToolKind::Read);
@@ -2410,7 +2410,7 @@ fn describe_subagent_type_not_allowed_outside_allow_list() {
other => panic!("expected NotAllowed, got {other:?}"),
}
}
/// Regression: on the DEFAULT grok-build host —
/// Regression: on the DEFAULT kigi host —
/// the primary `/goal` host — the `general-purpose` toolset's only
/// file-mutator is `search_replace` (`ToolKind::Edit`); the `write`
/// tool (`ToolKind::Write`) is injection-only and absent from the
@@ -2465,7 +2465,7 @@ fn subagent_keeps_default_flavor_when_parent_model_is_non_strict() {
let mut ctx = ctx_with_toggle(HashMap::new());
ctx.parent_agent_name = Some("ai-oncall-bot".to_string());
ctx.parent_model_agent_type = Some(
BuiltinAgentName::GrokBuildPlan.as_ref().to_string(),
BuiltinAgentName::KigiPlan.as_ref().to_string(),
);
let mut def = resolve_agent_definition("general-purpose", &ctx).expect("resolves");
resolve_subagent_toolset("general-purpose", None, &ctx, &mut def);
@@ -2696,7 +2696,7 @@ async fn background_unknown_type_emits_subagent_finished_notification() {
while let Ok(msg) = gateway_rx.try_recv() {
if let kigi_acp_lib::AcpClientMessage::ExtNotification(args) = msg {
let req: &acp::ExtNotification = &args.request;
assert_eq!(req.method.as_ref(), "x.ai/session_notification");
assert_eq!(req.method.as_ref(), "kigi/session_notification");
let body = req.params.get();
assert!(body.contains("subagent_finished"));
assert!(body.contains(& subagent_id));
@@ -3090,8 +3090,8 @@ fn subagent_auth_type_rule() {
use kigi_chat_state::AuthType;
let session = acp::AuthMethodId::new(CACHED_TOKEN_AUTH_METHOD_ID);
let api_key = acp::AuthMethodId::new(XAI_API_KEY_METHOD_ID);
let byok = byok_model_entry("grok-byok");
let plain = test_model_entry("grok-plain");
let byok = byok_model_entry("kigi-byok");
let plain = test_model_entry("kigi-plain");
assert_eq!(super::subagent_auth_type(Some(& byok), & session), AuthType::ApiKey);
assert_eq!(super::subagent_auth_type(Some(& byok), & api_key), AuthType::ApiKey);
assert_eq!(
@@ -3104,14 +3104,14 @@ fn subagent_auth_type_rule() {
#[test]
fn fresh_tool_model_accepts_visible_key_and_internal_id() {
let mut models = indexmap::IndexMap::new();
models.insert("grok-3".to_string(), test_model_entry("grok-3-2025-02-15"));
models.insert("kigi-3".to_string(), test_model_entry("kigi-3-2025-02-15"));
assert!(
super::handle_request::task_model_override_error(Some("grok-3"),
super::handle_request::task_model_override_error(Some("kigi-3"),
ModelOverrideProvenance::Tool, false, & models, false,).is_none(),
"key lookup should succeed"
);
assert!(
super::handle_request::task_model_override_error(Some("grok-3-2025-02-15"),
super::handle_request::task_model_override_error(Some("kigi-3-2025-02-15"),
ModelOverrideProvenance::Tool, false, & models, false,).is_none(),
"info().model lookup should succeed"
);
@@ -3182,7 +3182,7 @@ fn fresh_tool_model_rejects_unknown_and_nonavailable_entries() {
format!("Unknown Task.model slug '{requested}'. Valid model slugs: alpha, zeta. \
Omit `model` to inherit the parent model.")
);
assert!(! error.contains("grok models"));
assert!(! error.contains("kigi models"));
}
assert!(
super::handle_request::task_model_override_error(Some("oauth-only"),