Skip to content

Recover auth windows after web process crashes - #57

Merged
hongnoul merged 2 commits into
mainfrom
fix/issue-51-auth-recovery
Aug 5, 2026
Merged

Recover auth windows after web process crashes#57
hongnoul merged 2 commits into
mainfrom
fix/issue-51-auth-recovery

Conversation

@hongnoul

@hongnoul hongnoul commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • preserve the last non-empty URL and title when WebKit clears live metadata after a web-process crash
  • expose a structured web_process_terminated diagnostic through WindowInfo and the event stream, including a stable reason and recoverable URL
  • harden headless-to-focus promotion by cancelling discard and restoring synchronously before asking the compositor to present the window
  • make explicit reload recover an empty-URI crashed view from the retained URL without automatically replaying an unknown authentication POST
  • add a fully isolated behavioral regression that kills the daemon's real WebKit process, verifies retained diagnostics, and proves explicit navigation recovery

Closes #51

Validation

  • cargo fmt --all --check
  • cargo test -p hwatu-ipc
  • focused hwatud recovery tests
  • cargo test
  • cargo clippy --all-targets --all-features -- -D warnings
  • bash -n scripts/test-crash-recovery.sh
  • scripts/test-crash-recovery.sh

@hongnoul hongnoul left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Review verdict: changes requested (comment-only self-review).

P2 – intentional API termination is reported as a crash. The termination callback maps every reason other than crash/OOM to terminated unexpectedly. On normal close, connect_close_request calls terminate_web_process_unless_shared() while the view is still stored in self.webview, so TerminatedByApi can pass the ownership guard, emit a spurious web_process failure event, set crash diagnostics, and show the recovery overlay. Match TerminatedByApi explicitly and return without failure state; add a close regression.

P2 – focus promotion can disable discard indefinitely. present() cancels the discard timer before requesting compositor activation. If activation is denied and is-active-notify never transitions, no path re-arms discard. The later auto-demote path also does not schedule discard, so the promoted view can remain resident. Re-arm discard when focus is not obtained or when demoting.

The URL/title retention and IPC compatibility otherwise look sound.

Validation: CI is green. I independently ran the focused recovery helper and old-WindowInfo compatibility tests successfully.

@hongnoul hongnoul left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Follow-up: PR #59 merged into main while this review was in progress and touched the same window lifecycle code. GitHub now reports this PR as CONFLICTING, so it must be rebased and the termination/discard interactions revalidated against the merged QoL handlers before merge.

@hongnoul
hongnoul force-pushed the fix/issue-51-auth-recovery branch from 58e8146 to 7ad115b Compare August 5, 2026 17:48
@hongnoul
hongnoul merged commit bdc0211 into main Aug 5, 2026
7 checks passed
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.

Auth page can crash after headless-to-focus handoff and lose its URL

1 participant