storkit: merge 452_bug_claude_code_pty_crashes_with_fatal_runtime_error_on_agent_restart

This commit is contained in:
dave
2026-04-02 10:27:34 +00:00
parent 488b798275
commit c6020b7f43
4 changed files with 18 additions and 0 deletions
Generated
+1
View File
@@ -4088,6 +4088,7 @@ dependencies = [
"futures", "futures",
"homedir", "homedir",
"ignore", "ignore",
"libc",
"libsqlite3-sys", "libsqlite3-sys",
"matrix-sdk", "matrix-sdk",
"mime_guess", "mime_guess",
+1
View File
@@ -40,3 +40,4 @@ pulldown-cmark = { version = "0.13.3", default-features = false, features = [
"html", "html",
] } ] }
regex = "1" regex = "1"
libc = "0.2"
+3
View File
@@ -38,6 +38,9 @@ regex = { workspace = true }
libsqlite3-sys = { version = "0.35.0", features = ["bundled"] } libsqlite3-sys = { version = "0.35.0", features = ["bundled"] }
wait-timeout = "0.2.1" wait-timeout = "0.2.1"
[target.'cfg(unix)'.dependencies]
libc = { workspace = true }
[dev-dependencies] [dev-dependencies]
tempfile = { workspace = true } tempfile = { workspace = true }
tokio-tungstenite = { workspace = true } tokio-tungstenite = { workspace = true }
+13
View File
@@ -124,6 +124,19 @@ fn resolve_path_arg(path_str: Option<&str>, cwd: &std::path::Path) -> Option<Pat
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), std::io::Error> { async fn main() -> Result<(), std::io::Error> {
// Reap zombie grandchildren on Unix (for native deployments without tini/init).
// Docker containers with `init: true` in docker-compose.yml already have tini
// as PID 1 for this. For native macOS/Linux, poll waitpid(-1, WNOHANG) in a
// background thread so orphaned grandchildren don't accumulate as zombies.
#[cfg(unix)]
std::thread::spawn(|| loop {
// SAFETY: waitpid(-1, ...) with WNOHANG is always safe to call.
unsafe {
while libc::waitpid(-1, std::ptr::null_mut(), libc::WNOHANG) > 0 {}
}
std::thread::sleep(std::time::Duration::from_secs(5));
});
let app_state = Arc::new(SessionState::default()); let app_state = Arc::new(SessionState::default());
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
let store = Arc::new( let store = Arc::new(