Kitty graphics continuation chunks omit q=2, causing terminal ACK spam over SSH/iTerm2

Open 💬 0 comments Opened Aug 7, 2026 by jthackray

What version of Codex CLI is running?

0.147.0

What subscription do you have?

Enterprise

Which model were you using?

gpt-5.6-sol medium

What platform is your computer?

Linux 6.8.0-136-generic x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

iTerm2 3.6.11

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1786114099s since unix epoch",
  "overallStatus": "ok",
  "codexVersion": "0.147.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/home/jontha01/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/home/jontha01/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/home/jontha01/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/home/jontha01/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/home/jontha01/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "OpenAI auth is not required for the active model provider",
      "details": {
        "auth env vars present": "OPENAI_API_KEY",
        "auth file": "/home/jontha01/.codex/auth.json",
        "auth storage mode": "File",
        "model provider requires OpenAI auth": "false"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/home/jontha01/.codex",
        "config.toml": "/home/jontha01/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/data_nvme1n1/jontha01/llvm-project",
        "enabled feature flags": "shell_tool, view_image, unified_exec, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, in_app_updates, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, item_ids, skill_mcp_dependency_install, skill_search, mentions_v2, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, fast_mode, tui_app_server, remote_compaction_v2, workspace_dependencies",
        "feature flag overrides": "none",
        "feature flags enabled": "39",
        "log dir": "/home/jontha01/.codex/log",
        "mcp servers": "4",
        "model": "gpt-5.6-sol",
        "model provider": "proxy",
        "sqlite home": "/home/jontha01/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.54.0",
      "details": {
        ".git entry": "directory",
        "PATH git #1": "/home/linuxbrew/.linuxbrew/bin/git",
        "PATH git #2": "/usr/bin/git",
        "PATH git #3": "/bin/git",
        "PATH git entries": "3",
        "git branch": "main",
        "git build options": "git version 2.54.0; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; rust: disabled; gettext: enabled; libcurl: 8.19.0; OpenSSL: OpenSSL 3.6.2 7 Apr 2026; zlib-ng: 2.3.3; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
        "git exec path": "/home/linuxbrew/.linuxbrew/opt/git/libexec/git-core",
        "git version": "git version 2.54.0",
        "repo detected": "true",
        "repo root": "/data_nvme1n1/jontha01/llvm-project",
        "selected git": "/home/linuxbrew/.linuxbrew/bin/git"
      },
      "remediation": null,
      "durationMs": 17
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/home/jontha01/.local/bin/x86_64/codex",
        "PATH codex #2": "/home/jontha01/.local/bin/x86_64/codex",
        "PATH codex entries": "2",
        "current executable": "/data_nvme1n1/jontha01/.local/bin/x86_64/codex",
        "install context": "other",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed by pnpm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 1
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "4",
        "disabled servers": "0",
        "streamable_http servers": "4"
      },
      "remediation": null,
      "durationMs": 1117
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "proxy API base URL": "https://openai-api-proxy.geo.arm.com/api/<redacted> reachable (HTTP 200)",
        "proxy API route probe": "https://openai-api-proxy.geo.arm.com/api/<redacted> route exists (HTTP 401)",
        "reachability mode": "provider auth"
      },
      "remediation": null,
      "durationMs": 317
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket is not enabled for the active provider",
      "details": {
        "model provider": "proxy",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "supports websockets": "false",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running local build on linux-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/data_nvme1n1/jontha01/.local/bin/x86_64/codex",
        "install method": "other",
        "platform": "linux-x86_64",
        "version": "0.147.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (system)",
      "details": {
        "search command": "rg",
        "search command readiness": "ripgrep 15.2.0 (rev e89fff89ac)",
        "search provider": "system"
      },
      "remediation": null,
      "durationMs": 1
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "/home/jontha01/.codex/tmp/arg0/codex-arg0mv207H/codex-linux-sandbox",
        "execve wrapper helper": "/home/jontha01/.codex/tmp/arg0/codex-arg0mv207H/codex-execve-wrapper",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/home/jontha01/.codex (dir)",
        "active rollout files": "368 files, 252027301 total bytes, 684856 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "/home/jontha01/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/home/jontha01/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/home/jontha01/.codex/log (dir)",
        "memories DB": "/home/jontha01/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "queue DB": "/home/jontha01/.codex/queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "/home/jontha01/.codex (dir)",
        "state DB": "/home/jontha01/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "/home/jontha01/.codex/thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 135
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "proxy",
        "rollout DB active files": "368",
        "rollout DB active rows": "368",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "proxy=368",
        "rollout DB rows": "368",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "cli=200, subagent:review=107, subagent:other=60, exec=1",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 68
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-GB",
      "details": {
        "EDITOR": "set",
        "LANG": "en_GB.UTF-8",
        "LESS": "set",
        "PAGER": "set",
        "VISUAL": "set",
        "os": "Ubuntu 24.4.0 (noble) [64-bit]",
        "os language": "en-GB",
        "os type": "Ubuntu",
        "os version": "24.4.0"
      },
      "remediation": null,
      "durationMs": 12
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "SSH_CLIENT": "present",
        "SSH_CONNECTION": "present",
        "SSH_TTY": "present",
        "TERM": "xterm-sixel",
        "color output": "enabled",
        "effective locale": "en_GB.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "unknown",
        "terminal size": "142x89"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "git repo root",
        "terminal title project value": "llvm-project",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.147.0",
        "check for update on startup": "true",
        "last checked at": "2026-08-07T13:48:40.869263652Z",
        "latest version": "0.147.0",
        "latest version status": "current version is not older",
        "update action": "manual or unknown",
        "version cache": "/home/jontha01/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 48
    }
  }
}

