PageIndex/pageindex
mountain e5392836a4 fix(index): bound LLM concurrency safely, per-index and leak-free
Cap concurrent in-flight LLM calls during indexing via a shared
semaphore (bounded_gather), so a many-node document no longer schedules
one socket per node and exhausts the process fd limit (Errno 24).

Make the per-index max_concurrency override correct under concurrency:
- Scope IndexConfig(max_concurrency=...) to the build_index call via a
  ContextVar (max_concurrency_scope) instead of mutating a process
  global. A one-off value no longer sticks as the new default, and
  concurrent indexing of other documents isn't affected.
- Propagate the context through _run_async's worker-thread fallback so
  the override survives the sync-over-async thread hop.
- set_max_concurrency() stays as the explicit process-wide setter.

Also stop `from .utils import *` leaking a `config` name (SimpleNamespace
alias) that shadowed the real pageindex.config submodule for the
page_index modules; the alias is now `_config`.

Adds regression tests for cap enforcement, scope stickiness/isolation,
worker-thread propagation, and the config-namespace fix.

Claude-Session: https://claude.ai/code/session_01Kx5DgKbhK1N8autqXH8SmS
2026-07-08 10:40:37 +08:00
..
backend style(cloud): annotate best-effort response-close in query_stream cleanup 2026-07-07 16:02:33 +08:00
index fix(index): bound LLM concurrency safely, per-index and leak-free 2026-07-08 10:40:37 +08:00
parser refactor(sdk): typed returns, protocol contract, parser layering 2026-07-07 12:15:34 +08:00
storage fix(sqlite): make concurrent indexing writes robust (no "database is locked") 2026-07-07 18:23:01 +08:00
__init__.py fix: load .env explicitly in pageindex __init__ 2026-07-07 17:00:34 +08:00
agent.py fix: resolve five P1 defects from the SDK review 2026-07-07 10:12:51 +08:00
client.py refactor(sdk): typed returns, protocol contract, parser layering 2026-07-07 12:15:34 +08:00
cloud_api.py fix(cloud_api): restore legacy is_retrieval_ready swallow-on-error contract 2026-07-07 15:48:49 +08:00
collection.py refactor(sdk): typed returns, protocol contract, parser layering 2026-07-07 12:15:34 +08:00
config.py fix(index): bound LLM concurrency safely, per-index and leak-free 2026-07-08 10:40:37 +08:00
errors.py fix(cloud): align cloud/local backend contracts and harden the HTTP layer 2026-07-07 09:40:09 +08:00
events.py feat: add PageIndex SDK with local/cloud dual-mode support (#207) 2026-04-08 20:21:58 +08:00
page_index.py refactor(index): dedupe the copied indexing pipeline behind deprecation shims 2026-07-07 10:42:23 +08:00
page_index_md.py refactor(index): dedupe the copied indexing pipeline behind deprecation shims 2026-07-07 10:42:23 +08:00
retrieve.py refactor(index): dedupe the copied indexing pipeline behind deprecation shims 2026-07-07 10:42:23 +08:00
tokens.py refactor(sdk): typed returns, protocol contract, parser layering 2026-07-07 12:15:34 +08:00
types.py refactor(sdk): typed returns, protocol contract, parser layering 2026-07-07 12:15:34 +08:00
utils.py refactor(index): dedupe the copied indexing pipeline behind deprecation shims 2026-07-07 10:42:23 +08:00