Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix(bird_x): trust stdout even when Node 24 exits non-zero on handle search (#813)

SAI MOHANEESHb8cfb9d03ce2
diff --git a/skills/last30days/scripts/lib/bird_x.py b/skills/last30days/scripts/lib/bird_x.py
index 200a0434..3de5a55c 100644
--- a/skills/last30days/scripts/lib/bird_x.py
+++ b/skills/last30days/scripts/lib/bird_x.py
@@ -283,11 +283,18 @@ def _run_bird_search(query: str, count: int, timeout: int) -> Dict[str, Any]:
if terminal_error is not None:
return terminal_error
+ output = result.stdout.strip()
if result.returncode != 0:
- error = result.stderr.strip() or "Bird search failed"
- return {"error": error, "items": []}
+ if not output:
+ error = result.stderr.strip() or "Bird search failed"
+ return {"error": error, "items": []}
+ # Windows/Node 24: the vendored Bird CLI uses native fetch (undici),
+ # and calling process.exit() while keep-alive sockets are still
+ # closing trips a libuv assertion -> non-zero exit code AFTER it has
+ # already written a complete, valid JSON result to stdout. Trust
+ # stdout when it has content; only treat a non-zero exit as a real
+ # failure when stdout is empty.
- output = result.stdout.strip()
if not output:
return {"items": []}
@@ -455,11 +462,14 @@ def search_handles(
_log(f"Handle search error for @{handle}: {e}")
return []
+ output = result.stdout.strip()
if result.returncode != 0:
- _log(f"Handle search failed for @{handle}: {result.stderr.strip()}")
- return []
+ if not output:
+ _log(f"Handle search failed for @{handle}: {result.stderr.strip()}")
+ return []
+ # Windows/Node 24: benign libuv assertion can cause non-zero exit
+ # AFTER valid JSON is written to stdout. Trust stdout content.
- output = result.stdout.strip()
if not output:
return []