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.

fix(agentic-ide): exact pane scrollbar for Claude Code and Codex (#787)

Ruben Lütked15f504774a9
diff --git a/dodaios/agentic_ide/pane_sessions.py b/dodaios/agentic_ide/pane_sessions.py
index 730f632fbd..f30562b3ad 100644
--- a/dodaios/agentic_ide/pane_sessions.py
+++ b/dodaios/agentic_ide/pane_sessions.py
@@ -52,6 +52,12 @@ def settings_file() -> Path:
# installs and cmd on others; a quoted forward-slash path works in both.
command = f'"{_interpreter().as_posix()}" "{script.as_posix()}"'
settings = {
+ # The classic renderer, whatever the user's own settings say: with
+ # ``CLAUDE_CODE_NO_FLICKER`` on, Claude Code takes the alternate screen
+ # and keeps the conversation inside its own UI, so the pane's terminal
+ # has no history and its scrollbar no position to show. Settings given
+ # with ``--settings`` outrank the user's, and only these panes get them.
+ "env": {"CLAUDE_CODE_NO_FLICKER": "0"},
"hooks": {
"SessionStart": [{"hooks": [{"type": "command", "command": command, "timeout": 10}]}]
}
diff --git a/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx b/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx
index 5ddeef986d..ef0001861e 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx
+++ b/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.test.tsx
@@ -173,6 +173,19 @@ describe("PaneScrollbar", () => {
expect(wheels).toHaveLength(2);
expect(wheels[1].deltaY).toBe(1);
expect(term.scrollLines).not.toHaveBeenCalled();
+ // No thumb: a full-screen CLI's position is not knowable from outside.
+ expect(screen.queryByTestId("bar-thumb")).toBeNull();
+ });
+
+ it("follows a wheel scroll on an idle pane while the bar is shown", () => {
+ const { term, active } = fakeTerminal({ baseY: 100, viewportY: 100 });
+ render(<Harness term={term} />);
+ fireEvent.wheel(screen.getByTestId("region"), { deltaY: -100 });
+ active.viewportY = 0;
+ act(() => {
+ vi.advanceTimersByTime(250);
+ });
+ expect(screen.getByTestId("bar").getAttribute("aria-valuenow")).toBe("0");
});
it("follows the terminal into app mode when the CLI takes the screen", () => {
diff --git a/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx b/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx
index 91f45d4344..cea19d4c5f 100644
--- a/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx
+++ b/dodaios/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx
@@ -14,8 +14,13 @@
* negotiate mouse reporting (?1003/?1006). The bar then drives the CLI with
* real wheel notches through xterm's own mouse encoder, exactly as the
* physical wheel would. No position is shown there, because none is knowable
- * from outside the CLI: the grip springs back to the middle and acts like a
- * jog wheel, the arrows and the track halves step and page.
+ * from outside the CLI: there is no thumb at all, only the arrows and the
+ * track halves, which step and page. (A centred "jog" grip shipped first and
+ * was read as "you are in the middle" while the pane sat at its end.)
+ *
+ * The panes start Claude Code and Codex in their classic renderers (see
+ * `pane_sessions.settings_file` and the Codex `launch_args`), so they normally
+ * run in `history` mode; `app` mode remains for other full-screen CLIs.
*
* Wheel notches are only ever sent while the CLI reports the mouse. On an
* alternate screen WITHOUT mouse reporting xterm turns a wheel into arrow keys,
@@ -49,8 +54,6 @@ export type PaneScrollState = {
export const SCROLLBAR_LINGER_MS = 1800;
/** Width of the right-edge strip that reveals the bar on hover, in px. */
const EDGE_REVEAL_PX = 28;
-/** Pointer travel per wheel notch while dragging the grip in app mode. */
-const APP_DRAG_PX_PER_NOTCH = 14;
/** Auto-repeat of a held arrow or track press. */
const REPEAT_DELAY_MS = 320;
const REPEAT_INTERVAL_MS = 60;
@@ -118,8 +121,6 @@ export function PaneScrollbar({ termRef, epoch, regionRef, labels, testId }: Pro
const [shown, setShown] = useState(false);
const [hovered, setHovered] = useState(false);
const [dragging, setDragging] = useState(false);
- /** App-mode grip offset from the centre while dragging, in px. */
- const [jog, setJog] = useState(0);
const trackRef = useRef<HTMLDivElement | null>(null);
const hideTimer = useRef<number | null>(null);
const repeatTimer = useRef<number | null>(null);
@@ -174,6 +175,15 @@ export function PaneScrollbar({ termRef, epoch, regionRef, labels, testId }: Pro
};
}, [termRef, epoch, refresh]);
+ // While the bar is on screen, re-read the position a few times a second. A
+ // wheel scroll on an idle pane writes nothing, and the 2026-08 rail showed
+ // stale positions for exactly that reason.
+ useEffect(() => {
+ if (!shown && !hovered && !dragging) return;
+ const timer = window.setInterval(refresh, 200);
+ return () => window.clearInterval(timer);
+ }, [shown, hovered, dragging, refresh]);
+
// Scrolling inside the pane, or pointing at its right edge, shows the bar.
useEffect(() => {
const region = regionRef.current;
@@ -273,32 +283,21 @@ export function PaneScrollbar({ termRef, epoch, regionRef, labels, testId }: Pro
event.preventDefault();
event.stopPropagation();
const mode = readPaneScrollState(term).mode;
- if (mode === "none") return;
+ if (mode !== "history") return;
const target = event.currentTarget;
target.setPointerCapture?.(event.pointerId);
const startY = event.clientY;
const startLine = term.buffer.active.viewportY;
const { travel } = historyThumb();
const baseY = Math.max(1, term.buffer.active.baseY);
- let notchesSent = 0;
setDragging(true);
const move = (ev: PointerEvent) => {
const dy = ev.clientY - startY;
if (readPaneScrollState(term).mode !== mode) return;
- if (mode === "history") {
- if (travel <= 0) return;
- const line = Math.round(startLine + (dy * baseY) / travel);
- term.scrollToLine(Math.max(0, Math.min(term.buffer.active.baseY, line)));
- } else {
- const half = Math.max(0, trackHeight() / 2 - 16);
- setJog(Math.max(-half, Math.min(half, dy)));
- const wanted = Math.trunc(dy / APP_DRAG_PX_PER_NOTCH);
- const delta = wanted - notchesSent;
- if (delta !== 0) {
- notchesSent += sendWheelNotches(term, delta < 0 ? -1 : 1, Math.abs(delta)) * Math.sign(delta);
- }
- }
+ if (travel <= 0) return;
+ const line = Math.round(startLine + (dy * baseY) / travel);
+ term.scrollToLine(Math.max(0, Math.min(term.buffer.active.baseY, line)));
reveal();
};
const end = () => {
@@ -306,7 +305,6 @@ export function PaneScrollbar({ termRef, epoch, regionRef, labels, testId }: Pro
target.removeEventListener("pointerup", end);
target.removeEventListener("pointercancel", end);
setDragging(false);
- setJog(0);
reveal();
};
target.addEventListener("pointermove", move);
@@ -384,21 +382,18 @@ export function PaneScrollbar({ termRef, epoch, regionRef, labels, testId }: Pro
onPointerDown={pressTrack}
className="relative w-full min-h-0 flex-1 cursor-default"
>
- <div
- data-testid={testId ? `${testId}-thumb` : undefined}
- onPointerDown={startDrag}
- className={cn(
- "absolute left-1/2 w-1.5 -translate-x-1/2 rounded-full",
- "bg-[hsl(var(--muted-foreground)/0.6)] hover:w-2 hover:bg-[hsl(var(--muted-foreground))]",
- dragging && "w-2 bg-[hsl(var(--foreground)/0.75)]",
- state.mode === "app" && !dragging && "transition-[top] duration-150",
- )}
- style={
- thumb
- ? { top: thumb.top, height: thumb.size }
- : { top: `calc(50% - 16px + ${jog}px)`, height: 32 }
- }
- />
+ {thumb && (
+ <div
+ data-testid={testId ? `${testId}-thumb` : undefined}
+ onPointerDown={startDrag}
+ className={cn(
+ "absolute left-1/2 w-1.5 -translate-x-1/2 rounded-full",
+ "bg-[hsl(var(--muted-foreground)/0.6)] hover:w-2 hover:bg-[hsl(var(--muted-foreground))]",
+ dragging && "w-2 bg-[hsl(var(--foreground)/0.75)]",
+ )}
+ style={{ top: thumb.top, height: thumb.size }}
+ />
+ )}
</div>
<button
type="button"
diff --git a/dodaios/workspace/agents.py b/dodaios/workspace/agents.py
index 327b39a3ec..7ea1362d2b 100644
--- a/dodaios/workspace/agents.py
+++ b/dodaios/workspace/agents.py
@@ -815,7 +815,13 @@ _AGENTS: dict[str, WorkspaceAgent] = {
# of embedded panes. A per-launch override leaves standalone Codex and
# the account's saved settings untouched; installation remains available
# through Jarvis's CLI controls.
- launch_args=("-c", "check_for_update_on_startup=false"),
+ #
+ # ``--no-alt-screen``: the pane's terminal keeps the conversation as
+ # real scrollback, so the pane scrollbar can show and seek the true
+ # position. On the alternate screen Codex keeps its history inside its
+ # own UI, and no position is knowable from outside (measured on 0.160:
+ # ?1049 plus ?1003 mouse reporting). Also accepted after ``resume``.
+ launch_args=("-c", "check_for_update_on_startup=false", "--no-alt-screen"),
trust=CODEX_TRUST,
account=AccountSpec(env=(("CODEX_HOME", "{dir}"),), native_dir="~/.codex"),
win_shim=WinShim(
diff --git a/tests/unit/agentic_ide/test_pane_sessions.py b/tests/unit/agentic_ide/test_pane_sessions.py
index 1eeff6ba0f..2eecbd4725 100644
--- a/tests/unit/agentic_ide/test_pane_sessions.py
+++ b/tests/unit/agentic_ide/test_pane_sessions.py
@@ -111,3 +111,13 @@ async def test_a_reboot_resumes_the_conversation_after_clear(
argv = " ".join(pool.spawns[0]["argv"])
assert "--resume after-clear-id" in argv, argv
assert "launch-id" not in argv
+
+
+def test_settings_file_turns_claudes_fullscreen_renderer_off(tmp_path, monkeypatch):
+ """A pane's terminal must hold the conversation, or its scrollbar has no position."""
+ import json
+
+ monkeypatch.setattr(pane_sessions, "_state_dir", lambda: tmp_path / "state")
+ data = json.loads(pane_sessions.settings_file().read_text(encoding="utf-8"))
+ assert data["env"]["CLAUDE_CODE_NO_FLICKER"] == "0"
+ assert "SessionStart" in data["hooks"]
diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.py
index db1929b8b0..d3d7fcfd9c 100644
--- a/tests/unit/agentic_ide/test_session.py
+++ b/tests/unit/agentic_ide/test_session.py
@@ -89,7 +89,7 @@ def test_codex_npm_shim_is_bypassed_with_absolute_node(tmp_path, monkeypatch) ->
assert tuple(os.path.normcase(part) for part in argv[:2]) == tuple(
os.path.normcase(str(path)) for path in (node_exe, codex_js)
)
- assert argv[2:] == ("-c", "check_for_update_on_startup=false")
+ assert argv[2:] == ("-c", "check_for_update_on_startup=false", "--no-alt-screen")
assert not any(part.lower().endswith((".cmd", ".bat")) for part in argv)
diff --git a/tests/unit/workspace/test_codex_embedded_launch.py b/tests/unit/workspace/test_codex_embedded_launch.py
index d216f343ef..f591828c56 100644
--- a/tests/unit/workspace/test_codex_embedded_launch.py
+++ b/tests/unit/workspace/test_codex_embedded_launch.py
@@ -27,6 +27,8 @@ def test_embedded_codex_suppresses_update_box_on_every_launch(
assert argv[-2:] == ("resume", "conversation")
assert argv[1:3] == ("-c", "check_for_update_on_startup=false")
+ # Real scrollback in the pane, so its scrollbar shows the true position.
+ assert argv[3] == "--no-alt-screen"
# Only pane launches get the override, never detection or the plain CLI
# command used outside the embedded IDE.
agent = get_agent("codex")