← Back to PRs

#22322: fix(googlechat): keep webhook monitor alive until abort

by AIflow-Labs open 2026-02-21 01:39 View on GitHub →
channel: googlechat size: M
## What changed - Keep the Google Chat monitor lifecycle attached to the account `AbortSignal` so startup stays active until shutdown and only resolves on stop. - Fail fast when webhook path resolution is invalid by throwing in `monitorGoogleChatProvider`. - Align gateway startup with the long-running monitor flow in `startGoogleChatMonitor`. - Add a regression test ensuring startup does not resolve before abort. ## Why this fixes issue 22159 The monitor previously returned immediately, so the gateway treated startup as completed and re-entered restart behavior that looked like silent webhook crash-loops. Waiting on the abort signal keeps webhook registration alive and prevents the restart loop while preserving cleanup on stop. ## Tests run - `pnpm test extensions/googlechat/src/monitor.test.ts` - `pnpm test extensions/googlechat/src/*.test.ts` ## Edge cases / notes - Invalid webhook path now throws an error instead of returning a no-op unregister function. - No unresolved infra blockers found for this fix. <!-- greptile_comment --> <h3>Greptile Summary</h3> Keeps Google Chat webhook monitor alive until the abort signal is triggered, preventing crash-loop behavior where the gateway repeatedly restarts the monitor. The monitor now awaits the abort signal instead of resolving immediately, and throws an error for invalid webhook paths rather than returning a no-op function. Additionally resolves cross-context message policy for agent defaults, allowing per-agent override of message tool cross-context behavior through `agents.defaults.tools.message` configuration. <h3>Confidence Score: 4/5</h3> - Safe to merge with good test coverage and clear fix - The core Google Chat monitor fix correctly addresses the lifecycle issue with a clean implementation using Promise and abort signal. The config schema changes are well-tested with new regression tests. The outbound policy changes properly cascade configuration resolution from agent-specific to defaults to global. Minor deduction because the channel.ts change uses `void unregister` without cleanup callback, which changes status reporting behavior. - Verify that removing the cleanup callback in `extensions/googlechat/src/channel.ts:560-561` doesn't break status tracking <sub>Last reviewed commit: 5b11407</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs