Commit Graph
270 Commits
Author SHA1 Message Date
Xubin Ren ca5047b602 feat(web): multi-provider web search + Jina Reader fetch 2026-03-13 05:44:16 +00:00
Xubin Ren 6d3a0ab6c9 fix(memory): validate save_memory payload and raw-archive on repeated failure
- Require both history_entry and memory_update, reject null/empty values
- Fallback to tool_choice=auto when provider rejects forced function call
- After 3 consecutive consolidation failures, raw-archive messages to
  HISTORY.md without LLM summarization to prevent context window overflow
2026-03-13 03:53:50 +00:00
Xubin Ren 60c29702cc Merge branch 'main' into pr-1810
# Conflicts:
#	nanobot/agent/memory.py
#	tests/test_memory_consolidation_types.py
2026-03-13 03:29:16 +00:00
Xubin RenandGitHub 62a2e71748 Merge PR #1958: fix(restart): use -m nanobot for Windows compatibility
fix(restart): use -m nanobot for Windows compatibility
2026-03-13 11:19:57 +08:00
Xubin Ren 4f77b9385c fix(memory): fallback to tool_choice=auto when provider rejects forced function call
Some providers (e.g. Dashscope in thinking mode) reject object-style
tool_choice with "does not support being set to required or object".
Retry once with tool_choice="auto" instead of failing silently.

Made-with: Cursor
2026-03-13 03:18:08 +00:00
chengyongru 6ad30f12f5 fix(restart): use -m nanobot for Windows compatibility
On Windows, sys.argv[0] may be just "nanobot" without full path when
running from PATH. os.execv() doesn't search PATH, causing restart to
fail with "No such file or directory".

Fix by using `python -m nanobot` instead of relying on sys.argv[0].

Fixes #1937
2026-03-13 11:01:01 +08:00
chengyongru 127ac39063 fix: catch BaseException in MCP connection to handle CancelledError 2026-03-13 10:23:15 +08:00
Re-bin 774452795b fix(memory): use explicit function name in tool_choice for DashScope compatibility 2026-03-12 16:09:24 +00:00
Re-bin 64aeeceed0 Add /restart command: restart the bot process from any channel 2026-03-12 04:33:51 +00:00
Re-bin 231b02963d Merge branch 'main' into pr-1751
Made-with: Cursor

# Conflicts:
#	nanobot/agent/loop.py
2026-03-12 03:53:59 +00:00
Re-bin 0a0017ff45 fix: raise tool result history limit to 16k and force save_memory in consolidation 2026-03-12 03:08:53 +00:00
Re-bin 35260ca157 fix: raise persisted tool result limit to 16k 2026-03-12 02:50:28 +00:00
Re-bin 0d94211a93 enhance: improve filesystem & shell tools with pagination, fallback matching, and smarter output 2026-03-11 16:20:11 +00:00
Re-bin 9d0db072a3 fix: guard quoted home paths in shell tool 2026-03-11 15:43:04 +00:00
Re-bin 85609c99b3 Merge remote-tracking branch 'origin/main' into pr-1827 2026-03-11 15:32:52 +00:00
Re-bin 9fc74bde9a Merge remote-tracking branch 'origin/main' into pr-1874 2026-03-11 15:26:39 +00:00
Re-bin c72c2ce7e2 refactor: move generation settings to provider level, eliminate parameter passthrough 2026-03-11 09:47:04 +00:00
WhalerO 6ef7ab53d0 refactor: centralize tool call serialization in ToolCallRequest 2026-03-11 15:32:43 +08:00
WhalerO ed82f95f0c fix: preserve provider-specific tool call metadata for Gemini 2026-03-11 15:32:26 +08:00
ethanclaw 12104c8d46 fix(memory): pass temperature, max_tokens and reasoning_effort to memory consolidation
Fix issue #1823: Memory consolidation does not inherit agent temperature
and maxTokens configuration.

The agent's configured generation parameters were not being passed through
to the memory consolidation call, causing it to fall back to default values.
This resulted in the consolidation response being truncated before the
save_memory tool call was emitted.

- Pass temperature, max_tokens, reasoning_effort from AgentLoop to
  MemoryConsolidator and then to MemoryStore.consolidate()
- Forward these parameters to the provider.chat_with_retry() call

Fixes #1823
2026-03-11 14:22:33 +08:00
Re-bin ddccf25bb1 fix(subagent): preserve reasoning fields across tool turns
Share assistant message construction between the main agent and subagents, and add a regression test to keep reasoning_content and thinking_blocks in follow-up tool rounds.
2026-03-11 03:47:24 +00:00
Re-bin 1d611f9bf3 Merge remote-tracking branch 'origin/main' into pr-1848 2026-03-11 03:42:14 +00:00
Re-bin 62ccda43b9 refactor(memory): switch consolidation to token-based context windows
Move consolidation policy into MemoryConsolidator, keep backward compatibility for legacy config, and compress history by token budget instead of message count.
2026-03-10 19:55:06 +00:00
Re-bin 4784eb4128 merge origin/main into pr-1704 2026-03-10 18:09:15 +00:00
lailoo 2ffeb9295b fix(subagent): preserve reasoning_content in assistant messages
Subagent's _run_subagent() was dropping reasoning_content and
thinking_blocks when building assistant messages for the conversation
history. Providers like Deepseek Reasoner require reasoning_content on
every assistant message when thinking mode is active, causing a 400
BadRequestError on the second LLM round-trip.

