[Fix] Add GatewayDispatcher error-dedup and lifecycle-buffer tests - #563
Open
YuriNachos wants to merge 1 commit into
Open
[Fix] Add GatewayDispatcher error-dedup and lifecycle-buffer tests#563YuriNachos wants to merge 1 commit into
YuriNachos wants to merge 1 commit into
Conversation
First tests for the GatewayDispatcher error-display paths flagged in clawwork-ai#227: isSameFailure (runId and code+source branches), shouldDisplayError (incl. DEDUP_FALLBACK_WINDOW_MS fallback), and the lifecycleErrorBuffer 2s buffer-and-clear behavior. No production code changes. Fixes clawwork-ai#227 Signed-off-by: Yurii Chukhlib <yurii.chukhlib@viber.com>
Contributor
|
Hi @YuriNachos, DetailsInstructions for interacting with me using comments are available here. |
Author
|
/auto-cc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds the first tests for the GatewayDispatcher error-display paths called out in
#227:
isSameFailure(runId and code+source branches),shouldDisplayError(incl. the
DEDUP_FALLBACK_WINDOW_MSfallback), and thelifecycleErrorBuffer2s buffer-and-clear behavior. No production code changes — test-only.
Type of change
[Fix]bug fix (test coverage for an existing untested error path; no behavior change)Why is this needed?
The error-dedup and lifecycle-buffer logic in
packages/core/src/services/gateway-dispatcher.tshad zero tests (#227). A silent regression there means users either get spammed
with duplicate errors or see no errors at all. This locks down the behaviors that
decide whether an error reaches the user.
What changed?
packages/core/test/gateway-dispatcher.test.ts(vitest). It drives thepublic
createGatewayDispatchervia a harness that mirrorspackages/desktop/test/gateway-dispatcher-subagent.test.tsand covers:isSameFailuresuppresses a repeat with sametaskId+code+source, anddisplays when the
codediffers;isSameFailuresuppresses a repeat with sametaskId+runId, and displayswhen the
runIddiffers;shouldDisplayErrorshows the first error for a task, suppresses anidentical repeat;
DEDUP_FALLBACK_WINDOW_MS(2000 ms) fallback suppresses a samerawMessage+sourcerepeat inside the window and re-displays after itelapses (
vi.useFakeTimers+advanceTimersByTime);erroris buffered for 2000 ms then released as a systemmessage, and is cleared when a chat
errorfor the same task arrives first.Architecture impact
packages/core/test/; dependency direction (shared ← core) and layerownership are unchanged.
Linked issues
Fixes #227
Validation
pnpm lint(ranpnpm eslinton the new file — clean; full repo lint not run)pnpm test(ranpnpm --filter @clawwork/core test— 117/117 green, incl. the 8 new tests)pnpm buildpnpm check:ui-contractpnpm checknot run: it stops at the repo's pre-existingformat:checkbaseline red (~539 files) that reproduces on untouchedmain.The new file passes
prettier --check,eslint, and the core test typecheck(
tsc -p tsconfig.test.json— exit 0).)