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:
parent
02d9359435
commit
5da6962e4a
192 changed files with 10337 additions and 3421 deletions
|
|
@ -110,6 +110,12 @@ fn subprocess_entry() {
|
|||
unsafe { libc::raise(libc::SIGSEGV) };
|
||||
}
|
||||
|
||||
// Scenario 6: install handler, abort. This is the path every Rust
|
||||
// panic takes in release builds (panic = "abort" → SIGABRT).
|
||||
"sigabrt" => {
|
||||
std::process::abort();
|
||||
}
|
||||
|
||||
// Scenario 5: tokio runtime + signal coexistence, then clean shutdown.
|
||||
"tokio_signals" => {
|
||||
let rt = tokio::runtime::Builder::new_multi_thread()
|
||||
|
|
@ -269,6 +275,53 @@ fn sigsegv_produces_valid_crash_blob() {
|
|||
assert_eq!(blob.app_version, "0.0.0-test");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sigabrt_produces_valid_crash_blob() {
|
||||
let tmp = tempfile::tempdir().expect("tempdir");
|
||||
let (status, _stdout, _stderr) = run_scenario("sigabrt", tmp.path());
|
||||
|
||||
// The handler must re-raise with default disposition so the process
|
||||
// still dies with SIGABRT semantics. The frame-pointer walker may hit
|
||||
// unmapped memory and cause a secondary SIGSEGV (as in the SIGBUS test).
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let sig = status.signal();
|
||||
assert!(
|
||||
sig == Some(libc::SIGABRT) || sig == Some(libc::SIGSEGV),
|
||||
"process should be killed by SIGABRT (or a secondary SIGSEGV), got signal={sig:?} status={status:?}"
|
||||
);
|
||||
}
|
||||
|
||||
let crash_file = tmp.path().join("last-crash.bin");
|
||||
assert!(crash_file.exists(), "crash file should exist after abort()");
|
||||
let data = std::fs::read(&crash_file).expect("read crash file");
|
||||
let blob = xai_crash_handler::format::CrashBlob::parse(&data).expect("crash blob should parse");
|
||||
assert_eq!(
|
||||
blob.signal, 6,
|
||||
"signal should be SIGABRT (6), got {}",
|
||||
blob.signal
|
||||
);
|
||||
assert_eq!(blob.app_version, "0.0.0-test");
|
||||
assert!(blob.pid > 0, "PID should be nonzero");
|
||||
assert!(blob.timestamp > 0, "timestamp should be nonzero");
|
||||
|
||||
// check_previous_crash should produce a SIGABRT-labelled report.
|
||||
let report =
|
||||
xai_crash_handler::check_previous_crash(tmp.path()).expect("should produce a crash report");
|
||||
assert!(
|
||||
report.signal_name.contains("SIGABRT"),
|
||||
"report should name SIGABRT, got {}",
|
||||
report.signal_name
|
||||
);
|
||||
assert_eq!(report.app_version, "0.0.0-test");
|
||||
assert!(report.report_path.exists(), "report file should be written");
|
||||
assert!(
|
||||
!crash_file.exists(),
|
||||
"crash file should be deleted after processing"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clean_exit_does_not_produce_crash_report() {
|
||||
let tmp = tempfile::tempdir().expect("tempdir");
|
||||
|
|
|
|||
Loading…
Reference in a new issue