Align with the main AgentLoop which already preserves these fields via
ContextBuilder.add_assistant_message().

Closes #1834
2026-03-11 00:47:09 +08:00
Re-bin b0a5435b87 refactor(llm): share transient retry across agent paths 2026-03-10 10:10:37 +00:00
Re-bin 46b31ce7e7 Merge remote-tracking branch 'origin/main' into pr-1512 2026-03-10 09:40:48 +00:00
suger-m 6c70154fee fix(exec): enforce workspace guard for home-expanded paths 2026-03-10 15:55:04 +08:00
shenchengtsi b24d6ffc94 fix(memory): validate save_memory payload before persisting 2026-03-10 11:32:11 +08:00
Renato Machado 85c56d7410 feat: add "restart" command 2026-03-09 01:37:35 +00:00
Re-bin 4715321319 Merge branch 'main' into pr-1579 and tighten platform guidance 2026-03-08 16:39:37 +00:00
Re-bin ce9b516b11 Merge branch 'main' into pr-1579 2026-03-08 16:29:54 +00:00
Re-bin 5eb67facff Merge branch 'main' into pr-1728 and harden MCP tool cancellation handling 2026-03-08 16:01:06 +00:00
Re-bin 4e197dc18e Merge branch 'main' into pr-1728 2026-03-08 15:51:06 +00:00
Re-bin 7cbb254a8e fix: remove stale IDENTITY bootstrap entry 2026-03-08 15:39:40 +00:00
Alfredo ArenasandGitHub ed3b9c16f9 fix: handle CancelledError in MCP tool calls to prevent process crash
MCP SDK's anyio cancel scopes can leak CancelledError on timeout or
failure paths. Since CancelledError is a BaseException (not Exception),
it escapes both MCPToolWrapper.execute() and ToolRegistry.execute(),
crashing the agent loop.

Now catches CancelledError and returns a graceful error to the LLM,
while still re-raising genuine task cancellations from /stop.
Also catches general Exception for other MCP failures (connection
drops, invalid responses, etc.).

Related: #1055
2026-03-08 08:05:18 -06:00
VITOHJL 274edc5451 fix(compression): prefer provider prompt token usage 2026-03-08 17:25:59 +08:00
VITOHJL 1b16d48390 fix(loop): update _cumulative_tokens in _save_turn and preserve it in compression methods 2026-03-08 15:26:49 +08:00
VITOHJL a984e0df37 feat(loop): add history message count logging in compression 2026-03-08 15:23:55 +08:00
VITOHJL dbc518098e refactor: implement token-based context compression mechanism
Major changes:
- Replace message-count-based memory window with token-budget-based compression
- Add max_tokens_input, compression_start_ratio, compression_target_ratio config
- Implement _maybe_compress_history() that triggers based on prompt token usage
- Use _build_compressed_history_view() to provide compressed history to LLM
- Refactor MemoryStore.consolidate() -> consolidate_chunk() for chunk-based compression
- Remove last_consolidated from Session, use _compressed_until metadata instead
- Add background compression scheduling to avoid blocking message processing

Key improvements:
- Compression now based on actual token usage, not arbitrary message counts
- Better handling of long conversations with large context windows
- Non-destructive compression: old messages remain in session, but excluded from prompt
- Automatic compression when history exceeds configured token thresholds
2026-03-08 14:20:16 +08:00
Re-bin 515b3588af Merge main into pr-1482 2026-03-07 15:33:24 +00:00
Re-bin 43fc59da00 fix: hide internal reasoning in progress 2026-03-07 14:53:14 +00:00
VITOHJL cf76011c1a fix: hide reasoning_content from user progress updates 2026-03-07 17:09:59 +08:00
Re-bin c3f2d1b01d fix(tools): narrow parameter auto-casting 2026-03-07 05:28:12 +00:00
Barry WangandGitHub 81a8a1be1e Merge branch 'HKUDS:main' into feat/improve-tool-validation-tests 2026-03-06 15:42:26 +08:00
Re-bin 3a01fe536a refactor: move detect_image_mime to utils/helpers for reuse 2026-03-06 06:49:09 +00:00
Re-bin 91b3ccee96 Merge remote-tracking branch 'origin/main' into pr-1573 2026-03-06 06:41:00 +00:00
Re-bin fc0b38c304 fix(memory): improve warning message for empty/non-dict list arguments 2026-03-06 05:27:39 +00:00
nanobot-contributor 6fb4204ac6 fix(memory): handle list type tool call arguments
Some LLM providers return tool_calls[0].arguments as a list instead of
dict or str. Add handling to extract the first dict element from the list.

Fixes /new command warning: 'unexpected arguments type list'
2026-03-06 11:47:00 +08:00
VITOHJL 958c23fb01 chore: refine platform policy and memory SKILL docs 2026-03-05 23:57:43 +08:00