Skip to content

fix: make hindsight client timeout configurable via HINDSIGHT_TIMEOUT env var - #10045

Open
nightq wants to merge 4 commits into
NousResearch:mainfrom
nightq:fix/issue-9869-hindsight-timeout-v2
Open

fix: make hindsight client timeout configurable via HINDSIGHT_TIMEOUT env var#10045
nightq wants to merge 4 commits into
NousResearch:mainfrom
nightq:fix/issue-9869-hindsight-timeout-v2

Conversation

@nightq

@nightq nightq commented Apr 15, 2026

Copy link
Copy Markdown

Summary

Makes the Hindsight cloud client timeout configurable to prevent hindsight_reflect failures on longer operations.

Root Cause

The Hindsight cloud client was initialized with a hardcoded 30s timeout. The hindsight_reflect tool performs LLM synthesis across the memory graph, which routinely takes longer than 30 seconds. While _run_sync() has a 120s wrapper, the inner HTTP client timeout fires first.

Fix

Read timeout from HINDSIGHT_TIMEOUT env var with a default of 300s (matching other Hermes timeout defaults).

Test Plan

  • Existing hindsight tests pass
  • New tests verify default and env var override

Closes #9869

nightq added 4 commits April 15, 2026 11:41
Fixes NousResearch#9999

Root cause: _sanitize_api_messages compared raw tool_call_id strings
without stripping whitespace, causing valid tool results to be treated
as orphaned when IDs had leading/trailing spaces.
Fix: strip whitespace in _get_tool_call_id_static and when collecting
result_call_ids from tool messages.
Fixes NousResearch#9980

Root cause: _send_raw_message hardcoded 'chat_id' as receive_id_type,
causing [230001] invalid receive_id errors when sending to user open_ids
(prefix 'ou_') or union_ids (prefix 'on_').
Fix: Add _detect_receive_id_type() that checks ID prefix (oc_→chat_id,
ou_→open_id, on_→union_id) and use it in _send_raw_message.
Fixes NousResearch#9950

Root cause: Prompts discarded for having no reasoning were not added to
completed_in_batch, causing --resume to retry them indefinitely.
Fix: Append prompt_index to completed_in_batch before continuing past
the discard branch.
… env var

Fixes NousResearch#9869

Root cause: Hindsight cloud client had hardcoded 30s timeout, causing
hindsight_reflect to fail for longer operations.
Fix: Read timeout from HINDSIGHT_TIMEOUT env var with default of 300s.
@TeemuSailynoja

Copy link
Copy Markdown

This would be great! For now, I have told the agent to just retain and recall and avoid reflecting on anything 😆

Another issue I have noticed is that I tried to self-host Hindsight "the correct way" by having a separate Docker container serve the API and MCP, but the cloud and local options for the plugin didn't pair nicely with that. I managed to duct tape together a solution, but I think it's not a very elegant one.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins labels Apr 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #9985 — same fix: make Hindsight cloud client timeout configurable via HINDSIGHT_TIMEOUT env var (default 300s).

@nicoloboschi

Copy link
Copy Markdown
Contributor

HINDSIGHT_TIMEOUT env var support is already in main (used in __init__.py config loading and request paths). Could you close?

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the collection of fixes. The Hindsight timeout portion has already landed, consistent with the follow-up comment on this PR.

Problems

  • The Hindsight behavior is already implemented by 403c82b6b: current code reads configured HINDSIGHT_TIMEOUT at plugins/memory/hindsight/__init__.py:1257-1261, passes it to the client at :1056-1062, and uses it for _run_sync() at :1065-1067.
  • The batch and sanitizer fixes are already on main (6cdab7032 and fa3ab2ffd, respectively).
  • The Feishu hunk targets the removed gateway/platforms/feishu.py. The live routing is now plugins/platforms/feishu/adapter.py:4600-4651; it includes thread and feishu_user_id: handling absent from the old hunk.

Suggested changes

  • If on_ union IDs still need support, port that narrowly into the current adapter's receive-ID branch and add a request-construction regression test beside tests/gateway/test_feishu_meeting_invite.py:225-251.
  • Exclude the three already-merged fixes from salvage.

Automated hermes-sweeper review.

@alt-glitch alt-glitch added the duplicate This issue or pull request already exists label Jul 12, 2026
@alt-glitch

alt-glitch commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to merged #15077: the Hindsight timeout configuration is already on main, while this branch also carries independent/stale batch-runner, Feishu, and tool-call-ID changes. It needs a rebase and split for maintainer review; it is not a duplicate.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit area/memory Memory subsystem: store, providers, sync, background reviews labels Jul 12, 2026
@alt-glitch alt-glitch added comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint platform/feishu Feishu / Lark adapter needs-decision Awaiting maintainer decision before any implementation tool/memory Memory tool and memory providers and removed duplicate This issue or pull request already exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

The Hindsight timeout portion is already in merged #15077, while the Feishu edit targets a retired adapter path and other hunks are independent. Please rebase and split the residual work for review.

@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

The live branch bundles four unrelated fixes, including a retired Feishu gateway path. Please rebase and split the Hindsight timeout change from the Feishu, agent sanitizer, and batch-runner changes so the remaining current-main deltas can be reviewed.

@alt-glitch alt-glitch added comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels Jul 19, 2026
@alt-glitch alt-glitch added P3 Low — cosmetic, nice to have P2 Medium — degraded but workaround exists and removed P3 Low — cosmetic, nice to have P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

The live patch bundles Hindsight timeout configuration with unrelated Feishu delivery, run-agent, and batch-runner changes. Please split or rebase the remaining residual work before review.

@alt-glitch alt-glitch added P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades and removed comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists area/memory Memory subsystem: store, providers, sync, background reviews labels Jul 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

This branch mixes the Hindsight timeout change with Feishu, tool-call sanitizer, and batch-runner work. Current main already has a configurable Hindsight timeout and Feishu has moved to the plugin adapter; please rebase and split any remaining delta.

@alt-glitch alt-glitch removed the comp/gateway Gateway runner, session dispatch, delivery label Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/plugins Plugin system and bundled plugins needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Hindsight plugin hardcoded 30s timeout causes hindsight_reflect to fail

5 participants