Skip to content

fix(app): keep session status timeout off the project reload toast - #1560

Merged
Astro-Han merged 1 commit into
devfrom
fix/1550-session-status-timeout-toast
Aug 17, 2026
Merged

fix(app): keep session status timeout off the project reload toast#1560
Astro-Han merged 1 commit into
devfrom
fix/1550-session-status-timeout-toast

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

In bootstrapDirectory, a timed-out session.status snapshot no longer rethrows into the slow-bootstrap error path. The timeout is already recorded as an incident.session_status_hydration_timeout diagnostic and degrades session_status_state to error; after that it is now swallowed (best-effort, matching the external-result hydrate pattern in the same file) instead of escalating into slowErrs. Real fetch failures still throw and surface the toast.

The extended bootstrap test also pins that the bootstrap pass finishes (status reaches complete) despite the timeout - previously the project stayed unfinished on slow machines.

Why

Fixes #1550. The session.status fetch is wrapped in a 5-second timeout (SESSION_STATUS_TIMEOUT_MS). On machines where the full status snapshot takes longer, the timeout error landed in slowErrs and fired the project-level "Failed to reload {project}" toast on every bootstrap pass - once at app launch and again after every assistant turn (or interrupt), exactly the spam reported on Windows 11 in v2026.8.1. The data itself recovers on the next SSE status event or bootstrap pass, so the toast was neither actionable nor accurate.

Supersedes #1556 (closed): that PR only raised the bun test per-test timeout, which does not affect the shipped app.

Related Issue

Fixes #1550

Human Review Status

Approved by @Astro-Han

Review Focus

  • The swallow happens only for SessionStatusHydrationTimeoutError (timedOut flag); every other status fetch failure still escalates to the reload toast.
  • The bootstrap-complete path: with the timeout swallowed, slowErrs stays empty and status reaches complete while session_status_state remains error until SSE recovery - confirm that combination is the intended degraded state.

Risk Notes

  • On a genuinely stuck status endpoint the user now sees no toast; observability is preserved via the existing diagnostic event and session_status_state: error. I judge that the right trade: the toast was not actionable and the state self-heals.
  • No E2E was added: forcing a real >5s status hang through the packaged app would need route interception against the sidecar server and would be flaky at the 5s boundary. The unit test drives the public bootstrapDirectory seam with the real showToast host spied, which is where the spam originated.
  • No visible UI or copy changed (an erroneous toast is removed from a timeout path), so no screenshot applies.
  • Docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, and local-file contracts are unchanged.

How To Verify

RED check: extended test failed before the fix (store.status never reached complete, toast fired)
Focused tests: bootstrap.test.ts 25 passed, 0 failed
App unit suite: 2016 passed, 0 failed
Typecheck: 9 tasks successful (repo-wide turbo typecheck)

Screenshots or Recordings

Not applicable: no visible UI or copy change; the change removes a spurious error toast from a timeout path.

Checklist

How to use this checklist:

  • Tick a box by replacing [ ] with [x]. Do not edit, add, or remove items.
  • The bot-applied label items can only be honestly ticked AFTER the PR is opened and the labeler / priority-triage bots have run - return to the PR description and tick them then.
  • Most items are required. The few that are conditional are explicitly marked (conditional); for those, leave unticked if they truly do not apply and explain why in Risk Notes. All other items must be ticked before requesting human review.
  • Type label - this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels - this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label - this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

A timed-out session status snapshot rethrew into the slow-bootstrap error
path, firing the project-level reloadFailed toast on every bootstrap pass
(app launch and after each assistant turn) on machines where the snapshot
takes longer than the 5s timeout (#1550). The timeout already records a
diagnostic event, degrades session_status_state to error, and recovers on
the next SSE status event or bootstrap pass, so it is now best-effort like
the external-result hydrate: swallowed after recording instead of
escalated. Real fetch failures still surface the toast.
@Astro-Han Astro-Han added the bug Something isn't working label Aug 17, 2026
@github-actions github-actions Bot added app Application behavior and product flows P2 Medium priority labels Aug 17, 2026

@github-actions github-actions 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.

Suggested priority: P2 (includes user-path files (packages/app/src/context/global-sync/bootstrap.test.ts, packages/app/src/context/global-sync/bootstrap.ts)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 701763a6-d9d3-4b87-99cd-694e95868df0

📥 Commits

Reviewing files that changed from the base of the PR and between ddfa039 and 5261f06.

📒 Files selected for processing (2)
  • packages/app/src/context/global-sync/bootstrap.test.ts
  • packages/app/src/context/global-sync/bootstrap.ts

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Session-status hydration timeouts now remain best-effort during bootstrap. The code records diagnostics and hydration errors without propagating timeout failures or showing project reload-failure toasts. Tests verify bootstrap completion and no toast emission.

Changes

Session hydration timeout handling

Layer / File(s) Summary
Best-effort timeout handling
packages/app/src/context/global-sync/bootstrap.ts
Timeout errors are recorded and marked as hydration errors without propagation to the bootstrap error list. Other errors continue to propagate.
Timeout toast regression test
packages/app/src/context/global-sync/bootstrap.test.ts
The test spies on showToast and verifies that a hydration timeout completes bootstrap without emitting a toast.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 5261f

The change prevents session-status timeouts from triggering an incorrect project reload toast while preserving error state and recovery behavior; it is merge-ready after normal checks and review, with no actionable merge-blocking risk remaining.

Possibly related PRs

  • Astro-Han/pawwork#1556: Also changes session-status hydration timeout handling to prevent project reload-failure toasts.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #1550 by suppressing timeout-triggered reload toasts while preserving diagnostics and allowing bootstrap completion.
Out of Scope Changes check ✅ Passed The changes are limited to bootstrap timeout handling and its focused test, with no unrelated refactors or dependencies.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing session status timeouts from triggering the project reload toast.
Description check ✅ Passed The description includes all required sections, explains the change and risks, links the issue, and reports focused verification results.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1550-session-status-timeout-toast

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.

@Astro-Han
Astro-Han merged commit 207eb99 into dev Aug 17, 2026
46 of 49 checks passed
@Astro-Han
Astro-Han deleted the fix/1550-session-status-timeout-toast branch August 17, 2026 07:24
Astro-Han added a commit that referenced this pull request Aug 17, 2026
Prepare the urgent PawWork 2026.8.3 stable release from the current dev baseline after #1560, #1563, and the P0 message-order rollover fix #1562.

Change boundary:
- bump the desktop package version from 2026.8.2 to 2026.8.3
- update only the matching Bun lockfile workspace entry

Verification:
- version contract failed on 2026.8.2 and passed on 2026.8.3
- release metadata and workflow contracts: 21 passed, 0 failed
- release TypeScript check passed
- frozen install passed in the dedicated release worktree without additional lockfile changes
- all required PR checks passed, including macOS smoke, E2E, CodeQL, dependency review, and the full Windows matrix

Review follow-ups:
- no unresolved review threads
- no separate issue; this is version-only release preparation for already-merged fixes

Residual risk:
- all macOS and Windows release targets must build this squash commit so the single-source publisher can pin one verified commit
- the optional dev-dep-audit still reports the default branch's existing advisories; this PR changes no dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows bug Something isn't working P2 Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Toast message Spam: Session status hydration timeout after 5000ms

1 participant