Skip to content

UI /api/layout drops connection for large graph when max_nodes is high #726

Description

@sharif-smj

Summary

The graph UI fails for a large indexed private repository. Indexing succeeds and CLI/MCP graph queries work, but opening the project in the browser UI causes /api/layout to hang and then drop the connection without a JSON error response.

This appears isolated to the browser UI layout endpoint, not the core indexer.

Environment

  • codebase-memory-mcp --version: 0.8.1
  • Binary: UI release asset for macOS arm64
  • OS: macOS arm64
  • UI URL: http://127.0.0.1:9749

Project size

The indexed private project is roughly:

  • 23k nodes
  • 96k edges

list_projects and get_architecture work for this project.

Reproduction

After indexing a large project, open it in the graph UI, or call the layout endpoint directly:

curl -v 'http://127.0.0.1:9749/api/layout?project=<large-private-project>&max_nodes=50000'

Observed result:

curl: (52) Empty reply from server

In Chrome, the graph page shows:

Failed to fetch

The request hangs for roughly 20-35 seconds before the connection is dropped. The local UI process then restarts if supervised externally.

Threshold observed locally

These returned successfully:

max_nodes=10000
max_nodes=12000
max_nodes=14000

These failed or caused the UI server connection to be dropped:

max_nodes=16000
max_nodes=20000
max_nodes=50000

The bundled frontend appears to request max_nodes=50000 when loading a graph.

Expected behavior

For large projects, the UI should ideally do one of the following:

  • render a bounded layout that the server can handle,
  • automatically lower max_nodes,
  • stream/progressively load layout data,
  • or return a structured JSON error instead of dropping the connection.

Notes

I intentionally redacted the repository name, local paths, and project-specific identifiers because this was reproduced against a private codebase. Happy to provide more diagnostics if there is a safe way to collect them without exposing source or project details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions