§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
@@ -669,7 +669,7 @@ impl LocalTerminalActor {
}
cmd.envs(crate::util::pager_env());
crate::util::apply_grok_agent_marker(&mut cmd);
crate::util::apply_kigi_agent_marker(&mut cmd);
cmd.fd_mappings(prep.fd_mappings)
.map_err(|e| ComputerError::io(format!("fd mapping: {e}")))?;
@@ -1950,7 +1950,7 @@ impl LocalTerminalActor {
.map(|m| m.len())
.unwrap_or(0);
tokio::spawn(async move {
crate::implementations::grok_build::monitor::tool::run_monitor_pipeline(
crate::implementations::kigi::monitor::tool::run_monitor_pipeline(
&pipeline_task_id,
&pipeline_description,
pipeline_terminal,
@@ -2754,7 +2754,7 @@ fn spawn_shell_command(
cmd.envs(login);
}
// Agent marker must win over request/login env.
crate::util::apply_grok_agent_marker(&mut cmd);
crate::util::apply_kigi_agent_marker(&mut cmd);
// Detach from the controlling terminal so subprocesses cannot open
// /dev/tty and compete with the TUI for terminal input.
@@ -2762,7 +2762,7 @@ fn spawn_shell_command(
// If the sandbox profile restricts network, install a seccomp BPF
// filter on the child that blocks connect/bind/sendto/listen/accept.
// The parent (grok) process retains network for the LLM API.
// The parent (kigi) process retains network for the LLM API.
// Filesystem restrictions are already inherited from the process-level
// Landlock/Seatbelt sandbox — no action needed here for FS.
#[cfg(target_os = "linux")]
@@ -2795,7 +2795,7 @@ fn spawn_shell_command(
}
cmd.envs(crate::util::pager_env());
// Agent marker must win over request env.
crate::util::apply_grok_agent_marker(&mut cmd);
crate::util::apply_kigi_agent_marker(&mut cmd);
// Set creation flags inline rather than via crate::util::detach_command
// + new_process_group: tokio's creation_flags is a SET, not OR, so
@@ -2806,7 +2806,7 @@ fn spawn_shell_command(
// job so we can assign it to our own ProcessGroup. Per Microsoft
// docs this *fails CreateProcess with ERROR_ACCESS_DENIED* (os
// error 5) when the parent process is in a job that does not
// have JOB_OBJECT_LIMIT_BREAKAWAY_OK set — common when grok-agent
// have JOB_OBJECT_LIMIT_BREAKAWAY_OK set — common when kigi-agent
// is launched under a Windows service, scheduled task, or some
// ACP host wrappers. The caller below retries without this flag
// on os error 5.
@@ -4212,7 +4212,7 @@ mod tests {
let mut req = make_request("echo \"[$GPG_TTY]\"");
req.env
.insert("GPG_TTY".to_string(), "/grok-sentinel-tty".to_string());
.insert("GPG_TTY".to_string(), "/kigi-sentinel-tty".to_string());
let result = backend.run(req).await.unwrap();
assert_eq!(result.exit_code, Some(0));