Skip to content

Performance Problem #720

@IvanKablar

Description

@IvanKablar

Environment

  • Serena: 0.1.4-fad35ef4-dirty
  • Client: Google Gemini CLI
  • OS: Ubuntu 24.04
  • Language: Python 3.12.3 (Pyright 1.1.407)
  • Test Project: https://github.com/tiangolo/fastapi (1,178 Python files, 80 MB)
  • Health Check: ✅ Passes

Configuration:

~/.serena/serena_config.yml

tool_timeout: 1200 # 20 minutes (default: 240s)
default_max_tool_answer_chars: 500000 # (default: 150000)

// .gemini/settings.json MCP timeout
"timeout": 1200000 // 20 minutes


Issue

Querying central framework classes causes severe performance degradation:

Metric Without Serena With Serena (20min timeout)
Time 7m 13s 41m 14s (5.7x slower)
Timeouts 0 2
Tokens ~270K ~476K

Tool execution:
x find_referencing_symbols {"name_path":"FastAPI",...}
MCP error -32001: Request timed out (after 20 minutes)

x think_about_whether_you_are_done {}
MCP error -32001: Request timed out (after 20 minutes)


Reproduction

git clone https://github.com/tiangolo/fastapi
cd fastapi

Configure Gemini CLI with Serena MCP server

gemini

Where is the class FastAPI used?

Wait 41 minutes for 2 timeouts...

The FastAPI class has ~3,290 references across the project.


Problems

  1. find_referencing_symbols: Runs for full 20-minute timeout on heavily-used symbols (expected but problematic)
  2. think_about_whether_you_are_done: Also times out for 20 minutes (unexpected - this should be instant!)

The second timeout suggests a broader issue beyond just LSP performance - possibly deadlock or task queue problems after the first timeout.


Suggested Fixes

High Priority:

  1. Fail-fast: Pre-check reference count, abort early if > 500 references with helpful error message
  2. Fix meta-tool timeout: think_about_whether_you_are_done should never take > 5 seconds

Nice-to-have:
3. Streaming/incremental results for find_referencing_symbols
4. Documentation on when to use LSP tools vs. pattern search


Impact

Serena becomes unusable for exploring unfamiliar codebases - the primary use case. Users querying central classes (the natural first query) experience 40+ minute hangs and abandon the
tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions