Skip to content

Sprites: OpenCode login menu renders one character per line with raw escape codes #3896

Done

Description

@integry

Problem

On a Fly instance (Sprites runtime), the OpenCode login connects and starts the CLI, but its provider menu ("Connect an integration") is unreadable in the dashboard's login terminal:

  • every character appears on its own line;
  • fragments of ANSI escape sequences show as text, e.g. [90m, [39m, [36m, split across lines.

So the provider can't be chosen and the login can't be completed. Seen on 2026-11-29 on propr-dev-3868, epic head with #3865 and #3886, OpenCode CLI 2.4.2: "Connected to Sprite propr-…", then ┌ Connect an integration, then one glyph per line.

On the same instance, the Claude and Codex logins render correctly and complete. Sprites logins already use a 1000-column PTY (spritesLogin.ts, REMOTE_LOGIN_COLUMNS), so terminal width is unlikely to be the cause.

Likely cause (to confirm)

OpenCode's prompt UI (clack-style) redraws with cursor movement and SGR sequences, and Sprites' exec stream seems to deliver it in very small frames, sometimes one character each. Two things may be going wrong in the login output path:

  1. Chunks are rendered as lines. Each output chunk is appended as a new line instead of being concatenated into the terminal stream.
  2. The sanitizer runs per chunk. sanitizeTerminalChunk (or equivalent) sees an escape sequence split across chunks, removes the lone ESC, and leaves [90m as text.

The Docker login path may buffer output differently, which would explain why the problem appears only on Sprites. Check whether Docker OpenCode logins render correctly today.

Expected

The OpenCode login renders the same on Sprites as on Docker. The provider menu is readable, the ↑/↓/Enter terminal keys move and select, and the login completes and saves credentials under .config/opencode.

Suggested shape:

  • Keep a per-session decoder that carries incomplete UTF-8 and incomplete escape sequences over to the next chunk before sanitizing.
  • Render the stream as a terminal (concatenating chunks and honoring CR and cursor moves, or at least collapsing redraws), not one chunk per line.

Acceptance

  • Unit tests: an SGR sequence split across chunks (\x1b | [90m) and a one-character-per-chunk stream render identically to the same output in one chunk. CR-redrawn menu lines collapse.
  • Live on Fly (Sprites): the OpenCode login shows a readable provider menu, a provider can be chosen with the terminal keys, and the agent shows Ready. Re-check the Claude, Codex and Vibe logins for regressions.

Activity

  1. propr-dev commented on Nov 29, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using codex agent with gpt-6.2-sol model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: codex
    • Model: gpt-6.2-sol
    • Branch: 3896/gpt-6.2-sol-sprites-opencode-login-me-20261129-2303-5pw
    • Base Branch: 3758-epic-runtime-abstraction-sc0
    • Worktree: issue-3896-20261129-2303-gpt-6.2-sol-5pw

    🔍 Track Task Execution

  2. added a commit that references this issue on Nov 29, 2026
    75ea64a
  3. added a commit that references this issue on Nov 29, 2026
    3c3555b
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions