Repository navigation
fix(capture): screenshot downloads out of network logs, tint no-CORS images, user-switch identity race - #179
Closed
boehlerlukas wants to merge 1 commit into
Closed
boehlerlukas wants to merge 1 commit into
boehlerlukas wants to merge 1 commit into
Conversation
…ownloadable images, fix user-switch race - Network logs: the classic screenshot's own image/CSS XHRs were logged as the app's requests (a no-CORS image showed as "GET … FAILED", which Kai read). They are now marked internal and never recorded; the v2 DOM render's fetches (logger already paused) are also kept out of the Resource Timing entries. - v2 DOM screenshot: an <img> the browser render can't download (cross-origin without CORS) gets a neutral tint instead of an empty hole. - Identity: a /sessions answer for the cached contact that lands after Gleap.identify() switched the user no longer switches back (or clears the new contact); startFeedbackFlow / startClassicForm / startBot / startConversation / askAI wait for an identify in flight (max 5 s, like showSurvey) so the conversation isn't filed for the previous contact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Combined into #180 (one PR for all live E2E fixes). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups from the live E2E run of 10-12 (
design-handoffs/e2e-live-2026-10-12/capture.mdB-06/B-07,kai-intake.mdbug 7). No conflict with #178 (that one only touchesGleapCaptureUI.js). Not released; no version bump,build/andpublished/untouched.1. Screenshot downloads logged as the customer's failed requests (B-06)
Broken: a classic "Mark the bug" screenshot on a page with a no-CORS image logged the SDK's own download as
GET …googlelogo… → FAILED (NetworkError)in the customer's network log; Kai Resolve read it as an app failure.Cause:
ScreenCapture.jsinlines images/CSS with plain XHRs, which go through the patchedXMLHttpRequest. The v2 render pauses the logger, but its fetches still show up later as timing-onlyRESOURCEentries (Resource Timing lists failed no-CORS fetches too).Fix:
GleapNetworkIntercepter.ignoreInternalRequest(url, xhr?, since?): a marked XHR is never recorded; a marked URL's Resource Timing entries from that moment on are dropped (bounded to 300 URLs, earlier app requests to the same URL stay). Classic capture marks its XHRs; the v2 render marks every image it asks for (viafetchFn) and every other asset (context.requests) at cleanup.2. Cross-origin images without CORS missing from v2 screenshots (B-07), partly fixed
The classic flow keeps them because the server renders the HTML snapshot. A browser canvas can't read a no-CORS image, so the only way to match that is a Gleap image proxy. No such endpoint exists, and adding one is new server work with SSRF/abuse/size limits to handle, so that part is skipped. The tab-capture path keeps these images.
This PR: an
<img>the render can't download gets a neutral tint (fetch.placeholderImage) instead of an empty hole, so the screenshot doesn't look like the app lost the image. CSS background images stay transparent. Thefetchoption replaces modern-screenshot's defaults, sorequestInit: { cache: 'force-cache' }is set again explicitly.3. Conversation filed for the previous contact after a user switch (kai-intake bug 7)
Broken: in one browser, page for user A, reload as user B, call
startFeedbackFlowwithin about 5 s → 2 of about 15 conversations were created on A's session.Cause (two races):
ready, soPOST /sessions(A's credentials) andPOST /sessions/identify(B) are in flight together. When/sessionsanswers last,validateSession(A)switches back to A, and the replay doesn't fire because A is identified.startFeedbackFlow/startBot/askAIpostedstart-…to the Messenger right away, while the identify was still in flight, so the Messenger created the conversation with A.showSurveyalready waited viaonContactSettled; these didn't.Fix:
contactVersionis bumped when an identify/updateContact result or a logout replaces the session. A/sessionsanswer for a request sent before that bump is dropped (success and 4xx alike).startFeedbackFlowWithOptions(so alsostartFeedbackFlowandstartClassicForm),startBot/startConversationandaskAIrun throughonContactSettled. That is immediate when nothing is in flight and capped at 5 s.Checks
npm test: 31 suites, 528 tests pass, incl. 4 newGleapSessiontests (late/sessionsanswer keeps B, a late 4xx doesn't clear B, a normal refresh still applies, a flow start waits for the identify).npm run buildcompiles (build output reverted, not committed).getRequests(), though Resource Timing lists them. The app's own XHR and its failing fetch are still logged.[255,255,255](hole) before and[235,235,235](tint) after, and the canvas is still exportable.🤖 Generated with Claude Code