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.
There is a regression in #4857 — although it appears to be setting up the session persistence handler, that handler (stored in a ref) is not being read. Additionally, it is a little fragile that merely calling
createAgent*
modifies a ref sincecreate*
functions were intended to be stateless. Otherwise it gets very difficult to reason about race conditions.In this PR, I remove the ref and move the persistence handler to be scoped per-agent like before. The underlying
BskyAgent
signature changed so that the persistence handler has to be supplied during creation. However, we don't always know thedid
during its creation (e.g. we wouldn't know thedid
of an agent whosecreateAccount
call is yet to follow). So we want late binding for the session handler. To do that, I store it in a local variable and swap it out when ready.I ended up removing
prepareAgent
handler because it was obscuring what's actually happening. This adds a bit of duplication but should be clearer.Test Plan
Have not explicitly tested but @haileyok knows a few bugs that this should fix.