Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agentic-ide): log what a busy refusal was based on

rubenluetke10-beep6aa5d704359b
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 83bfad7596..91655d0544 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -6771,6 +6771,7 @@ class Registry:
)
mid_turn = True
elif busy:
+ self._log_busy_refusal(term, busy)
raise AgentBusyError("The selected coding agent is busy; nothing was sent.")
pending = None
if followup is not None and followup.get("reply_surface") in {"voice", "chat"}:
@@ -6818,6 +6819,34 @@ class Registry:
return "starting"
return ""
+ @staticmethod
+ def _log_busy_refusal(term: Terminal, busy: str) -> None:
+ """Record what a busy refusal was based on, so a wrong one can be traced.
+
+ A refusal of an idle agent (live 2026-10-07) left nothing behind to
+ tell a stale stamp from missing lifecycle evidence. No prompt text.
+ """
+ from .task_state import evidence
+
+ now = time.time()
+ proof = evidence(term, now=now)
+
+ def age(at: float | None) -> str:
+ return f"{now - at:.0f}s" if at else "never"
+
+ logger.info(
+ "Agentic IDE: refused a prompt for {} as busy ({}): evidence={} ({} old), "
+ "stamp={} ({} old), last submit age={}, submitted to this process={}",
+ term.name,
+ busy,
+ proof.state if proof else "none",
+ age(proof.at) if proof else "-",
+ term.activity or "none",
+ age(term.activity_at),
+ age(term.last_submit_at),
+ term.submit_generation == term.process_generation,
+ )
+
async def _interrupt_turn(self, owner: Session, term: Terminal) -> tuple[str, bool]:
"""Press Stop once and wait for the turn to end.
diff --git a/tests/unit/agentic_ide/test_send_gate.py b/tests/unit/agentic_ide/test_send_gate.py
index 69131b03ff..c4c1b6f3c6 100644
--- a/tests/unit/agentic_ide/test_send_gate.py
+++ b/tests/unit/agentic_ide/test_send_gate.py
@@ -361,3 +361,25 @@ async def test_interrupt_on_a_pane_that_never_starts_working_presses_nothing(pan
await correct(registry, workspace, term, "interrupt")
assert refused.value.interrupted is False
assert pressed == [] and sent == []
+
+
+async def test_a_busy_refusal_records_what_it_was_based_on(pane):
+ from loguru import logger
+
+ registry, workspace, term, record, sent = pane
+ now = time.time()
+ submitted(term, now - 300)
+ write(record, user(now - 299), assistant(now - 5, stop="tool_use"))
+ activity.stamp(term, "waiting", now=now - 2)
+ lines: list[str] = []
+ sink = logger.add(lambda message: lines.append(str(message)), level="INFO")
+ try:
+ with pytest.raises(SessionError, match="busy"):
+ await send(registry, workspace, term)
+ finally:
+ logger.remove(sink)
+ refusal = next(line for line in lines if "refused a prompt" in line)
+ assert "T1 as busy (working)" in refusal
+ assert "evidence=working" in refusal and "stamp=waiting" in refusal
+ assert "Updated brief" not in refusal
+ assert sent == []