← Back to Pull requests

fix(tui): refresh task output previews #2357

Closed
unknown closed this pull request without merging on Aug 01, 2026 02:24 UTC
View on GitHub
unknown unknown commented on Jul 29, 2026 08:45 UTC
Author

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.

    Diff: 295 lines (+221 / -74) across 3 files Reviewer: ousamabenyounes Review duration: 3938m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 295 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.340
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2357"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.0% (MEDIUM) · Higher = larger blast radius
    40.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.8% · Safe to merge
    15.8%