What issue are you seeing?

When running Codex on a remote Linux host over SSH from iTerm2 3.6.11, terminal pets work correctly if I force Kitty graphics with:

TERM=xterm-kitty codex

The pet renders correctly with alpha blending, but the terminal is flooded with repeated Kitty graphics acknowledgements such as:

Gi=0;OKGi=0;OKGi=0;OKGi=0;OK...

Looking at codex-rs/tui/src/pets/image_protocol.rs, the first Kitty image transmission chunk includes q=2, but continuation chunks omit the q parameter:

if index == 0 {
    command.push_str(&format!(
        "{ESC}_Ga=T,t=d,f=100,c={columns},r={rows},q=2{image_id},m={more_flag};{chunk}{ST}",
    ));
} else {
    command.push_str(&format!("{ESC}_Gm={more_flag};{chunk}{ST}"));
}

My understanding is that continuation chunks without q=2 fall back to normal response behaviour, causing iTerm2 to return an OK acknowledgement for each chunk.

What steps can reproduce the bug?

Connect from iTerm2 3.6.11 to a Linux host using SSH.
Run:

  1. TERM=xterm-kitty codex
  2. Enable a terminal pet with /pets.
  3. Observe that the pet renders correctly.
  4. Observe repeated text similar to: Gi=0;OKGi=0;OKGi=0;OKGi=0;OK... being written into the terminal.

What is the expected behavior?

Pet renders correctly without terminal garbage printed.

Additional information

This patch fixes it:

ommit 24de9f4ed (HEAD -> main)
Author: Jonathan Thackray <jthackray@gmail.com>
Date:   2 seconds ago

    fix(tui): keep Kitty pet continuations quiet

    Kitty graphics transmissions are split into 4096-byte chunks. The initial
    chunk sets q=2 to suppress terminal responses, but continuation chunks omitted
    q and therefore fell back to the protocol default. On terminals such as iTerm2
    this can leak repeated Kitty acknowledgements (Gi=0;OK) into the TUI, notably
    when Codex is running over SSH.

    Propagate q=2 to every continuation chunk and add a multi-chunk regression test.

diff --git a/codex-rs/tui/src/pets/image_protocol.rs b/codex-rs/tui/src/pets/image_protocol.rs
index 06b6fc77b..bf49aa575 100644
--- a/codex-rs/tui/src/pets/image_protocol.rs
+++ b/codex-rs/tui/src/pets/image_protocol.rs
@@ -244,7 +244,7 @@ pub fn kitty_transmit_png_with_id(
                 "{ESC}_Ga=T,t=d,f=100,c={columns},r={rows},q=2{image_id},m={more_flag};{chunk}{ST}",
             ));
         } else {
-            command.push_str(&format!("{ESC}_Gm={more_flag};{chunk}{ST}"));
+            command.push_str(&format!("{ESC}_Gm={more_flag},q=2;{chunk}{ST}"));
         }
     }

@@ -342,20 +342,27 @@ mod tests {

     #[test]
     #[serial]
-    fn kitty_png_transmission_encodes_inline_data() {
+    fn kitty_png_transmission_keeps_quiet_mode_on_continuation_chunks() {
         let _guard = EnvVarGuard::new("TMUX", /*value*/ None);
         let dir = tempfile::tempdir().unwrap();
         let path = dir.path().join("frame.png");
-        fs::write(&path, b"png").unwrap();
+
+        // Large enough that the base64 payload spans multiple Kitty chunks.
+        fs::write(&path, vec![0u8; KITTY_CHUNK_SIZE]).unwrap();

         let command = kitty_transmit_png_with_id(
             &path, /*columns*/ 4, /*rows*/ 3, /*image_id*/ None,
         )
         .unwrap();

-        assert!(command.starts_with("\x1b_Ga=T,t=d,f=100,c=4,r=3,q=2,m=0;"));
-        assert!(command.contains("cG5n"));
-        assert!(command.ends_with("\x1b\\"));
+        assert!(command.starts_with(
+            "\x1b_Ga=T,t=d,f=100,c=4,r=3,q=2,m=1;"
+        ));
+
+        assert!(
+            command.contains("\x1b_Gm=0,q=2;"),
+            "continuation chunk must preserve q=2 quiet mode"
+        );
     }

     #[test]

View original on GitHub ↗