You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "jackeyfaker77 (via GitHub)" <gi...@apache.org> on 2026/10/02 20:08:42 UTC
[I] bug(bots): disabled and stopped bridges still forward late events [maka]
jackeyfaker77 opened a new issue, #5945:
URL: https://github.com/apache/maka/issues/5945
### What happened
After disabling a Bot channel through applySettings() or awaiting BotRegistry.stopAll(), the registry reports the channel as disabled, but the retired bridge still forwards message and statusChange events to the registry callbacks. A queued SDK callback can therefore dispatch an incoming message or project a running status after the registry has removed the channel.
Expected: a retired bridge stops forwarding both event types as soon as retirement begins, including while its asynchronous stop() is pending. A replacement bridge must continue forwarding normally.
### How to reproduce
Build the repository, save the following as `bot-retirement-repro.mjs` in the repository root, and run `node bot-retirement-repro.mjs`. This replaces only the bridge's start/stop methods to simulate pending SDK callbacks without network access.
```js
import { BOT_PROVIDERS, createDefaultBotChannel } from '@maka/core/settings';
import { BotRegistry, WeComBotBridge } from '@maka/runtime/bots';
const disabled = () => ({
channels: Object.fromEntries(BOT_PROVIDERS.map(p => [p, createDefaultBotChannel(p)])),
});
let retired;
WeComBotBridge.prototype.start = async function () { retired = this; };
WeComBotBridge.prototype.stop = async function () {};
for (const action of ['disable', 'stopAll']) {
const messages = [];
const statuses = [];
const registry = new BotRegistry({
onIncomingMessage: m => messages.push(m),
onStatusChange: s => statuses.push(s),
});
const enabled = disabled();
enabled.channels.wecom.enabled = true;
await registry.applySettings(enabled);
if (action === 'disable') await registry.applySettings(disabled());
else await registry.stopAll();
const before = { messages: messages.length, statuses: statuses.length };
retired.emit('message', {
platform: 'wecom', userId: 'fixture-user', userName: 'fixture-user',
chatId: 'fixture-chat', isGroup: false, text: 'late message',
sourceMessageId: 'fixture-message', receivedAt: 1,
});
retired.emit('statusChange', {
platform: 'wecom', running: true, readiness: 'operational', connection: 'gateway',
});
console.log(JSON.stringify({
action, registryReason: registry.getStatus('wecom').reason,
lateMessagesForwarded: messages.length - before.messages,
lateStatusesForwarded: statuses.length - before.statuses,
}));
}
```
Actual output on the affected upstream revision:
```json
{"action":"disable","registryReason":"disabled","lateMessagesForwarded":1,"lateStatusesForwarded":1}
{"action":"stopAll","registryReason":"disabled","lateMessagesForwarded":1,"lateStatusesForwarded":1}
```
Expected: both forwarded-event counts are `0` for both actions.
### Environment
- Maka commit: ab5996bdbe125f85ec86a0b3d54a6738c16e7af8 (upstream main)
- OS: Windows, x64
- Surface: BotRegistry in packages/runtime (shared Bot lifecycle)
- Node.js: v24.20.0
- Deterministic simulated late events; no live provider account or SDK end-to-end test.
### Logs, screenshots, or additional context
The disable and stopAll paths stop/remove bridges without detaching their registry listeners. The credential-restart path detaches listeners only after awaiting stop(), leaving a related window during shutdown. The wire() callbacks do not check whether the emitting bridge is still current.
I am preparing a focused fix and regression tests for disable, stopAll, and replacement, including delayed stop completion and callbacks captured before listener removal.
Automated report prepared with OpenAI Codex on behalf of the contributor.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [I] bug(bots): disabled and stopped bridges still forward late events [maka]
Posted by "jackeyfaker77 (via GitHub)" <gi...@apache.org>.
jackeyfaker77 commented on issue #5945:
URL: https://github.com/apache/maka/issues/5945#issuecomment-5960645650
take
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org