Skip to content

feat: tui beautify & async lauch codebase#39

Merged
iohub merged 5 commits into
mainfrom
feat-openai-go
May 6, 2026
Merged

feat: tui beautify & async lauch codebase#39
iohub merged 5 commits into
mainfrom
feat-openai-go

Conversation

@iohub
Copy link
Copy Markdown
Owner

@iohub iohub commented May 6, 2026

Summary by Sourcery

Add a task completion overlay dialog to the TUI and make the codebase server startup and health checks more user-visible and asynchronous.

New Features:

  • Display a task completion overlay dialog in the TUI for both successful and failed tasks with keyboard dismissal.

Enhancements:

  • Run codebase server health checks asynchronously to avoid blocking TUI/HTTP startup and extend the health check timeout.
  • Increase default log verbosity to include warnings and print a stderr warning when the codebase server fails to start.
  • Treat missing codebase binary as an error-level log and expand the list of tools whose bodies are omitted in TUI rendering.
  • Trim TUI- and developer-experience marketing sections from the English and Chinese READMEs to keep documentation focused.

iohub added 5 commits May 6, 2026 07:14
Add list_dir to skipBodyTools so that its output body is not rendered
in the TUI. Only the header (icon + name + directory path) will be
shown, avoiding visual clutter from large directory listings.
Add search_by_regex to skipBodyTools to avoid rendering large result sets
in the TUI. Only the header (icon + name + search query) will be shown.
- Lower log level from ERROR to WARN for better visibility of warnings
- Make codebase health check asynchronous to avoid blocking TUI/HTTP startup
- Increase health check timeout from 30s to 60s
- Add warning message when codebase server fails to start
- Upgrade codebase binary missing from WARN to ERROR level
- Add taskCompleteDialog overlay shown on task completion/failure
- Success dialog displays "Task Completed" with OK button only
- Failure dialog displays error message with OK button
- Support Enter, Space, or Esc to dismiss the dialog
- Use teal color theme to differentiate from auth confirmation dialog
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 6, 2026

Reviewer's Guide

Adds a task-completion overlay dialog to the TUI, relaxes codebase server startup to use async health checks with clearer warnings, trims README feature marketing, and refines which tool results are body-less in TUI rendering.

Sequence diagram for asynchronous codebase server startup and health check

sequenceDiagram
    participant Main
    participant startCodebaseServer
    participant FileSystem
    participant CodebaseProcess
    participant waitForCodebase

    Main->>startCodebaseServer: startCodebaseServer(port, repoPath)
    startCodebaseServer->>FileSystem: osStat(binPath)
    alt binary_not_found
        FileSystem-->>startCodebaseServer: osIsNotExist
        startCodebaseServer->>Main: return nil
    else binary_found
        FileSystem-->>startCodebaseServer: ok
        startCodebaseServer->>CodebaseProcess: execCommand(binPath, port, repoPath)
        CodebaseProcess-->>startCodebaseServer: running_cmd
        startCodebaseServer-->>Main: return cmd
        startCodebaseServer->>waitForCodebase: go waitForCodebase(address, 60s)
        note over waitForCodebase: Runs asynchronously
        waitForCodebase-->>waitForCodebase: poll_health_until_timeout
        alt health_check_fails
            waitForCodebase->>CodebaseProcess: cmdProcessKill()
        else health_check_succeeds
            waitForCodebase-->>CodebaseProcess: no_action
        end
    end
Loading

Class diagram for updated TUI model and task completion dialog

classDiagram
    class model {
        bool showHistoryPanel
        bool historyConfirmDelete
        bool quitting
        confirmDialog confirmDialog
        taskCompleteDialog taskCompleteDialog
        messagingMessagePublisher* publisher
        chanMessagingMessagePublisher publisherCh
        Update(msgTeaMsg) teaModel
        View() string
        renderConfirmDialog() string
        renderTaskCompleteDialog() string
    }

    class confirmDialog {
        bool open
        int selectedOption
        string question
    }

    class taskCompleteDialog {
        bool open
        string message
    }

    class lipglossStylesTaskComplete {
        style taskCompleteBorderStyle
        style taskCompleteTitleStyle
        style taskCompleteMessageStyle
        style taskCompleteButtonFocused
        style taskCompleteButtonBlurred
    }

    model --> confirmDialog : uses
    model --> taskCompleteDialog : uses
    model --> lipglossStylesTaskComplete : styled_by
Loading

File-Level Changes

Change Details Files
Introduce a task completion overlay dialog in the TUI that displays success or failure and intercepts input until dismissed.
  • Add taskCompleteDialog state to the TUI model to track dialog visibility and message text
  • Handle keyboard input for the task completion dialog, including closing with ENTER/SPACE/ESC and quitting with Ctrl+C
  • Open the dialog on tool task completion, differentiating between success and failure messages
  • Render the task completion dialog as a centered overlay with lipgloss styling, title, OK button, and help text when active
tui.go
Make codebase server startup more user-visible and non-blocking by adjusting logging, health checks, and warnings.
  • Increase global log level from error-only to include warnings so startup issues are visible
  • Print a stderr warning when the codebase server fails to start so users understand feature impact
  • Treat missing codebase binary as an error-level log entry instead of warning
  • Run codebase health check in a background goroutine, increasing timeout and killing the process only if it never becomes healthy
main.go
Streamline README feature lists by removing detailed TUI and developer-experience marketing bullets.
  • Remove the Intelligent TUI and Developer Experience sections plus structured LLM logging bullets from the English README
  • Remove the corresponding智能 TUI and开发者体验 sections plus structured LLM logging bullets from the Chinese README
README.md
README_zh.md
Adjust which tools are rendered without detailed bodies in the TUI tool result renderer.
  • Extend skipBodyTools to include list_dir and search_by_regex so only headers are shown for these tools
internal/tui/render.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@iohub iohub merged commit e0e47f7 into main May 6, 2026
1 check passed
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The new taskCompleteDialog struct and styles define a message field and taskCompleteMessageStyle, but renderTaskCompleteDialog never uses them, so the dialog content is always static; consider rendering the dialog’s message and applying the corresponding style so success/failure details are actually shown.
  • The task completion dialog is always titled "Task Completed" and the help text omits esc even though it’s handled in Update, which is confusing when displaying failure messages ("❌ Task Failed..."); consider deriving the title/help text from the dialog state or message so success and error cases are clearly distinguished and key hints match actual behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `taskCompleteDialog` struct and styles define a `message` field and `taskCompleteMessageStyle`, but `renderTaskCompleteDialog` never uses them, so the dialog content is always static; consider rendering the dialog’s `message` and applying the corresponding style so success/failure details are actually shown.
- The task completion dialog is always titled "Task Completed" and the help text omits `esc` even though it’s handled in `Update`, which is confusing when displaying failure messages ("❌ Task Failed..."); consider deriving the title/help text from the dialog state or message so success and error cases are clearly distinguished and key hints match actual behavior.

## Individual Comments

### Comment 1
<location path="tui.go" line_range="119-121" />
<code_context>
 }

+// taskCompleteDialog holds the state of the task completion overlay dialog.
+type taskCompleteDialog struct {
+	open    bool
+	message string
+}
+
</code_context>
<issue_to_address>
**suggestion (bug_risk):** The `message` field on `taskCompleteDialog` is never used in rendering.

You set `taskCompleteDialog.message` with success/failure text, but `renderTaskCompleteDialog` hardcodes the title and never uses this field, so neither the error (`msg.err.Error()`) nor the success/failure copy is shown. Please render `m.taskCompleteDialog.message` in the dialog body, and optionally vary the title/styling based on success vs failure if that’s part of the message design.

Suggested implementation:

```golang
func (m model) renderTaskCompleteDialog() string {
	return dialog.New().
		Title("Task complete").
		Body(m.taskCompleteDialog.message).
		WithKeyMap(m.keyMap).
		WithFocused(true).
		String()
}

```

I only see the `taskCompleteDialog` struct, not the actual `renderTaskCompleteDialog` implementation, so you will need to align the `SEARCH` block with the real code. Specifically:

1. Locate `renderTaskCompleteDialog` in `tui.go`.
2. Replace the hardcoded body string (whatever literal is currently passed to `.Body(...)`) with `m.taskCompleteDialog.message` as shown.
3. If you also want to vary the title or styling by success/failure, you can:
   - Either derive that from the contents of `m.taskCompleteDialog.message`, or
   - Extend `taskCompleteDialog` with additional fields (e.g., `title string`, `isError bool`) and then conditionally set `.Title(...)` and any error styling based on those fields. If you add fields, update all `taskCompleteDialog{...}` composite literals to use named fields to avoid breakage.
</issue_to_address>

### Comment 2
<location path="tui.go" line_range="486-492" />
<code_context>
 			return m, nil
 		}

+		// Task complete dialog key handling
+		if m.taskCompleteDialog.open {
+			switch msg.String() {
+			case "enter", " ", "esc":
+				m.taskCompleteDialog.open = false
+				return m, nil
+			case "ctrl+c":
+				m.quitting = true
+				return m, tea.Quit
</code_context>
<issue_to_address>
**nitpick:** Key handling for the dialog doesn’t match the help text shown to the user.

The dialog currently accepts Enter, Space, Esc, and Ctrl+C, but `renderTaskCompleteDialog` only documents Enter and Space. Please either update the help text to include Esc/Ctrl+C or restrict the key handler to only the documented shortcuts to avoid surprising users.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tui.go
Comment on lines +119 to +121
type taskCompleteDialog struct {
open bool
message string
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): The message field on taskCompleteDialog is never used in rendering.

You set taskCompleteDialog.message with success/failure text, but renderTaskCompleteDialog hardcodes the title and never uses this field, so neither the error (msg.err.Error()) nor the success/failure copy is shown. Please render m.taskCompleteDialog.message in the dialog body, and optionally vary the title/styling based on success vs failure if that’s part of the message design.

Suggested implementation:

func (m model) renderTaskCompleteDialog() string {
	return dialog.New().
		Title("Task complete").
		Body(m.taskCompleteDialog.message).
		WithKeyMap(m.keyMap).
		WithFocused(true).
		String()
}

I only see the taskCompleteDialog struct, not the actual renderTaskCompleteDialog implementation, so you will need to align the SEARCH block with the real code. Specifically:

  1. Locate renderTaskCompleteDialog in tui.go.
  2. Replace the hardcoded body string (whatever literal is currently passed to .Body(...)) with m.taskCompleteDialog.message as shown.
  3. If you also want to vary the title or styling by success/failure, you can:
    • Either derive that from the contents of m.taskCompleteDialog.message, or
    • Extend taskCompleteDialog with additional fields (e.g., title string, isError bool) and then conditionally set .Title(...) and any error styling based on those fields. If you add fields, update all taskCompleteDialog{...} composite literals to use named fields to avoid breakage.

Comment thread tui.go
Comment on lines +486 to +492
// Task complete dialog key handling
if m.taskCompleteDialog.open {
switch msg.String() {
case "enter", " ", "esc":
m.taskCompleteDialog.open = false
return m, nil
case "ctrl+c":
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Key handling for the dialog doesn’t match the help text shown to the user.

The dialog currently accepts Enter, Space, Esc, and Ctrl+C, but renderTaskCompleteDialog only documents Enter and Space. Please either update the help text to include Esc/Ctrl+C or restrict the key handler to only the documented shortcuts to avoid surprising users.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant