{"record":{"id":"517235022407377e","repo":"Hmbown/CodeWhale","slug":"pr-input-command-timed-out-no-partial-output-was-accepted","errorCode":null,"errorMessage":"PR input command timed out; no partial output was accepted","messagePattern":"PR input command timed out; no partial output was accepted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/review_pr.rs","lineNumber":494,"sourceCode":"    let mut child = command\n        .spawn()\n        .context(\"Failed to start PR input command\")?;\n    let stdout = child\n        .stdout\n        .take()\n        .context(\"PR command stdout unavailable\")?;\n    let stderr = child\n        .stderr\n        .take()\n        .context(\"PR command stderr unavailable\")?;\n    let stdout = std::thread::spawn(move || read_bounded(stdout, MAX_OUTPUT_BYTES));\n    let stderr = std::thread::spawn(move || read_bounded(stderr, 64 * 1024));\n    let status = match child.wait_timeout(Duration::from_secs(60))? {\n        Some(status) => status,\n        None => {\n            let _ = child.kill();\n            let _ = child.wait();\n            bail!(\"PR input command timed out; no partial output was accepted\");\n        }\n    };\n    let stdout = stdout\n        .join()\n        .map_err(|_| anyhow::anyhow!(\"PR stdout reader failed\"))??;\n    let stderr = stderr\n        .join()\n        .map_err(|_| anyhow::anyhow!(\"PR stderr reader failed\"))??;\n    if stdout.len() > MAX_OUTPUT_BYTES || stderr.len() > 64 * 1024 {\n        bail!(\n            \"PR input exceeds the bounded capture limit (8 MiB diff); no partial output was accepted\"\n        );\n    }\n    if !status.success() {\n        bail!(\n            \"PR input command failed: {}\",\n            String::from_utf8_lossy(&stderr).trim()\n        );","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/review_pr.rs#L476-L512","documentation":"run_command spawns a PR-input subprocess (gh or git), reading stdout/stderr on bounded reader threads and waiting with a 60-second timeout via wait_timeout. If the child does not exit in time it is killed and the tool bails with this message — partial output is never used, since a truncated diff or view would silently corrupt the review's integrity checks.","triggerScenarios":"`gh pr view`, `gh pr diff`, or the git invocations routed through run_command (fetch_view, fetch_diff, context_blob, git helpers) block longer than 60 seconds — e.g. gh hanging on network I/O or a credential prompt.","commonSituations":"gh waiting for interactive auth (expired token, no GH_TOKEN, browser prompt in a headless CI); slow/unreachable GitHub Enterprise endpoint; git credential-manager prompting on stdin; very large diffs on a slow disk; DNS hang in sandboxes.","solutions":["Check gh auth non-interactively: `gh auth status` and `GH_TOKEN`/`GITHUB_TOKEN` set, so gh never blocks on a login prompt","Disable credential prompts: `GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=never` and configure a cache/credential helper, then rerun","Test the exact command manually (`gh pr view <n> --json ...`) to see whether it is network slowness; retry or use a faster mirror/token with higher rate limits"],"exampleFix":"// before: gh blocks on interactive auth in CI\nrun: gh pr view 123 --json id\n// after: token exported, prompts off, timeout honored\nrun: |\n  export GH_TOKEN=${{ github.token }}\n  export GIT_TERMINAL_PROMPT=0\n  gh pr view 123 --json id","handlingStrategy":"try-catch","validationCode":"// preflight that gh/git run quickly and non-interactively\nassert!(std::env::var_os(\"GH_TOKEN\").is_some() || auth_status_ok(), \"export GH_TOKEN to avoid interactive gh auth\");\nstd::env::set_var(\"GIT_TERMINAL_PROMPT\", \"0\");","typeGuard":null,"tryCatchPattern":"match fetch_view(number, repo) {\n    Err(e) if e.to_string().contains(\"timed out\") => {\n        eprintln!(\"gh/git hung >60s; check auth prompts, network, and rerun with GIT_TERMINAL_PROMPT=0\");\n        retry_with_backoff(|| fetch_view(number, repo), 2)?;\n    }\n    other => other?,\n}","preventionTips":["Ensure GH_TOKEN/GITHUB_TOKEN is set so gh never opens a login prompt","Set GIT_TERMINAL_PROMPT=0 and a non-blocking credential helper in CI","Raise per-command timeouts or pre-test the command manually when reviewing very large PRs over slow networks"],"tags":["timeout","external-command","gh-cli","git"],"backgroundTag":"request-timeout","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T16:17:23.217Z"}