Repository navigation
fix(embedding): honour REPOWISE_EMBEDDING_TIMEOUT in every embedder - #1475
Conversation
A reply truncated at max_tokens parses to {} and decodes to the same
deterministic fallback a model that returned nothing produces, so the two
are indistinguishable: no exception, no warning, only named_by_model=0 on
the planned line. The provider already surfaces the signal, and
validate_generated_response treats it as fatal for a page.
Log it and carry on. Reasoning tokens are charged to the same ceiling, so
a thinking model can exhaust it while emitting no answer at all.
Only the Ollama embedder read the timeout variable CONFIG.md documents as applying to whichever embedder is active; openai, gemini and openrouter hardcoded 10s. Against an OpenAI-compatible endpoint on local hardware one chunk is EMBED_BATCH_MAX_ITEMS items of up to EMBED_TEXT_MAX_CHARS, which takes seconds of GPU work, and an expired batch is not retried — it is reported once as 'N/N items failed to embed' while the run still exits 0. Resolve through one shared helper: explicit arg > <PROVIDER>_EMBEDDING_TIMEOUT > REPOWISE_EMBEDDING_TIMEOUT > the provider default. Defaults are unchanged, since the same embedder bounds the retried query path. A malformed env value warns and falls back rather than raising: build_embedder converts a construction error into a keyless 8-wide embedder, so raising would let a typo silently destroy retrieval for a setup that worked before the variable was read at all. inf and nan are rejected with the rest.
…out loud Two gaps in the previous commit, both on the path this change exists for. The ollama embedder and the CLI's _embedder_kwargs each parsed the variable themselves with a bare float(), so a typo raised inside build_embedder's except Exception and downgraded the run to a keyless 8-wide store — the failure this change set out to prevent, still reachable on the embedder most likely to need a raised timeout. inf and negatives reached httpx unchecked there too. Both now resolve through the one helper; the CLI stops pre-parsing. The fallback also claimed to warn while warning nobody: configure_cli_logging pins structlog to ERROR unless -v, so every command that embeds discarded the line. Report on stderr as build_embedder already does for the same class of misconfiguration. A malformed provider-specific value no longer consumes its precedence over a valid shared one.
|
✅ Health of changed files: 7.5 → 7.6 (+0.1) 📋 At a glance Files & modules (2)
✅ Health gate: passed 📌 Before you merge
🔎 More signals (3)🗺️ Change map flowchart LR
subgraph PR ["Changed in this PR (7 with dependents)"]
f_packages_core_src_repowise_core_generation_concept_tree_planner_py[".../concept_tree/planner.py 🔥"]:::changed
f_packages_core_src_repowise_core_providers_embedding_base_py[".../embedding/base.py 🔥"]:::changed
f_packages_core_src_repowise_core_providers_embedding_openai_py[".../embedding/openai.py 🔥"]:::changed
f_packages_core_src_repowise_core_providers_embedding_openrouter_py[".../embedding/openrouter.py 🔥"]:::changed
f_packages_cli_src_repowise_cli_providers_embedders_py[".../providers/embedders.py"]:::changed
f_packages_core_src_repowise_core_providers_embedding_gemini_py[".../embedding/gemini.py"]:::changed
f_packages_core_src_repowise_core_providers_embedding_ollama_py[".../embedding/ollama.py"]:::changed
end
f_packages_core_src_repowise_core_generation_page_generator_orchestrate_py[".../page_generator/orchestrate.py"]
f_packages_core_src_repowise_core_generation_concept_tree_planner_py --> f_packages_core_src_repowise_core_generation_page_generator_orchestrate_py
f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py[".../doctor_cmd/repo_checks.py"]
f_packages_core_src_repowise_core_providers_embedding_base_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
f_packages_cli_src_repowise_cli_commands_reindex_cmd_py[".../commands/reindex_cmd.py"]
f_packages_core_src_repowise_core_providers_embedding_base_py --> f_packages_cli_src_repowise_cli_commands_reindex_cmd_py
f_packages_cli_src_repowise_cli_providers_vector_store_py[".../providers/vector_store.py"]
f_packages_core_src_repowise_core_providers_embedding_base_py --> f_packages_cli_src_repowise_cli_providers_vector_store_py
f_packages_cli_src_repowise_cli_upgrade_py[".../cli/upgrade.py"]
f_packages_core_src_repowise_core_providers_embedding_base_py --> f_packages_cli_src_repowise_cli_upgrade_py
f_packages_core_src_repowise_core_providers_embedding_registry_py[".../embedding/registry.py"]
f_packages_core_src_repowise_core_providers_embedding_openai_py --> f_packages_core_src_repowise_core_providers_embedding_registry_py
f_packages_core_src_repowise_core_providers_llm_deepseek_py[".../llm/deepseek.py"]
f_packages_core_src_repowise_core_providers_embedding_openai_py --> f_packages_core_src_repowise_core_providers_llm_deepseek_py
f_packages_core_src_repowise_core_providers_llm_kimi_py[".../llm/kimi.py"]
f_packages_core_src_repowise_core_providers_embedding_openai_py --> f_packages_core_src_repowise_core_providers_llm_kimi_py
f_packages_core_src_repowise_core_providers_llm_ollama_py[".../llm/ollama.py"]
f_packages_core_src_repowise_core_providers_embedding_openai_py --> f_packages_core_src_repowise_core_providers_llm_ollama_py
f_packages_core_src_repowise_core_providers_embedding_openrouter_py --> f_packages_core_src_repowise_core_providers_embedding_registry_py
f_packages_cli_src_repowise_cli_providers_embedders_py --> f_packages_cli_src_repowise_cli_commands_reindex_cmd_py
f_packages_core_src_repowise_core_providers_embedding_gemini_py --> f_packages_core_src_repowise_core_providers_embedding_registry_py
f_packages_core_src_repowise_core_providers_embedding_ollama_py --> f_packages_core_src_repowise_core_providers_embedding_registry_py
more(["+19 more dependents"])
PR --> more
t_tests_unit_generation_test_concept_naming_wiring_py(["✅ .../generation/test_concept_naming_wiring.py"]):::guard
t_tests_unit_generation_test_concept_naming_wiring_py -.-> f_packages_core_src_repowise_core_generation_concept_tree_planner_py
t_tests_integration_persistence_test_embed_batch_pg_py(["✅ .../persistence/test_embed_batch_pg.py"]):::guard
t_tests_integration_persistence_test_embed_batch_pg_py -.-> f_packages_core_src_repowise_core_providers_embedding_base_py
t_tests_unit_server_mcp_test_embedder_resolution_py(["✅ .../mcp/test_embedder_resolution.py"]):::guard
t_tests_unit_server_mcp_test_embedder_resolution_py -.-> f_packages_core_src_repowise_core_providers_embedding_openai_py
classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Solid arrows: code that imports the changed files (28 direct dependents, from the last indexed snapshot). Dashed: history/tests. 🔥 Hotspots touched (5)
2 more
💀 Dead code (1 finding)
👀 Suggested reviewers @RaghavChamadiya 📊 See the full report for this PR |
|
Good report and a good fix. The timing table in #1474, the note that the recommended repair runs through the same failing path, and the reasoning for why a bad value must not raise (it would hit Consolidating onto one resolver and deleting the duplicate parse in One thing to fix. The stderr message names the wrong number in the case your own logic is cleverest about:
On the concept-tree commit: normally I would ask for that as its own PR, since we squash and the commit title would hide a generation change inside an embedding fix. It is small and genuinely independent though, so do not bother splitting it. I will write the squash message to name both. Not running Fix the message and I will merge. |
|
@RaghavChamadiya thank you for the review. I pushed the fix. |
|
Thank you |
Fixes #1474.
REPOWISE_EMBEDDING_TIMEOUTis documented as applying to whichever embedder is active, but only theOllama embedder read it;
openai,geminiandopenrouterhardcoded 10s. Against a localOpenAI-compatible endpoint one request embeds a whole batch — measured ~10s at 2,500 characters per item
and ~15s beyond 4,000 — so batches expired and were reported once as
N/N items failed to embedwhile therun still exited 0. The repair that message recommends,
repowise reindex, embeds through the same pathand failed identically. Numbers, method and repro are in the issue.
Defaults are unchanged (Ollama 30s, the rest 10s). The same embedder serves the query path and the SDK
retries twice, so raising the shared default would turn a stalled hosted endpoint into a ~90s MCP tool
call. Unifying the four defaults is a separate call.
A malformed value falls back instead of raising.
build_embedderwraps construction inexcept Exceptionand returnsKeylessEmbedder, so raising on a typo like30swould silently leave therun with 8-dimensional vectors and no retrieval — breaking a setup that worked before the variable was read
at all. It is reported on stderr rather than through
log.warning, becauseconfigure_cli_loggingfiltersstructlog to ERROR unless
-v, which would have discarded the message on every command that embeds. Whatshould happen for bad embedder config is the open question in #826; this follows whatever is decided
there.
Commits
Independent — either can be dropped without touching the other.
concept-tree: warn when outline naming is cut at the token ceiling. A truncated reply parses to{}and decodes to the same deterministic fallback an empty one produces, so the two areindistinguishable and titles silently become path-derived. Reasoning tokens count against the same
ceiling, so a thinking model can exhaust it having emitted no answer.
embedding: honour the variable in every embedder, via one shared resolver(explicit arg >
<PROVIDER>_EMBEDDING_TIMEOUT>REPOWISE_EMBEDDING_TIMEOUT> provider default).embedding: route Ollama through it too. Ollama and_embedder_kwargseach parsed the variablewith a bare
float(), so the keyless downgrade above was still reachable on the embedder most likely toneed a raised timeout, and
inf/negatives reachedhttpxunchecked.Tests
tests/unit/test_persistence/test_embedding_timeout_resolution.pyholds the cross-embedder contract:precedence, that a malformed provider-specific value falls through to a valid shared one rather than
consuming its precedence, that no embedder is destroyed by a typo, and that the fallback reaches stderr.
12 of the new tests fail on
main— includingcould not convert string to float: '30s'andinfreaching the client on the Ollama path.
uv run pytest tests/unit/test_persistence tests/unit/generation tests/unit/test_providers— 1667 passed.CONFIG.mdgains the provider-prefixed rows and the defaults it never stated.I have not run
ruff formatrepo-wide: it reformats 522 files on currentmain, which would bury thediff.