Skip to content

The agent that grows with you

fix(review): no background review fork for finite gateway turns

teknium18ccb58c1e4d0
diff --git a/agent/background_review.py b/agent/background_review.py
index 9297f0d7f5d..096f57a7038 100644
--- a/agent/background_review.py
+++ b/agent/background_review.py
@@ -206,8 +206,12 @@ def load_background_review_settings() -> tuple[bool, Dict[str, Any]]:
"""Single config read -> ``(enabled, task_cfg)``. Fail-open (``enabled=True``) so a broken
config never silently disables reviews — but WARN so the cost is visible."""
from agent.safe_worker_policy import safe_worker_enabled
+ from gateway.session_finite import finite_turn_required
- if safe_worker_enabled():
+ # A finite gateway turn (`chat -q` / `-z`) is one-shot like the in-process run, whose exit
+ # takes the daemon review thread with it; the long-lived gateway would otherwise fork a
+ # ~30K-token review after the viewer has already gone.
+ if safe_worker_enabled() or finite_turn_required() is True:
return False, {}
try:
from hermes_cli.config import load_config_readonly