Ignore cancelled OpenAI dashboard navigation errors (-999)#409
Ignore cancelled OpenAI dashboard navigation errors (-999)#409spirosrap wants to merge 4 commits intosteipete:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f91f13a70a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if Self.shouldIgnoreNavigationError(error) { | ||
| return | ||
| } |
There was a problem hiding this comment.
Complete navigation on ignored cancel errors
Returning early on NSURLErrorCancelled means the delegate never calls completeOnce, so prepareWebView’s checked continuation in Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardWebViewCache.swift can remain suspended forever when cancellation is terminal (i.e., no follow-up didFinish/didFail arrives after the cancel). In that case acquire(...) never returns and the higher-level dashboard timeout logic is bypassed because its deadline is started only after makeWebView completes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 375de22. Ignored NSURLErrorCancelled now completes the delegate continuation with success (instead of returning early), so prepareWebView cannot hang waiting for a callback. Added a focused test in OpenAIDashboardNavigationDelegateTests to cover cancelled-failure completion behavior.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 375de2247b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { | ||
| if Self.shouldIgnoreNavigationError(error) { | ||
| self.completeOnce(.success(())) |
There was a problem hiding this comment.
Don't mark cancelled navigations as completed success
Calling completeOnce(.success(())) for NSURLErrorCancelled in the failure delegates turns an intermediate cancellation into a terminal success. In this class, hasCompleted then suppresses all later callbacks, so a redirect-driven -999 can cause prepareWebView to resume before the real navigation finishes (or before a later hard failure), which can lead to scraping stale/partial dashboard content and masking real load errors.
Useful? React with 👍 / 👎.
|
Opened a follow-up draft PR to carry this forward with the cancellation-completion fix: #413 Supersedes #409. Thanks again @spirosrap for the original fix and the groundwork here. |
Summary
NSURLErrorCancelled(-999) in OpenAI dashboard WKWebView navigation delegate callbacksnonisolatedso tests can call it without actor isolation issuesWhy
WKWebViewcan emitNSURLErrorCancelledduring expected navigation transitions. Treating that as a hard failure surfaces a misleading error in Codex/OpenAI credits fetch.Fixes #262