xonecas.io
62159
Sy

symb / commit a406550

fix: message ordering;

xonecas2026-02-11 a4065502ea179e6c45ffb7aff2336d36b9083490 parent 2b860f7

2 files changed

docs/DESIGN.md+2−0
@@ -155,3 +155,5 @@ Confidence Level: High for a prototype. The ecosystem is ready.
155155 # TODO:
156156
157157 - Conversation log ordering is all broken.
158+- `stub.go` is bleeding into prod runs, the llm sees those tools.
159+- Credentials tools need to be deleted
internal/tui/tui.go+18−9
@@ -217,7 +217,13 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
217217 Content: msg.content,
218218 CreatedAt: now,
219219 })
220- // Add timestamp separator first (will appear below in reversed display)
220+ // Format and display user message first
221+ grayStyle := lipgloss.NewStyle().Foreground(ColorGray)
222+ for _, line := range strings.Split(msg.content, "\n") {
223+ m.conversation = append(m.conversation, grayStyle.Render(line))
224+ }
225+ m.conversation = append(m.conversation, "")
226+ // Add timestamp separator after message
221227 timestamp := now.Format("15:04")
222228 rightPaneWidth := m.width/2 - 1
223229 dashCount := rightPaneWidth - len("0s "+timestamp+" ")
@@ -229,12 +235,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
229235 )
230236 m.conversation = append(m.conversation, separator)
231237 m.conversation = append(m.conversation, "")
232- // Format and display user message
233- grayStyle := lipgloss.NewStyle().Foreground(ColorGray)
234- for _, line := range strings.Split(msg.content, "\n") {
235- m.conversation = append(m.conversation, grayStyle.Render(line))
236- }
237- m.conversation = append(m.conversation, "")
238238 // Start LLM processing and wait for updates
239239 return m, tea.Batch(m.processLLM(), m.waitForLLMUpdate())
240240
@@ -365,8 +365,17 @@ func (m Model) View() string {
365365 inputStartRow := contentHeight - 3 // 3 rows for input
366366 if i < separatorRow {
367367 // Conversation area - show conversation log
368- if i < len(m.conversation) {
369- line := m.conversation[len(m.conversation)-1-i] // Show newest at bottom
368+ // Calculate which line to show (scroll to show newest at bottom)
369+ totalLines := len(m.conversation)
370+ visibleLines := separatorRow
371+ startLine := 0
372+ if totalLines > visibleLines {
373+ startLine = totalLines - visibleLines
374+ }
375+ lineIdx := startLine + i
376+
377+ if lineIdx < totalLines {
378+ line := m.conversation[lineIdx]
370379 lineWidth := lipgloss.Width(line)
371380 if lineWidth > rightPaneWidth {
372381 line = line[:rightPaneWidth]