Skip to content

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Sep 29, 2025

Depends on bluesky-social/atproto#4238

Once bluesky-social/atproto#4238 is merged, this removes the hackfix working around it. That resolves one of the potential issues that @mackuba identified in #8695 (comment), namely the lastSession variable getting stale.

I don't know if there's an actual repro case for that problem, but removing clearly buggy code in favor of upstream fix seems like a good idea anyway.

Test Plan

Apply this PR first. We should see bad behavior on network errors, same as before the hackfix was added in #4911.

Then apply bluesky-social/atproto#4238. The test plan from #4911 should pass although the hackfix is no longer present.

I have not done this myself yet.

@gaearon gaearon marked this pull request as ready for review September 30, 2025 00:16
@gaearon
Copy link
Contributor Author

gaearon commented Sep 30, 2025

I'm actually not even sure how to reproduce the original issue because I'm not sure how to forcefully get a network-error. I'm sure there was some way (maybe captive wifi? broken wifi?) but turning off wifi doesn't do the job.

I think this fix is correct but this will need someone from the team to shepherd as I'm unlikely to test this in depth.

@ThisIsMissEm
Copy link

I'm actually not even sure how to reproduce the original issue because I'm not sure how to forcefully get a network-error. I'm sure there was some way (maybe captive wifi? broken wifi?) but turning off wifi doesn't do the job.

I think this fix is correct but this will need someone from the team to shepherd as I'm unlikely to test this in depth.

Yeah, probably using the developer tools and setting the network mode to something lossy would do the trick?

@mackuba
Copy link

mackuba commented Sep 30, 2025

You could try this thing: https://www.avanderlee.com/debugging/network-link-conditioner-utility/ (just don't forget to turn it off…)

@estrattonbailey
Copy link
Member

You could try this thing: https://www.avanderlee.com/debugging/network-link-conditioner-utility/ (just don't forget to turn it off…)

Yeah this is what I've used in the past

@mackuba
Copy link

mackuba commented Sep 30, 2025

Tbh, I haven't been able to manually trigger this condition where it would restore an expired session in that spot because of a network error, even with the Link Conditioner… so I can't confirm it. But also I remember being at the Ahoy conference in Hamburg in the spring on a bad hotel WiFi, and being logged out then all the time…

@estrattonbailey
Copy link
Member

I'm struggling as well. Maybe I haven't used Network Link Conditioner for this in the past 🤔

As noted here, this handling was originally added for unknown and server errors. Gonna spend a little more time trying to repro using the local dev-env package, but in any case, the logic here looks sound to me and I believe it should accomplish the same goals as the previous implementation.

@estrattonbailey
Copy link
Member

Ok partial repro here bluesky-social/atproto#4242

Appears that BskyAgent.prepare races and may not be called in time, so on a cold load we actually end up hitting the debugger before the persistSessionHandler is attached. That means there's a case where this handling wasn't even used. Even prior to Dan's upstream patch the session shouldn't have been unset.

I gotta pause on this, would be curious to know if anyone can confirm this finding.

@gaearon
Copy link
Contributor Author

gaearon commented Sep 30, 2025

Yeah I wouldn’t expect this to work reliably for the initial load, just for some cases of losing network midway.

@estrattonbailey
Copy link
Member

Yeah I wouldn’t expect this to work reliably for the initial load, just for some cases of losing network midway.

Oh then I should point out that network-error is only emitted during a resumeSession call. Other network requests internally call refreshSession, which will emit expired events and rug the session if the token is legit expired, but otherwise won't emit anything.

This reverts commit 38445f3.
Copy link
Member

@estrattonbailey estrattonbailey left a comment

Choose a reason for hiding this comment

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

With the fix upstream we can merge this. I'm not positive of the impact, but it's a nice cleanup regardless, and should match existing handling. Thanks again for everyone's help on this 🙏

@estrattonbailey estrattonbailey merged commit 1354fd2 into bluesky-social:main Oct 2, 2025
7 checks passed
NekoDrone added a commit to NekoDrone/catsky-social that referenced this pull request Oct 3, 2025
* Send inferrable interactions to third-party feeds (bluesky-social#9094)

* Fix link crash (bluesky-social#9102)

* fix link crash

* fix link crash

* Log OTA errors properly (bluesky-social#9101)

* Log OTA errors properly

* filter out network errors

* don't send some "activity no longer available" errors (bluesky-social#9100)

* remove root sibling library (bluesky-social#9097)

* Catch errors on geolocation request, reduce Sentry logs (bluesky-social#9098)

* Nightly source-language update

* fix gap on profile (bluesky-social#9081)

* Update admonition component (bluesky-social#9068)

* update admonition component

* fix linting, adominition alighment

* design tweak

* edge cases for admonition, update storybook

* Update src/components/Admonition.tsx

Co-authored-by: Samuel Newman <[email protected]>

* fix mobile version

* change button style

---------

Co-authored-by: Samuel Newman <[email protected]>

* Button tweaks (bluesky-social#9106)

* Tweak button colors

* Semi bold only for tiny buttons

* [Web] Fix thread jumps (bluesky-social#9111)

* [Web] Fix thread jumps

* Comment formatting

---------

Co-authored-by: Eric Bailey <[email protected]>

* Add StackedButton component (bluesky-social#9086)

* Nightly source-language update

* Fix feedfeedback metrics not distinguishing which feed it's from (bluesky-social#9099)

* fix feedfeedback metrics being sent for all feeds

* remove `discover:` metrics

* add patent pledge link to readme (bluesky-social#9118)

* Language selection and suggestion UX improvements (bluesky-social#9067)

* feat: don't retain accepted language suggestion after finishing or exiting post (bluesky-social#8886)

* feat: don't retain accepted language suggestion after finishing or exiting post

* fix: rebase fixes

* fix: rebase fixes

* chore: lint

* Rename onChange for clarity

* Improve logic in composer

* Handle user override more explicitly

* Drill in onSelectLanguage callback into dialog too

* Fix typo

Co-authored-by: surfdude29 <[email protected]>

* Make text crystal clear

* Handle multiple languages

---------

Co-authored-by: Elijah Seed-Arita <[email protected]>
Co-authored-by: surfdude29 <[email protected]>

* Tighten up eslint rule to catch unused `const {_} = useLingui()` (bluesky-social#9122)

* tighten eslint config to catch unused `useLingui`s

* fix now-invalid uses of _

* remove unused function that produces a ton of eslint warnings

* upgrade react compiler plugin

* [Fix Logouts] Remove buggy hackfix (bluesky-social#9108)

* Rip out the network hack in favor of bluesky-social/atproto#4238

* Bump api pkg

* Debug code

* Revert "Debug code"

This reverts commit 38445f3.

---------

Co-authored-by: Eric Bailey <[email protected]>

* Nightly source-language update

* fix: missed alf reversion

---------

Co-authored-by: dan <[email protected]>
Co-authored-by: Samuel Newman <[email protected]>
Co-authored-by: pfrazee <[email protected]>
Co-authored-by: Chenyu <[email protected]>
Co-authored-by: Eric Bailey <[email protected]>
Co-authored-by: Daniel Holmgren <[email protected]>
Co-authored-by: Elijah Seed-Arita <[email protected]>
Co-authored-by: surfdude29 <[email protected]>
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.

4 participants