fix(bridge): synchronize reconciled login state

Route recovered login state through the hook client before dependent services start. Add regression coverage to keep packet actions available after reconciliation.

Fixes #286.
This commit is contained in:
DrSmoothl committed 2026-07-26 15:53:57 +08:00
1 parent b5e10fefc2
commit d05bbe3551
3 files changed
+71 -5

No files matched your search

+8 -1
View File
@@ -507,7 +507,14 @@ export class HookSession extends EventEmitter {
this.log.info('login reconciled via active probe: PID=%d UIN=%s', this.pid, info.uin);
// isRealUin guarantees a pure non-empty digit string, so BigInt() here
// cannot throw (keep that contract if isRealUin's regex is ever changed).
this.handleLoginState({ loggedIn: true, uin: info.uin, uinNumber: BigInt(info.uin) });
// Reconcile through QqHookClient instead of mutating HookSession alone:
// packet sending and login waiters must observe the same state before
// the login event starts Bridge / OneBot initialization.
this.client!.reconcileLoginState({
loggedIn: true,
uin: info.uin,
uinNumber: BigInt(info.uin),
});
}
} finally {
this.probing = false;