fix(session-buffer): wire session_buffer_search into agent loop dispatch — closes #2667#3465
Open
Mibayy wants to merge 14 commits into
Open
fix(session-buffer): wire session_buffer_search into agent loop dispatch — closes #2667#3465Mibayy wants to merge 14 commits into
Mibayy wants to merge 14 commits into
Conversation
Adds three tools for querying a self-hosted OpenViking server: - viking_search: semantic search over memories, resources, and skills (auto/fast/deep modes) - viking_read: read content at a viking:// URI with configurable detail levels (abstract / overview / read) - viking_browse: explore the OpenViking filesystem layout (tree/list/stat) All tools are gated behind check_fn that verifies the server is reachable, so they are silently absent when OpenViking is not running — same pattern as Honcho. The 'openviking' named toolset is also added to TOOLSETS and to the shared tools list so gateway and CLI pick them up automatically. Configure via: OPENVIKING_ENDPOINT (default: http://127.0.0.1:1933) OPENVIKING_API_KEY (optional, for secured deployments) Closes NousResearch#3368
/model was fully implemented in hermes_cli/model_switch.py and hermes_cli/main.py but was never registered in COMMAND_REGISTRY, causing it to be absent from /help output and Telegram bot commands. Fixes NousResearch#3371
…ceful no-op without structured memory
…nject skill content in child system prompt
…ic cache, detailed trace, opt-in checkpointing
- delegate_dag: deque.popleft() replaces queue.pop(0) -- O(1) vs O(n)
- delegate_checkpoint: single persistent conn + threading.Lock, WAL mode
- delegate_tool: _CRITIC_MAX_SUMMARY_CHARS constant, critic toolsets=[],
debug log on skill miss, key.replace('_',' ').title() for unknown keys,
blackboard comment
- openviking_tool: try/except on r.json() in search and read paths
- Remove docs/plans/subagent-v2-*.md planning artifacts, gitignore them
…tch paths The compressed_buffer table, FTS5 index, SessionDB methods, and tool schema were all in place but session_buffer_search was never wired into the agent loop's special-case dispatch (it fell through to handle_function_call which lacks db/current_session_id context). Changes: - Add session_buffer_search special case to _execute_tool_calls_sequential (sequential path in run_agent.py) — mirrors the session_search pattern - Add session_buffer_search special case to _invoke_tool (concurrent path) - Add tests/tools/test_session_buffer_search.py — 36 tests covering archive_compressed_messages, search_compressed_buffer, get_compressed_buffer_count, clear_compressed_buffer, the tool function, schema validation, and parent-chain resolution Closes NousResearch#2667
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the mid-session forgetfulness gap described in #2667.
The infrastructure for this feature was almost complete —
compressed_buffertable with FTS5,SessionDBmethods (archive_compressed_messages,search_compressed_buffer,get_compressed_buffer_count,clear_compressed_buffer), thesession_buffer_searchtool schema and registration, and the buffer population hook in_compress_contextwere all already merged. The missing piece was wiringsession_buffer_searchinto the agent loop's special-case dispatch so it receivesdbandcurrent_session_id.Root Cause
session_buffer_searchwas falling through tohandle_function_call→registry.dispatch(), which doesn't receivedborcurrent_session_idas kwargs. Without those, every call returned{"success": false, "error": "Session database not available."}even when the DB was fully available.Changes
run_agent.py— two dispatch sites, both now handlesession_buffer_search:_execute_tool_calls_sequential(sequential path) — newelif function_name == "session_buffer_search"block, mirroring thesession_searchpattern_invoke_tool(concurrent/_execute_tool_calls_concurrentpath) — same blocktests/tools/test_session_buffer_search.py(new, 36 tests):TestArchiveCompressedMessages— skips system/empty/pruned, counts correctlyTestGetCompressedBufferCount— zero init, after archive, session scopingTestSearchCompressedBuffer— FTS5 match, no match, session scoping, role filter, limitTestClearCompressedBuffer— removes entries, doesn't affect other sessionsTestSessionBufferSearchTool— no-db error, no-session error, stats mode, search, parent-chain walk, limit cap, result fieldsTestSessionBufferSearchSchema— schema name, description, required fieldsTestResolveRootSessionId— root, child, grandchild, unknown sessionHow it works end-to-end
_compress_contextcallsdb.archive_compressed_messages(root_session_id, messages_being_dropped)— this was already wiredcompressed_buffer_fts(FTS5) via a triggersession_buffer_search("Tavily"), the new dispatch path injectsdb=self._session_dbandcurrent_session_id=self.session_idparent_session_idchain) and runs an FTS5 query scoped to that root — finding content from any compression round of the current conversationCloses #2667