Synced from monorepo

Synced from monorepo

Changes:
- Workspace server: surface preview-proxy metrics through the hub metric pump
- Shell: reclaim a session’s retained state in one entry
- Shell: reclaim a session’s resident state in one entry
- Pager: withhold key event types from Alacritty builds that double keys
- Tools: cancel a session’s subagents when it closes
- Pager: keep the whole plan in scrollback and separate reasoning from output in minimal mode
- Pager: probe terminal version over DA2 and include it with feedback
- SuperGrok Plus: identity, CLI, and analytics tier surfaces
- Shell: inherit the session process scope into subagents
- Pager: build @-file-search matcher lazily on first use
- Tools: fix description and output contradictions in tool definitions
- Workspace: degrade @-file-search instead of aborting on thread exhaustion
- Tools: reap a session’s LSP servers when it closes
- Tools: fix contradictions and defects in tool descriptions, schemas, and harness pools
- MCP: reap stdio MCP children on session close
- Shell: reuse spawn-time skill discovery for session telemetry
- Tools: stop leaking shell-wrapper positional params into sourced scripts (fixes activate_conda under persistent/static shell)
- Shell: self-heal corrupt session-search SQLite cache
- Workspace: cap workspace-server tokio workers on many-core hosts
- Shell: reap a session’s child processes when it closes
- Crash handler: capture SIGABRT so panic-aborts leave crash reports
- CLI chat proxy: team-scoped Grok Code managed-config admin routes
- MCP: add CLI enable/disable for MCP servers
- Shell: cap tokio worker threads for startup thread demand
- Workspace: harden git_commit and add git_sync_base operation
- Circuit breaker: add feature-gated gRPC retry policy

Source-Revision: 2a818575225183d8ca915f5632a09b8067b5156a
This commit is contained in:
grokkybara[bot] 2026-07-28 22:50:19 +00:00
commit 5da6962e4a
192 changed files with 10337 additions and 3421 deletions

View file

@ -1205,17 +1205,41 @@ pub async fn install_internal_from_bases(
const SMOKE_TEST_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);
/// Retry budget for exec attempts refused with ETXTBSY. The failure window
/// is normally the microseconds another spawn in this process sits between
/// fork and exec (see [`smoke_test_binary`]), but on a heavily loaded
/// machine that window can stretch, so the budget errs generous — a false
/// "failed to run" both aborts this install and deletes the binary.
const SMOKE_TEST_ETXTBSY_ATTEMPTS: u32 = 8;
const SMOKE_TEST_ETXTBSY_BACKOFF: std::time::Duration = std::time::Duration::from_millis(25);
async fn smoke_test_binary(binary_path: &std::path::Path) -> bool {
let mut cmd = tokio::process::Command::new(binary_path);
cmd.arg("--version")
.stdin(std::process::Stdio::null())
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null());
xai_grok_tools::util::detach_command(&mut cmd);
match tokio::time::timeout(SMOKE_TEST_TIMEOUT, cmd.status()).await {
Ok(Ok(status)) => status.success(),
_ => false,
// ETXTBSY race: while a concurrent updater in this process is between
// fork and exec (pre_exec in detach_command forces the fork/exec path),
// its child briefly holds every open fd — including the write-side fd of
// a download that has just been renamed onto `binary_path`. Exec'ing a
// binary whose inode is still open for write fails with ETXTBSY even
// though the file is complete and healthy, so retry instead of failing
// the install (and deleting a racer's freshly installed binary).
for attempt in 1..=SMOKE_TEST_ETXTBSY_ATTEMPTS {
let mut cmd = tokio::process::Command::new(binary_path);
cmd.arg("--version")
.stdin(std::process::Stdio::null())
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null());
xai_grok_tools::util::detach_command(&mut cmd);
match tokio::time::timeout(SMOKE_TEST_TIMEOUT, cmd.status()).await {
Ok(Ok(status)) => return status.success(),
Ok(Err(e))
if e.kind() == std::io::ErrorKind::ExecutableFileBusy
&& attempt < SMOKE_TEST_ETXTBSY_ATTEMPTS =>
{
tokio::time::sleep(SMOKE_TEST_ETXTBSY_BACKOFF * attempt).await;
}
_ => return false,
}
}
false
}
/// Test-only entry point: same as [`install_internal`] but reads from