Problem
OpenAICompatibleLLM.call(max_retries=N) correctly interprets N as retries after the initial request and loops over range(N + 1).
_extract_facts_from_chunk, however, resolves the same retain_llm_max_retries / llm_max_retries value and uses it as an attempt count:
for attempt in range(llm_max_retries):
When an operator deliberately configures retain_llm_max_retries=0 because an upstream gateway owns transport retries, Hindsight performs zero fact-extraction requests and raises Fact extraction failed after 0 attempts.
The same setting is also passed to llm_config.call(max_retries=llm_max_retries), so its meaning differs between the two nested layers.
Expected behavior
A retry budget of zero must mean one initial request and no retry. Hindsight should preserve a single retry owner without skipping the operation.
Proposed focused fix
Use at least one outer attempt while preserving the configured transport retry value passed to the provider, and add regression coverage for retain_llm_max_retries=0.
A broader follow-up may want to separate content-quality attempts from transport retries explicitly, but the zero-budget behavior is a correctness bug on its own and blocks trusted gateway deployments.
I can submit the focused patch and test.
Problem
OpenAICompatibleLLM.call(max_retries=N)correctly interpretsNas retries after the initial request and loops overrange(N + 1)._extract_facts_from_chunk, however, resolves the sameretain_llm_max_retries/llm_max_retriesvalue and uses it as an attempt count:When an operator deliberately configures
retain_llm_max_retries=0because an upstream gateway owns transport retries, Hindsight performs zero fact-extraction requests and raisesFact extraction failed after 0 attempts.The same setting is also passed to
llm_config.call(max_retries=llm_max_retries), so its meaning differs between the two nested layers.Expected behavior
A retry budget of zero must mean one initial request and no retry. Hindsight should preserve a single retry owner without skipping the operation.
Proposed focused fix
Use at least one outer attempt while preserving the configured transport retry value passed to the provider, and add regression coverage for
retain_llm_max_retries=0.A broader follow-up may want to separate content-quality attempts from transport retries explicitly, but the zero-budget behavior is a correctness bug on its own and blocks trusted gateway deployments.
I can submit the focused patch and test.