Skip to content

fix(worker): surface build failure error in frontend logs (fixes #1984)#1997

Open
octo-patch wants to merge 2 commits intoAndyMik90:developfrom
octo-patch:fix/issue-1984-stream-timeout-silent-error
Open

fix(worker): surface build failure error in frontend logs (fixes #1984)#1997
octo-patch wants to merge 2 commits intoAndyMik90:developfrom
octo-patch:fix/issue-1984-stream-timeout-silent-error

Conversation

@octo-patch
Copy link
Copy Markdown

@octo-patch octo-patch commented Apr 6, 2026

Summary

  • When a pre-QA failure occurs (e.g. stream inactivity timeout from Ollama or a slow provider), postTaskEvent('CODING_FAILED') was called without any preceding postError() call
  • As a result, the error message was never written to the task log — the task silently moved to Human Review with no indication of what went wrong
  • This PR adds a postError() call before CODING_FAILED so the error (e.g. "Stream inactivity timeout — no data received from provider for 60s") appears in the task's Logs tab

Root Cause

In apps/desktop/src/main/ai/agent/worker.ts, the pre-QA failure branch only emitted the XState machine event but skipped the log channel:

} else {
  // Pre-QA failure (planning or coding phase)
  postTaskEvent('CODING_FAILED', { error: outcome.error }); // error never logged
}

Fix

} else {
  // Pre-QA failure (planning or coding phase)
  if (outcome.error) {
    postError(`Build failed: ${outcome.error}`);
  }
  postTaskEvent('CODING_FAILED', { error: outcome.error });
}

Test Plan

  • Trigger a stream timeout (use Ollama with a slow model, wait >60s for the inactivity timeout to fire)
  • Verify the task's Logs tab shows a red error entry with the timeout message
  • Verify the task transitions to Human Review as before

Fixes #1984

Summary by CodeRabbit

  • Bug Fixes
    • Fixed chat area layout and scrolling behavior in the Insights component
    • Improved error messaging when build operations fail

…yMik90#1977)

Without min-h-0 on the flex container, the default flex min-height is
'auto', allowing the child to grow beyond its parent's bounds. This
causes the ScrollArea to also grow unconstrained, making the Insights
panel scroll off the top of the screen after messages load.
When a pre-QA failure occurred (e.g. stream inactivity timeout), only
postTaskEvent('CODING_FAILED') was called with no corresponding postError(),
so the error message never appeared in the task's Logs tab — the task
silently transitioned to Human Review with no explanation.

Add a postError() call before CODING_FAILED so the error is written to
the task log and visible to the user.

Fixes AndyMik90#1984

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b38b1ca1-1352-4554-a0bc-a13a7a11830c

📥 Commits

Reviewing files that changed from the base of the PR and between cba7a02 and cad43d7.

📒 Files selected for processing (2)
  • apps/desktop/src/main/ai/agent/worker.ts
  • apps/desktop/src/renderer/components/Insights.tsx

📝 Walkthrough

Walkthrough

The changes add error reporting to build orchestration when planning or coding failures occur, emitting error messages to the frontend before posting task failure events. Additionally, a layout styling fix improves the flex container behavior in the Insights chat area.

Changes

Cohort / File(s) Summary
Error Reporting Enhancement
apps/desktop/src/main/ai/agent/worker.ts
Added postError() call in the pre-QA failure path to emit worker error messages when build failures occur, ensuring errors are communicated before posting the CODING_FAILED task event.
Layout Styling Fix
apps/desktop/src/renderer/components/Insights.tsx
Added min-h-0 CSS class to the main chat area flex container to enable proper flex column shrinking within available height constraints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A worker now speaks when builds go astray,
No more silent failures to ruin the day!
With messages flowing and layouts just right,
The chat area stretches—oh what a delight!
Errors now surface, no more hide-and-seek,
Our Ollama tasks stronger, our feedback more sleek! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes an unrelated layout fix (min-h-0 in Insights.tsx for issue #1977) that is out of scope for the #1984 timeout error objective. Move the Insights.tsx layout change to a separate PR focused on #1977, or clarify why it's included in this PR's scope.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: adding error logging for build failures in the worker module, which directly addresses the main objective of the PR.
Linked Issues check ✅ Passed The PR implements the primary coding requirement from #1984: adding postError() to log build failure messages before emitting CODING_FAILED, ensuring errors appear in frontend logs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves error reporting in the build orchestrator by explicitly posting error messages when a pre-QA failure occurs. Additionally, it applies a CSS layout fix to the Insights component by adding "min-h-0" to the main chat area to prevent potential flexbox overflow issues. I have no feedback to provide.

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.

Timeout Silent Error

2 participants