Skip to content

fix(thread-status): 🐛 Prevent runState deadlock when loadSnapshot IPC fails#175

Merged
jorben merged 2 commits into
masterfrom
fix/startup-snapshot-errors
May 9, 2026
Merged

fix(thread-status): 🐛 Prevent runState deadlock when loadSnapshot IPC fails#175
jorben merged 2 commits into
masterfrom
fix/startup-snapshot-errors

Conversation

@jorben
Copy link
Copy Markdown
Contributor

@jorben jorben commented May 9, 2026

Summary

  • Reset runMachine to "failed" in loadSnapshot catch block so the optimistic "running" state does not permanently block the pending run effect when the snapshot IPC call fails
  • Downgrade SMAppService errors in settings_set to warn-and-continue so login item failures cannot break the IPC command response

Test Plan

  • npm run typecheck passes
  • cargo fmt --check passes
  • Manually verify: kill backend mid-loadSnapshot → thread recovers instead of stuck spinner
  • Manually verify: toggle launch-at-login on unsigned dev build → no IPC error propagation

🤖 Generated with TiyCode

… fails

- Reset runMachine to "failed" in loadSnapshot catch block so the
  optimistic "running" state does not permanently block pending run effect
- Downgrade SMAppService errors in settings_set to warn-and-continue so
  login item failures cannot break the IPC command response
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

AI Code Review Summary

PR: #175 (fix(thread-status): 🐛 Prevent runState deadlock when loadSnapshot IPC fails)
Preferred language: English

Overall Assessment

No blocking issue was detected in the reviewed diff; keep focused regression testing before merge.

Major Findings by Severity

No major issues identified from the reviewed diff.

Actionable Suggestions

  • Review error propagation decision with product/UX to determine if silent failure for macOS launch-at-login is acceptable or needs user-facing warning.
  • Ensure Figma / design spec matches the new blue card styling for chart artifacts.

Potential Risks

  • User toggles 'Launch at Login' but the OS rejects it silently, leading to confusion.
  • Charts may now have a hardcoded blue theme that could clash with custom themes or future redesign.

Test Suggestions

  • Write an integration test that mocks startup_manager::set_launch_at_login failure and verify the IPC response or frontend toast.
  • Add a unit test for the runtime thread surface snapshot error path to assert run machine is reset.
  • Check artifact card UI with various states (loading, error, collapsed, expanded) in Playwright/Storybook.
  • Cover failure path in settings_set for launch-at-login.
  • Cover snapshot load error in runtime-thread-surface.
  • Cover artifact card toggle and preview interactions.

File-Level Coverage Notes

  • src-tauri/src/commands/settings.rs: Missing test for non-fatal error handling of launch_at_login.
  • src/i18n/locales/en.ts: No testing concerns — translations are static.
  • src/i18n/locales/zh-CN.ts: No testing concerns — translations are static.
  • src/modules/workbench-shell/ui/runtime-thread-surface.tsx: New run machine reset logic lacks test coverage for snapshot load error.
  • src/modules/workbench-shell/ui/thread-chart-artifact-card.tsx: New expand/collapse and preview interactions are untested.

Inline Downgraded Items (processed but not inline)

  • None

Coverage Status

  • Target files: 5
  • Covered files: 5
  • Uncovered files: 0
  • No-patch/binary covered as file-level: 0
  • Findings with unknown confidence (N/A): 0

Uncovered list:

  • None

No-patch covered list:

  • None

Runtime/Budget

  • Rounds used: 1/4
  • Planned batches: 1
  • Executed batches: 1
  • Sub-agent runs: 2
  • Planner calls: 1
  • Reviewer calls: 2
  • Model calls: 3/64
  • Structured-output summary-only degradation: NO

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated PR review completed.

  • Findings kept: 2
  • Findings with unknown confidence: 0
  • Inline comments attempted: 2
  • Target files: 2
  • Covered files: 2
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

// block the pending run effect when the snapshot IPC fails.
// Use "failed" rather than "idle" because Guard 2 in threadStore rejects
// idle/null writes when an optimistic running state with a real runId exists.
if (threadId) runMachine.reset("failed", { runId: null, errorMessage: message, retryCount: 0 });

This comment was marked as outdated.

#[cfg(target_os = "macos")]
{
startup_manager::set_launch_at_login(enabled)?;
if let Err(error) = startup_manager::set_launch_at_login(enabled) {

This comment was marked as outdated.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated PR review completed.

  • Findings kept: 0
  • Findings with unknown confidence: 0
  • Inline comments attempted: 1
  • Target files: 5
  • Covered files: 5
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

@@ -67,7 +67,9 @@ pub async fn settings_set(
Ok(enabled) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review completed for this PR diff. No concrete inline issue was selected after aggregation.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated PR review completed.

  • Findings kept: 0
  • Findings with unknown confidence: 0
  • Inline comments attempted: 1
  • Target files: 5
  • Covered files: 5
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

@@ -67,7 +67,9 @@ pub async fn settings_set(
Ok(enabled) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review completed for this PR diff. No concrete inline issue was selected after aggregation.

@jorben jorben merged commit 5a70362 into master May 9, 2026
5 checks passed
@jorben jorben deleted the fix/startup-snapshot-errors branch May 9, 2026 23:39
@jorben jorben restored the fix/startup-snapshot-errors branch May 9, 2026 23:41
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