Skip to content

Bug: Pressing Cmd+C to copy selected text resets the scroll position to the bottom on macOS #34914

Description

@zyunlongz

What version of Codex CLI is running?

codex-cli 0.145.0

What subscription do you have?

Plus

Which model were you using?

gpt-5.6-sol

What platform is your computer?

macOS

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

iTerm2, Ghostty

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1784799741s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.145.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/Users/ninebot/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/Users/ninebot/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/Users/ninebot/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/Users/ninebot/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/Users/ninebot/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/Users/ninebot/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/Users/ninebot/.codex",
        "config.toml": "/Users/ninebot/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/Users/ninebot/willand_projects/SegwayMowerbot",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, memories, hooks, enable_request_compression, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, 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": "memories=true",
        "feature flags enabled": "37",
        "log dir": "/Users/ninebot/.codex/log",
        "mcp servers": "3",
        "model": "gpt-5.6-sol",
        "model provider": "openai",
        "sqlite home": "/Users/ninebot/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.50.1 (Apple Git-155)",
      "details": {
        ".git entry": "directory",
        "PATH git #1": "/usr/bin/git",
        "PATH git entries": "1",
        "git branch": "zyl/4.2/DR-174_add_maintenance_point",
        "git build options": "git version 2.50.1 (Apple Git-155); cpu: arm64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; feature: fsmonitor--daemon; libcurl: 8.7.1; zlib: 1.2.12; SHA-1: SHA1_DC; SHA-256: SHA256_BLK",
        "git exec path": "/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core",
        "git version": "git version 2.50.1 (Apple Git-155)",
        "repo detected": "true",
        "repo root": "/Users/ninebot/willand_projects/SegwayMowerbot",
        "selected git": "/usr/bin/git"
      },
      "remediation": null,
      "durationMs": 22
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/Users/ninebot/.nvm/versions/node/v24.13.0/bin/codex",
        "current executable": "/Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin/codex",
        "install context": "npm (package /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin, bin /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin, resources /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-resources, path /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path)",
        "managed by bun": "false",
        "managed by npm": "true",
        "managed by pnpm": "false",
        "managed package root": "/Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex",
        "npm update target": "/Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex"
      },
      "remediation": null,
      "durationMs": 134
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "3",
        "disabled servers": "1",
        "stdio servers": "2",
        "streamable_http servers": "1"
      },
      "remediation": null,
      "durationMs": 557
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars present": "http_proxy, https_proxy, all_proxy"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 370
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "1 IPv4, 0 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars present": "http_proxy, https_proxy, all_proxy",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 2073
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running npm on macos-aarch64",
      "details": {
        "commit": "unknown",
        "current executable": "/Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin/codex",
        "install method": "npm (package /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin, bin /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin, resources /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-resources, path /Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path)",
        "platform": "macos-aarch64",
        "version": "0.145.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "execve wrapper helper": "/Users/ninebot/.codex/tmp/arg0/codex-arg0LKpTJ3/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": "/Users/ninebot/.codex (dir)",
        "active rollout files": "468 files, 931448288 total bytes, 1990274 average bytes",
        "archived rollout files": "1 files, 48590 total bytes, 48590 average bytes",
        "goals DB": "/Users/ninebot/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/Users/ninebot/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/Users/ninebot/.codex/log (dir)",
        "memories DB": "/Users/ninebot/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "sqlite home": "/Users/ninebot/.codex (dir)",
        "state DB": "/Users/ninebot/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "/Users/ninebot/.codex/thread_history_1.sqlite (missing)",
        "thread history DB integrity": "skipped (missing)"
      },
      "remediation": null,
      "durationMs": 2026
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "warning",
      "summary": "rollout files and state DB thread inventory differ",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "468",
        "rollout DB active rows": "446",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "1",
        "rollout DB archived rows": "1",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "22",
        "rollout DB missing active sample": [
          "/Users/ninebot/.codex/sessions/2026/04/15/rollout-2026-04-15T21-47-46-019d9165-e073-74d0-a0ea-09026530dd75.jsonl",
          "/Users/ninebot/.codex/sessions/2026/04/17/rollout-2026-04-17T14-12-12-019d9a11-8523-7823-bd1a-1006417e6a57.jsonl",
          "/Users/ninebot/.codex/sessions/2026/04/17/rollout-2026-04-17T20-00-32-019d9b50-6b79-7122-9106-b0e0191ae2d2.jsonl",
          "/Users/ninebot/.codex/sessions/2026/04/17/rollout-2026-04-17T14-12-25-019d9a11-b5ec-7cd0-b4f2-3506ce1c2e7c.jsonl",
          "/Users/ninebot/.codex/sessions/2026/04/17/rollout-2026-04-17T20-00-28-019d9b50-5c3e-73c0-b81e-7370f49dc05e.jsonl"
        ],
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=447",
        "rollout DB rows": "447",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "vscode=237, cli=136, subagent:other=34, subagent:thread_spawn=17, subagent:review=12, exec=11",
        "rollout DB stale rows": "0"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "rollout files are missing from the state DB",
          "measured": "22 active, 0 archived",
          "expected": "every rollout file has a matching threads row",
          "remedy": null,
          "fields": []
        }
      ],
      "remediation": null,
      "durationMs": 469
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language zh-Hans-CN",
      "details": {
        "EDITOR": "not set",
        "LANG": "en_US.UTF-8",
        "LESS": "set",
        "PAGER": "set",
        "VISUAL": "not set",
        "os": "Mac OS 26.5.2 [64-bit]",
        "os language": "zh-Hans-CN",
        "os type": "Mac OS",
        "os version": "26.5.2"
      },
      "remediation": null,
      "durationMs": 3
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "TERMINFO": "/Applications/Ghostty.app/Contents/Resources/terminfo (dir)",
        "TERM_PROGRAM": "ghostty",
        "color output": "enabled",
        "effective locale": "en_US.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "Ghostty",
        "terminal size": "159x50",
        "terminal version": "1.3.1"
      },
      "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": "SegwayMowerbot",
        "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.145.0",
        "check for update on startup": "true",
        "dismissed version": "0.120.0",
        "last checked at": "2026-07-23T02:21:36.548512Z",
        "latest version": "0.145.0",
        "latest version status": "current version is not older",
        "npm update target": "/Users/ninebot/.nvm/versions/node/v24.13.0/lib/node_modules/@openai/codex",
        "update action": "npm install -g @openai/codex",
        "version cache": "/Users/ninebot/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 779
    }
  }
}

What issue are you seeing?

When viewing previous output in Codex CLI, selecting text and pressing Cmd+C to copy causes the terminal view to immediately jump back to the bottom of the session.

This makes it difficult to inspect or copy older output because the current scroll position is lost every time the keyboard shortcut is used.

What steps can reproduce the bug?

  1. Start Codex CLI.
  2. Generate enough output so that scrolling is possible.
  3. Scroll up to previous output.
  4. Select any text.
  5. Press Cmd+C to copy the selected text.

What is the expected behavior?

The selected text is copied to the clipboard while preserving the current scroll position.

Additional information

  • Reproduces in Ghostty 1.3.1.
  • Reproduces in iTerm2.
  • Using Edit → Copy from the macOS menu does not trigger the issue.
  • The issue only occurs when using the Cmd+C keyboard shortcut.
  • The same workflow in Claude Code does not exhibit this behavior in either Ghostty or iTerm2.
  • Running Codex with --no-alt-screen does not resolve the issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions