Skip to content

fix(tui): refresh task output previews - #2357

Open
ousamabenyounes wants to merge 4 commits into
MoonshotAI:mainfrom
ousamabenyounes:fix/issue-2341
Open

fix(tui): refresh task output previews#2357
ousamabenyounes wants to merge 4 commits into
MoonshotAI:mainfrom
ousamabenyounes:fix/issue-2341

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Jul 29, 2026

Copy link
Copy Markdown

Related Issue

Resolves #2341

Problem

The /tasks Preview Output loaded only when the selection changed. Running process output and background-agent results could therefore remain stale, and an output-loading failure was displayed as if the task had produced no output.

What changed

  • Reload the selected preview from task events, polling, and the R shortcut while keeping one request in flight per selection.
  • Keep selection/request identity guards so late responses cannot overwrite the current task.
  • Show output-loading failures distinctly with an actionable retry hint.
  • Preserve the 4,000-character preview tail and the unbounded full-output viewer.

Test verification (RED → GREEN)

Upstream RED (origin/main with regression tests only):

Test Files  1 failed (1)
Tests  3 failed | 34 passed (37)

The failures showed the error as [no output captured], left the selected preview stale after a task event, and did not retry the preview through R.

Patched GREEN:

Test Files  1 passed (1)
Tests  44 passed (44)

Additional validation:

TUI suite: 125 files passed; 1721 passed | 3 skipped (1724)
Typecheck: passed
Type-aware lint: 0 warnings, 0 errors

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue.
  • I have added tests that prove the feature works.
  • Ran gen-changesets; added a patch changeset for @moonshot-ai/kimi-code.
  • Ran gen-docs; no documentation update is needed because the existing reference only lists /tasks and does not describe preview refresh behavior.

Review feedback verification

The periodic poll now skips output reads for terminal tasks while event-driven final reloads and manual R retries remain enabled. A stale-running-poll regression test failed with 3 output reads before the follow-up fix and passes with exactly 2 afterward.

The follow-up terminal-event race test failed because the final reload was missing, then a strengthened variant failed because a repeated repaint caused a third read that overwrote the final output. Both now pass with exactly one final automatic reload.

The refreshed-status regression test failed with 2 output reads instead of 1 when only listBackgroundTasks observed termination; it now passes and polling stops when either status source is terminal.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ebe87b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d564514c5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/controllers/tasks-browser.ts
@ousamabenyounes

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a6df5b5f4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/controllers/tasks-browser.ts Outdated
@ousamabenyounes

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56e7a725ea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/controllers/tasks-browser.ts Outdated
@ousamabenyounes

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: ebe87b654d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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.

feat(tui): keep /tasks Preview Output fresh and surface load errors

1 participant