altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

fix: engine 'ready' message leaks into TUI prompt input area

Open anandgupta42 opened this issue 8 months ago • 0 comments

What does this PR do?

The engine bootstrap writes Engine ready and altimate-engine 0.4.0... messages via UI.println() which bleeds into the TUI prompt input area, appearing as garbled text like readyltimate-engine 0.4.0... in the input box.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

Issue for this PR

N/A — discovered during tracing feature development.

Steps to Reproduce

  1. Launch the TUI: altimate-code
  2. Send a prompt that triggers the Python engine (e.g., any SQL or schema tool)
  3. Observe the prompt input area — readyltimate-engine 0.4.0... appears as garbled text

Root Cause

src/altimate/bridge/engine.ts:227 calls UI.println() during engine initialization. In TUI mode, UI.println writes to the terminal which the TUI framework picks up as input text.

// engine.ts:227
UI.println(`${UI.Style.TEXT_SUCCESS}Engine ready${UI.Style.TEXT_NORMAL}`)

Suggested Fix

Guard the message with a check for TUI mode, or use Log.Default.info() instead of UI.println():

// Option 1: Use logging instead of direct print
Log.Default.info("engine ready", { version: ALTIMATE_ENGINE_VERSION })

// Option 2: Only print in non-TUI mode
if (!process.env.OPENCODE_TUI) {
  UI.println(`${UI.Style.TEXT_SUCCESS}Engine ready${UI.Style.TEXT_NORMAL}`)
}

Screenshot

The prompt input shows readyltimate-engine 0.4.0... mixed with the cursor.

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own changes

anandgupta42 avatar Mar 16 '26 15:03 anandgupta42