Skip to content

Commit 6360d74

Browse files
nan-liclaude
andcommitted
fix(iv): clear stale existingOnesignalId on anon-purge
When jwt_required hydrates true and removeOperationsWithoutExternalId drops the anon ops, surviving LoginUserOperations may still carry existingOnesignalId pointing at the just-dropped anon user (the merge-anon-into-identified link set by LoginHelper). Under IV that link is permanently unresolvable — anon user creation needs a JWT-less call the backend rejects — so canStartExecute=false sticks forever and deadlocks the queue (no other op can dispatch since they all wait on the login to resolve the local onesignal_id). Clear existingOnesignalId on every surviving LoginUserOperation so the executor takes the createUser (upsert) path. Matches the same fix in reference branches #2599 and #2613. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bbd5c6c commit 6360d74

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

  • OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/operations/impl

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/operations/impl/OperationRepo.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,18 @@ internal class OperationRepo(
272272
val anonymous = queue.filter { it.operation.externalId == null }
273273
anonymous.forEach { it.waiter?.wake(false) }
274274
queue.removeAll(anonymous)
275+
// IV=ON never transfers anonymous state; clear existingOnesignalId so the
276+
// executor takes the createUser (upsert) path. The merge-anon-into-identified
277+
// path can't dispatch under IV — anon user creation requires a JWT-less call
278+
// the backend rejects — and a stale local-id existingOnesignalId would leave
279+
// canStartExecute=false forever, deadlocking the queue.
280+
queue.forEach { item ->
281+
val op = item.operation
282+
if (op is LoginUserOperation && op.existingOnesignalId != null) {
283+
Logging.debug("OperationRepo: cleared existingOnesignalId on LoginUserOperation (was ${op.existingOnesignalId})")
284+
op.existingOnesignalId = null
285+
}
286+
}
275287
Logging.debug("OperationRepo: removeOperationsWithoutExternalId removed ${anonymous.size} of ${anonymous.size + queue.size} operations")
276288
anonymous.map { it.operation.id }
277289
}

0 commit comments

Comments
 (0)