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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(ide): report jobs agents finished while the app was closed
rubenluetke10-beep15d3c1de9932
diff --git a/jarvis/agentic_ide/notifications.py b/jarvis/agentic_ide/notifications.pyindex 281b927eef..9f6ea45852 100644--- a/jarvis/agentic_ide/notifications.py+++ b/jarvis/agentic_ide/notifications.py@@ -526,11 +526,20 @@ class ActivityWatcher:# working, and claims nothing that was not observed.settled_at = now - STILL_S - 1.0activity = read_activity(term, now=now, still_since=settled_at)+ # The one exception: an agent that kept working while the app was+ # closed (the PTY host held it) and was working at the last+ # checkpoint. Its finish happened with nobody watching, so it is+ # seeded as a job in progress — the next still sweep reports it+ # "completed", exactly as if the app had stayed open (RUB-102).+ detached_work = bool(getattr(term, "worked_while_detached", False))+ if detached_work:+ term.worked_while_detached = Falsewatch = _PaneWatch(- activity=activity,+ activity="working" if detached_work else activity,since=now,- announced=True,- tasked=_tasked(term),+ announced=not detached_work,+ worked=detached_work,+ tasked=_tasked(term) or detached_work,resume_needed=bool(getattr(term, "resume_continuation_needed", False)),digest=digest,changed_at=settled_at,diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex e1972556f8..e94715ccd6 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -1022,6 +1022,11 @@ class Terminal:# Restored from the snapshot: was this pane's agent running when the app# last saved? Read once, by ``_resume_after_reboot``.was_running: bool = False+ # Re-joined after an app restart while its last checkpoint saw it working:+ # whatever it finished in the meantime nobody was watching. The pane+ # watcher reads this once, on first sight, to report that finish instead+ # of treating it as history (``notifications.ActivityWatcher._step``).+ worked_while_detached: bool = Falseerror: str = ""started_at: float | None = Nonelast_output_at: float | None = None@@ -2324,6 +2329,7 @@ class Registry:term.error = ""term.exit_code = Noneterm.resumed = False+ term.worked_while_detached = term.resume_continuation_needed# Never interrupted, so never offered a "continue" — the flag# ``_mark_restored_continuations`` may have raised assumed a restart.term.continuation_pending = Falsediff --git a/tests/unit/agentic_ide/test_ide_runtime_lifecycle.py b/tests/unit/agentic_ide/test_ide_runtime_lifecycle.pyindex c9b780e25d..cf6d868fb2 100644--- a/tests/unit/agentic_ide/test_ide_runtime_lifecycle.py+++ b/tests/unit/agentic_ide/test_ide_runtime_lifecycle.py@@ -190,3 +190,52 @@ def test_runtime_status_before_anything_started() -> None:"workspaces": 0,"live_agents": 0,}+++# ------------------------------------------------- finished while closed+async def _idle_pane(registry: ide.Registry, folder: Path):+ async def noop(_value: object) -> None:+ return None++ session = await registry.start(str(folder), [{"agent": "claude", "name": "Alex"}])+ term = await registry.attach("Alex", 100, 30, noop, noop)+ term.transcript.feed("\r\n❯ \r\n")+ term.last_output_at = 0.0+ term.last_input_at = None+ return session, term+++async def test_a_job_finished_while_the_app_was_closed_rings_the_bell(tmp_path: Path) -> None:+ from jarvis.agentic_ide import notifications+ from jarvis.agentic_ide.notifications import SETTLE_S++ notifications.reset()+ try:+ registry = ide.Registry(pty_manager=FakeHostedPool())+ _session, term = await _idle_pane(registry, tmp_path)+ # Re-joined after an app restart; the last checkpoint saw it working.+ term.worked_while_detached = True+ watcher = notifications.watcher()++ assert watcher.poll(registry, now=100.0) == [] # first sight files nothing+ filed: list[notifications.Notification] = []+ for moment in (105.0, 105.0 + SETTLE_S + 1.0, 130.0 + SETTLE_S):+ filed += watcher.poll(registry, now=moment)+ assert [entry.kind for entry in filed] == ["completed"]+ assert term.worked_while_detached is False+ finally:+ notifications.reset()+++async def test_an_idle_rejoined_pane_stays_quiet(tmp_path: Path) -> None:+ from jarvis.agentic_ide import notifications++ notifications.reset()+ try:+ registry = ide.Registry(pty_manager=FakeHostedPool())+ await _idle_pane(registry, tmp_path)+ watcher = notifications.watcher()+ for moment in (100.0, 110.0, 200.0, 900.0):+ assert watcher.poll(registry, now=moment) == []+ finally:+ notifications.reset()diff --git a/tests/unit/agentic_ide/test_reboot_resume.py b/tests/unit/agentic_ide/test_reboot_resume.pyindex c272cfa6c3..45cbb1b5d5 100644--- a/tests/unit/agentic_ide/test_reboot_resume.py+++ b/tests/unit/agentic_ide/test_reboot_resume.py@@ -200,3 +200,21 @@ def test_a_damaged_snapshot_is_kept_aside_instead_of_overwritten() -> None:assert not path.exists()kept = list(path.parent.glob(f"{path.stem}.damaged-*{path.suffix}"))assert len(kept) == 1 and kept[0].read_text(encoding="utf-8") == '{"workspaces": ['+++async def test_a_survivor_that_was_working_is_marked_for_the_bell(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ ws, _ = _save(tmp_path, [_pane(1, working=True), _pane(2)])+ _store(ws)+ pool = FakeHostedPool()+ pool.add_hosted("h-1", history_id="hist-1")+ pool.add_hosted("h-2", history_id="hist-2")++ registry, nudged = await _boot(monkeypatch, pool)++ session = registry.sessions[0]+ assert session.find("T1").worked_while_detached is True+ assert session.find("T2").worked_while_detached is False+ # Re-joined agents are never nudged: they never stopped.+ assert nudged == []