Skip to content

test(mcp): list-changed refresh budget test flakes under CI load #3307

Closed

Description

@M4n5ter
English

What happened

The standard CI job intermittently fails in @maka/mcp at:

gives spaced list-changed notifications independent refresh budgets
Error: condition was not reached
at waitFor (.../packages/mcp/dist/__tests__/manager.test.js:845:19)

Observed run: https://github.com/apache/maka/actions/runs/32357603277/job/96390067848

The MCP suite completed with 114 passing tests and this single failure. The triggering PR (#3278) changes only ASF release workflow, documentation, and workflow-policy test files; it does not change packages/mcp.

The test advances an injected logical clock by 1,000 ms for each notification, then waits up to 1,000 ms of wall-clock time for the corresponding tools/list request. In the failed CI run, one refresh was not observed before that wall-clock deadline. This identifies the failure boundary, but does not yet prove whether the cause is the test synchronization, the live SSE fixture, or production refresh scheduling.

How to reproduce

  1. Run the standard CI workspace-test lane on Ubuntu with Node.js 24 and workspace concurrency 3.
  2. Observe packages/mcp/dist/__tests__/manager.test.js while the other selected workspaces are running concurrently.
  3. The failure is intermittent. A targeted local run and 50 consecutive targeted repetitions passed, so there is not yet a deterministic standalone reproduction.

Targeted command:

node --test \
  --test-name-pattern='gives spaced list-changed notifications independent refresh budgets' \
  packages/mcp/dist/__tests__/manager.test.js

Environment

  • Maka commit: 251728b0a5ed8d4f6acc9c9f71c6304b14f37182
  • OS: GitHub-hosted Ubuntu runner
  • Surface: MCP package tests in the standard CI workspace lane
  • Node.js: 24

Expected outcome

The test should deterministically demonstrate that genuinely spaced list-change notifications receive independent refresh budgets, including under normal CI load. The fix should preserve that behavioral contract and remove the wall-clock race rather than masking a production scheduling defect.

Additional context

No open issue currently tracks this failure. Open PRs #2653, #2920, and #2921 touch manager.test.ts as part of their MCP OAuth branches, but their patches do not modify this test or its list-change refresh-budget behavior.

简体中文

发生了什么

标准 CI 的 @maka/mcp 测试偶发失败:

gives spaced list-changed notifications independent refresh budgets
Error: condition was not reached
at waitFor (.../packages/mcp/dist/__tests__/manager.test.js:845:19)

对应运行:https://github.com/apache/maka/actions/runs/32357603277/job/96390067848

MCP 测试共通过 114 项,只有这一项失败。触发该 CI 的 #3278 只修改 ASF 发版 workflow、文档和 workflow policy 测试,没有修改 packages/mcp。

该测试每次通知都把注入的逻辑时钟推进 1,000 ms,随后最多用 1,000 ms 的真实墙上时钟等待对应的 tools/list 请求。失败的 CI 中,有一次刷新没有在该期限内被观察到。现有证据只能确认失败边界,还不能断言根因位于测试同步、真实 SSE fixture,还是生产刷新调度。

如何复现

  1. 在 Ubuntu、Node.js 24 环境运行标准 CI workspace 测试,并发度为 3。
  2. 在其他选中 workspace 并行运行时观察 packages/mcp/dist/__tests__/manager.test.js。
  3. 该问题是偶发的。单次本地定向运行以及连续 50 次定向运行均通过,目前还没有稳定的独立复现。

定向命令:

node --test \
  --test-name-pattern='gives spaced list-changed notifications independent refresh budgets' \
  packages/mcp/dist/__tests__/manager.test.js

环境

  • Maka commit:251728b0a5ed8d4f6acc9c9f71c6304b14f37182
  • 操作系统:GitHub 托管的 Ubuntu runner
  • 范围:标准 CI workspace lane 中的 MCP package 测试
  • Node.js:24

预期结果

该测试应当能够在正常 CI 负载下,确定性地证明真正错开的 list-change 通知拥有独立的刷新预算。修复应保留这一行为契约并消除墙上时钟竞态,而不是掩盖潜在的生产调度问题。

补充信息

当前没有开放 issue 追踪该失败。#2653、#2920 和 #2921 因 MCP OAuth 分支而涉及 manager.test.ts,但它们的 patch 没有修改该测试或 list-change refresh budget 行为。

Activity

  1. M4n5ter commented on Aug 20, 2026

    @M4n5ter
    MemberAuthor
    English

    The failed CI run was rerun without a code change, and the replacement test job completed successfully:

    This supports the issue's intermittent, load-sensitive classification, but it does not identify or fix the underlying race. Keeping the issue open.

    简体中文

    失败的 CI 在没有代码变更的情况下重新运行,替换后的 test job 已成功完成:

    这进一步支持该问题属于偶发、负载敏感的失败,但尚未定位或修复底层竞态,因此保持 issue 开放。

  2. CuSO41108 commented on Aug 23, 2026

    @CuSO41108
    Contributor

    I’m taking this one and have opened #3598. The change replaces the test’s per-refresh one-second wall-clock polling with synchronization on the manager’s successful refresh publication, without changing production refresh behavior. I verified the full MCP suite and repeated the focused case under concurrent load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions