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
fix(agentic-ide): stop mistaking a restored pane's own repaint for work
Ruben Lütked22a6f047d66
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 92d969d142..81bef8ab00 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -8421,3 +8421,69 @@ time the wait from the EVENT that makes the tool write, never from the moment wehappened to start it — and never let the last attempt be silent. Two of the fourCLIs here were pinned by tests that pre-created the session file and set thedelay to zero, which proved the mechanism and hid the timing entirely.++---++## BUG-122: "Continue interrupted" always reports zero — a restored pane redrawing its own screen is mistaken for an agent already at work (HIGH, FIXED 2026-07-31)++**Symptom (maintainer field report).** After restarting the app and resuming the+workspace, the "Continue interrupted" dialog says *"Nothing was interrupted —+every pane has been given something to do since it started"* and offers+**Continue all (0)**, with a grid of panes visibly sitting at their prompts+holding half-finished jobs behind it. Never once did the control list a pane.+The restore point on disk disagreed: `last_session.json` carried+`continuation_needed: true` for several panes at the very moment the dialog+claimed none.++**Root cause — start-up drawing reads as work.** The evidence chain is:+`ActivityWatcher` observes a pane working, the resume snapshot records+`continuation_needed`, restoring raises `Terminal.continuation_pending`, and the+scan lists every pane still carrying it. That chain was sound up to the restore.+What broke it was the FIRST sweep after the resumed pane's agent came up.++`activity.read_activity` deliberately reads nothing but screen MOVEMENT — the+one property that is not a claim about any particular coding CLI (see the module+docstring, and BUG-037's class of transcript-content traps). A restored CLI+repaints its banner, its model line and its whole old transcript over several+seconds before it settles at its prompt, and that burst is frame-for-frame+identical to an agent at work. Both consumers of the reading then drew the same+wrong conclusion in the same window:++* `notifications._checkpoint_resume_state` cleared `continuation_pending` on+ sight of `working` ("a resumed CLI that is already working carried on by+ itself"). Sweeps run every 2 s, so this landed within two sweeps of every+ resumed pane coming back — before any human could open the dialog.+* `interrupted.scan` filtered the pane out for the same reason, using the+ weaker byte-based fallback (`last_output_at`), which a repainting pane+ refreshes continuously.++Both are unconditional, so the offer could not survive a restart, and the count+behind the button was structurally zero for every user, on every platform.++**Fix — movement only counts once the pane has been SEEN standing still.**+`Terminal.idle_seen` records whether this pane's screen has been observed still+since its CURRENT process started; it is cleared on every spawn (beside+`last_output_at`) and raised by the notification sweep on a settled reading from+a real two-look comparison, never from the first-sight branch that has to ASSUME+stillness. A start-up burst always ends at a prompt, so "has stood still once"+separates painting from working without knowing anything about what any CLI+draws. The checkpoint now retracts the offer only for movement after that point,+and the scan applies its "already working" filter only then too. The question+check moved off `read_activity` onto its own reading (`activity.shows_question`),+because a pane can be repainting AND showing a trust prompt — and that is+precisely a pane not to type into; `read_activity` answers `working` first and+would have hidden the question.++**Guards.** `tests/unit/agentic_ide/test_pane_notifications.py` — a restored+pane painting itself keeps `continuation_pending`, and movement after it settled+still retracts it. `tests/unit/agentic_ide/test_interrupted.py` — a resumed pane+whose screen is moving is still offered while it has never been idle, and is+correctly withheld once it has.++**Class rule.** A detector built on one property must not let a SECOND consumer+apply it to a different question without asking whether that question has the+same blind spot. "Is the screen moving?" answers "is this agent busy?" only for+a process that has already settled once; for a process that just started it+answers "is this CLI drawing itself?", and every caller that conflates the two+fails silently in exactly the seconds after a restart — which is when the+feature is used.diff --git a/jarvis/agentic_ide/activity.py b/jarvis/agentic_ide/activity.pyindex 4fee8ae897..5bc05b28d0 100644--- a/jarvis/agentic_ide/activity.py+++ b/jarvis/agentic_ide/activity.py@@ -173,6 +173,18 @@ def _contains(rows: Sequence[str], fragments: Sequence[str]) -> bool:return any(fragment in row for row in lowered for fragment in fragments)+def shows_question(term: Any) -> bool:+ """Is there a question or a choice on this pane's screen right now?++ The same reading :func:`read_activity` uses for its ``asking`` word, asked+ on its own — because a caller can need it while the pane is also MOVING, and+ ``read_activity`` answers "working" first (movement is the stronger signal+ for what it is for). A pane redrawing itself around a trust prompt is both,+ and a caller deciding whether to type into it needs the question half.+ """+ return _contains(visible_rows(term), ASK_FRAGMENTS)++def _typing_now(term: Any, moment: float) -> bool:"""Is somebody at this pane's keyboard right now?@@ -257,5 +269,6 @@ __all__ = ["is_settled","read_activity","screen_digest",+ "shows_question","visible_rows",]diff --git a/jarvis/agentic_ide/interrupted.py b/jarvis/agentic_ide/interrupted.pyindex 53d3a3dc70..e0fbfb5c92 100644--- a/jarvis/agentic_ide/interrupted.py+++ b/jarvis/agentic_ide/interrupted.py@@ -32,6 +32,13 @@ That matters, because the tempting heuristics are all wrong:empty. Whatever the old process printed died with its screen.* **"It was resumed"** alone — true of every pane in a restored workspace,including the ones somebody has already put back to work.+* **"Its screen is moving, so it carried on by itself"** — the opposite+ mistake, and the one that broke this feature outright. A restored CLI+ repaints its banner and its old transcript for several seconds before it+ settles at a prompt; reading that as work retracted the offer for every+ restored pane within two sweeps of it coming back, so the button reported+ zero for ever. Movement only counts once the pane has been SEEN standing+ still (:attr:`Terminal.idle_seen`).## What the nudge is@@ -57,7 +64,7 @@ from typing import TYPE_CHECKING, Anyfrom loguru import logger-from .activity import read_activity+from .activity import read_activity, shows_questionfrom .recap import condensefrom .session import SessionError, accepts_prompts@@ -243,9 +250,21 @@ def scan(registry: Registry) -> list[InterruptedPane]:for term in session.terminals:if not term.continuation_pending:continue- if term.status == "live" and read_activity(term) != "waiting":- # A pane already working needs no nudge, and a pane asking a- # question needs an answer rather than a blind "continue".+ if term.status == "live" and shows_question(term):+ # A pane asking something needs an ANSWER, not a blind+ # "continue". Read straight off the screen rather than through+ # `read_activity`, which answers "working" first — a pane can be+ # repainting itself around a trust prompt, and that is precisely+ # a pane not to type into.+ continue+ if term.status == "live" and term.idle_seen and read_activity(term) != "waiting":+ # A pane already working needs no nudge.+ #+ # Only once the pane has been SEEN standing still, though. Until+ # then its screen is moving because its CLI is drawing itself+ # back onto it — which is what a restored pane does for its+ # first few seconds, and reading that as work hid every pane+ # this list exists to show (see `Terminal.idle_seen`).continueif not accepts_prompts(term.agent):# A plain terminal is a shell. Jarvis does not type into one, sodiff --git a/jarvis/agentic_ide/notifications.py b/jarvis/agentic_ide/notifications.pyindex f8df08188b..786f26261b 100644--- a/jarvis/agentic_ide/notifications.py+++ b/jarvis/agentic_ide/notifications.py@@ -477,6 +477,12 @@ class ActivityWatcher:# ``now`` travels into the read as well, so a test can place a pane on# its own timeline instead of racing the wall clock.activity = read_activity(term, now=now, still_since=watch.changed_at)+ if is_settled(activity):+ # An OBSERVED still screen — two looks at the same picture, never+ # the assumption the first-sight branch above has to make. From here+ # on, movement in this pane is an agent working rather than its CLI+ # drawing itself back onto the screen (see `Terminal.idle_seen`).+ term.idle_seen = Trueif activity != watch.activity:if watch.activity == "working":@@ -533,8 +539,14 @@ class ActivityWatcher:preserved while it waits at its prompt."""if activity == "working":- # A resumed CLI that is already working carried on by itself.- term.continuation_pending = False+ if getattr(term, "idle_seen", False):+ # It stood still and then moved again, so somebody put this pane+ # back to work and the offer to continue it is spent.+ term.continuation_pending = False+ # Otherwise this is the pane's CLI painting itself back onto the+ # screen after a restart — the exact seconds in which the offer is+ # needed, and where retracting it made the button report zero for+ # every restored pane, for ever (see `Terminal.idle_seen`).self._set_resume_needed(term, watch, True)returnif activity in {"asking", "failed"}:diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex e6483f8154..89f7aa5c36 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -913,6 +913,28 @@ class Terminal:# answer worn differently. So the wish is REMEMBERED here and spent by# `attach` the moment that pane's agent exists.continue_when_ready: bool = False+ # Has this pane's screen been observed STANDING STILL since its current+ # process started?+ #+ # The line between "the agent carried on by itself" and "its CLI is drawing+ # itself back onto the screen". Both are movement, and movement is the only+ # thing the activity detector reads (see `.activity`) — so a resumed pane+ # repainting its banner and its old transcript reads exactly like an agent+ # at work, for the several seconds that takes.+ #+ # **The bug this fixes.** Both readers of that signal got it wrong in the+ # same window: the notification sweep retracted `continuation_pending`+ # ("it is already working, it needs no nudge") and the scan filtered the+ # pane out — so every restored pane lost its offer to continue within two+ # sweeps of coming back, and the button reported zero for ever. Reported as+ # "the Continue feature does not work".+ #+ # A start-up burst always ends at a prompt, so "has stood still at least+ # once" separates the two without knowing anything about what any CLI+ # draws. Raised by the notification sweep on an observed still screen (two+ # looks, never a single one), cleared on every spawn. Never persisted — it+ # describes the process now running in the pane.+ idle_seen: bool = Falsetranscript: Transcript = field(default_factory=Transcript)# The RAW output stream, kept so the next viewer can be handed the screen# this pane is actually showing. Cleared on a fresh spawn, so what a viewer@@ -2552,6 +2574,10 @@ class Registry:# Cleared rather than left alone so a restarted pane cannot inherit the# previous process's last output either.term.last_output_at = None+ # And this process has not stood still yet, whatever the previous one+ # did. Everything it is about to draw is a CLI painting itself, not an+ # agent working — see the field.+ term.idle_seen = Falseif term.resume is None and can_resume(term.agent):# A CLI that cannot be told its session id (Codex): find out which# one it just created, shortly from now.diff --git a/tests/unit/agentic_ide/test_interrupted.py b/tests/unit/agentic_ide/test_interrupted.pyindex 81be6e5add..9c1e8ac22e 100644--- a/tests/unit/agentic_ide/test_interrupted.py+++ b/tests/unit/agentic_ide/test_interrupted.py@@ -20,7 +20,7 @@ from typing import Anyimport pytest-from jarvis.agentic_ide import activity, interrupted, resume_store+from jarvis.agentic_ide import activity, interrupted, notifications, resume_storefrom jarvis.agentic_ide import session as session_modfrom jarvis.agentic_ide.agent_sessions import ResumeHandlefrom jarvis.agentic_ide.session import Registry@@ -28,6 +28,14 @@ from jarvis.ui.web import agentic_ide_routesfrom tests.fakes.fake_pty_manager import FakePtyManager[email protected](autouse=True)+def _clean_watcher() -> Any:+ """No pane memory carried in from another test, and none left behind."""+ notifications.reset()+ yield+ notifications.reset()++@pytest.fixturedef fake_pty() -> FakePtyManager:return FakePtyManager()@@ -132,13 +140,38 @@ async def test_a_resumed_pane_already_working_is_not_offered_continue(reading what the CLI prints, so this drives the property it does read. Fakingit with a status line here would test a rule the product no longer has, andwould keep passing after that rule broke.++ The pane has stood still once already (`idle_seen`), which is what makes the+ movement work rather than a CLI painting itself — see the test below."""_session, term = await _restarted_pane(registry, tmp_path, existing_conversation)+ term.idle_seen = Trueterm.last_output_at = time.time()assert interrupted.scan(registry) == []+async def test_a_resumed_pane_still_painting_itself_is_still_offered(+ registry: Registry, tmp_path: Path, existing_conversation: Any+) -> None:+ """The regression this whole flag exists for.++ A restored CLI redraws its banner and its old transcript for several seconds+ before it settles at a prompt, and that movement is indistinguishable from+ work to a detector that only reads movement. Treating it as work filtered+ every restored pane out of this list in exactly the seconds somebody presses+ the button — reported as "the Continue feature does not work".++ A pane that has never been seen standing still since its process started is+ therefore still offered, however busy its screen looks.+ """+ _session, term = await _restarted_pane(registry, tmp_path, existing_conversation)+ assert term.idle_seen is False, "a freshly spawned process has settled nothing"+ term.last_output_at = time.time()++ assert [pane.name for pane in interrupted.scan(registry)] == [term.name]++async def test_a_resumed_pane_asking_a_question_is_not_offered_continue(registry: Registry, tmp_path: Path, existing_conversation: Any) -> None:@@ -445,6 +478,63 @@ async def test_a_restored_pane_is_listed_before_its_agent_starts(assert waiting[0].starting is True+async def test_a_restored_pane_survives_its_own_start_up_burst(+ registry: Registry, tmp_path: Path, existing_conversation: Any+) -> None:+ """The whole chain, end to end, through the sweep that used to break it.++ A restored CLI repaints its banner, its model line and its old transcript+ for several seconds before it settles — and the detector under all of this+ reads MOVEMENT, so that burst is frame-for-frame an agent at work. Both+ readers drew that conclusion: the notification sweep retracted the pane's+ `continuation_pending` and the scan filtered it out, within two sweeps of+ every resumed pane coming back. The dialog then said "nothing was+ interrupted" over a grid of panes sitting at their prompts, for ever.++ So the burst is driven here for real, on both clocks the two readers use.+ """+ existing_conversation("conv-restored")+ resume_store.save(+ resume_store.Snapshot(+ saved_at=100.0,+ workspaces=[+ resume_store.SnapshotWorkspace(+ session_id="ide_old",+ folder=str(tmp_path),+ terminals=[+ resume_store.SnapshotTerminal(+ key="alex",+ name="Alex",+ agent="claude",+ resume=ResumeHandle(+ kind="claude_session", id="conv-restored", captured_at=1.0+ ),+ prompts_sent=2,+ continuation_needed=True,+ )+ ],+ )+ ],+ )+ )+ await registry.restore(resume_store.load())+ term = await registry.attach("Alex", 100, 30, _noop, _noop_exit)+ assert term.resumed is True, "the fixture must reproduce a real resume"++ watcher = notifications.watcher()+ for frame in range(3):+ term.transcript.clear()+ term.transcript.feed(f"\r\n replaying the old conversation, frame {frame}\r\n")+ # The scan reads the wall clock through the byte fallback, the sweep+ # reads its own timeline through the screen digest. Both have to see a+ # pane that is busy drawing itself.+ term.last_output_at = time.time()+ watcher.poll(registry, now=100.0 + frame * notifications.SWEEP_INTERVAL_S, emit=False)++ assert term.continuation_pending is True, "drawing itself is not carrying on"+ assert [pane.name for pane in interrupted.scan(registry)] == ["Alex"]++async def _settle(session: Any) -> None:"""Wait only for this session's deferred work, never the whole test loop."""pending = tuple(session.lookups)diff --git a/tests/unit/agentic_ide/test_pane_notifications.py b/tests/unit/agentic_ide/test_pane_notifications.pyindex 77a1dbea9e..6f4dfa16ee 100644--- a/tests/unit/agentic_ide/test_pane_notifications.py+++ b/tests/unit/agentic_ide/test_pane_notifications.py@@ -413,6 +413,54 @@ async def test_a_question_clears_the_restart_checkpoint_immediately(assert watcher.take_resume_dirty() is True+async def test_a_restored_pane_painting_itself_keeps_its_continue_offer(+ registry: Registry, tmp_path: Path+) -> None:+ """The regression that broke the Continue button outright.++ A restored CLI redraws its banner and its old transcript for several seconds+ before it settles, and this detector reads MOVEMENT — so that burst is+ frame-for-frame an agent at work. Retracting `continuation_pending` for it+ took every restored pane off the Continue list within two sweeps of coming+ back, and the dialog reported "nothing was interrupted" for ever.++ Movement only counts once the pane has been SEEN standing still.+ """+ watcher = notifications.watcher()+ _session, term = await _pane(registry, tmp_path)+ # What a restore leaves behind: the pane picked its conversation back up and+ # nobody has told it anything since.+ term.continuation_pending = True+ assert term.idle_seen is False, "a freshly spawned process has settled nothing"++ _busy(watcher, registry, term, start=100.0)++ assert term.continuation_pending is True, "a CLI drawing itself is not the agent working"+++async def test_movement_after_the_pane_settled_does_retract_the_offer(+ registry: Registry, tmp_path: Path+) -> None:+ """The other edge, and why the flag is "settled once" rather than a timer.++ Once a pane has stood at its prompt, anything that moves it again is work+ somebody asked for — so continuing it would put a second instruction behind+ the one already running.+ """+ watcher = notifications.watcher()+ _session, term = await _pane(registry, tmp_path)+ term.continuation_pending = True++ # It comes up, paints itself, and settles at its prompt.+ _rest(watcher, registry, term, IDLE_SCREEN, at=100.0, emit=False)+ assert term.idle_seen is True+ assert term.continuation_pending is True, "sitting at a prompt is what waiting looks like"++ _busy(watcher, registry, term, start=100.0 + STILL_S + 2)++ assert term.continuation_pending is False++async def test_a_pane_that_was_never_busy_is_never_reported(registry: Registry, tmp_path: Path) -> None: