3706 Commits
Author SHA1 Message Date
nanobot 298b7ac6f6 fix: use dedicated _shutting_down flag for cancel-time checkpoint restore
Test Suite / Detect changes (push) Has been cancelled
Test Suite / webui (push) Has been cancelled
Test Suite / docker (push) Has been cancelled
Test Suite / Python (Windows, 3.14) (push) Has been cancelled
Test Suite / Python (minimum, 3.11) (push) Has been cancelled
Test Suite / Python (latest, 3.14 + coverage) (push) Has been cancelled
The previous guard used self._running, which is False both before run()
starts and during shutdown. Tests and process_direct() dispatch messages
with _running=False, so cancelled turns there silently skipped the
checkpoint restore and lost partial context. Introduce _shutting_down,
set only by stop(), and gate the restore on it.
2026-07-31 15:49:31 +08:00
nanobot c7270b8d81 fix: prevent duplicate user message on session recovery re-publish
The re-published last user message was persisted into session history a
second time when the agent loop processed it, duplicating the user's
input. Mark the re-published InboundMessage with SKIP_USER_PERSIST_META
so should_persist_user_message() and _save_skip_for_turn() treat it as
already-persisted.
2026-07-31 15:37:41 +08:00
nanobot 66b8743024 docs: NixOS deployment guide from Camellia 2026-07-31 15:36:51 +08:00
nanobot 617a0129b7 Revert "docs: deployment guide from Camellia experience"
This reverts commit ded5d4d8ed.
2026-07-31 15:36:51 +08:00
nanobot 3b4eb40f1e docs: deployment guide from Camellia experience 2026-07-31 15:36:51 +08:00
nanobot 6b7f3889ea fix: raise error when Telegram bot not running instead of silently dropping messages
When the outbound dispatcher processes recovery notifications before the
Telegram bot is fully started, the send() method silently returned, causing
the notification to be lost. Now it raises RuntimeError so _send_with_retry
will retry until the bot is ready.
2026-07-31 15:36:51 +08:00
nanobot 9240000e75 fix: capture pending_user_turn before _restore_runtime_checkpoint clears it
_restore_runtime_checkpoint() clears both the runtime_checkpoint and
pending_user_turn flags (lines 1966-1967). recover_stale_sessions()
checked had_pending AFTER calling it, so had_pending was always False
when a checkpoint existed. This meant the re-publish of the last user
message never happened — the user got a notification but the interrupted
turn was never re-triggered.
2026-07-31 15:36:51 +08:00
nanobot 5248513ad1 feat: notify user and re-trigger interrupted turns on session recovery
recover_stale_sessions now publishes a restart notification to the user channel and re-publishes the last user message for sessions with a pending turn, so interrupted work continues automatically after a crash or restart. Also skip checkpoint restore during shutdown so pending markers survive for startup recovery.
2026-07-31 15:36:47 +08:00
nanobot a3bf5aee2d feat: retry channel startup on transient failures (max 5 attempts, exponential backoff)
Test Suite / Detect changes (push) Has been cancelled
Test Suite / Python (Windows, 3.14) (push) Has been cancelled
Test Suite / Python (minimum, 3.11) (push) Has been cancelled
Test Suite / Python (latest, 3.14 + coverage) (push) Has been cancelled
Test Suite / webui (push) Has been cancelled
Test Suite / docker (push) Has been cancelled
Previously, a single transient network error during channel startup
(e.g., proxy blip causing Telegram get_me() to fail) would leave the
channel permanently dead until the next gateway restart.

Now _start_channel retries up to 5 times with exponential backoff
starting at 2s (2s, 4s, 8s, 16s, 32s = ~62s total max wait).
2026-07-28 12:15:56 +08:00
nanobot 417e2f19d5 feat: add deploy/rollback supervisor script
Test Suite / Detect changes (push) Has been cancelled
Test Suite / Python (Windows, 3.14) (push) Has been cancelled
Test Suite / Python (minimum, 3.11) (push) Has been cancelled
Test Suite / Python (latest, 3.14 + coverage) (push) Has been cancelled
Test Suite / webui (push) Has been cancelled
Test Suite / docker (push) Has been cancelled
Git-checkout-based deployment with health checks and automatic rollback.
Usage: deploy.sh <commit> | deploy.sh rollback | deploy.sh status
2026-07-27 21:57:34 +08:00
nanobot 99b86a22c8 feat: recover stale sessions on gateway startup
Test Suite / Detect changes (push) Has been cancelled
Test Suite / Python (Windows, 3.14) (push) Has been cancelled
Test Suite / Python (minimum, 3.11) (push) Has been cancelled
Test Suite / Python (latest, 3.14 + coverage) (push) Has been cancelled
Test Suite / webui (push) Has been cancelled
Test Suite / docker (push) Has been cancelled
Scan all session files on startup and recover any with stale turn state
(pending_user_turn or runtime_checkpoint metadata) left from a previous
crash or restart. Previously this only happened lazily when a new message
arrived for the affected session.

- Add SessionManager.list_session_keys() to enumerate session keys from disk
- Add AgentLoop.recover_stale_sessions() to scan and recover all sessions
- Call recover_stale_sessions() during gateway startup in _run_gateway
2026-07-27 21:27:29 +08:00
chengyongruandchengyongru e819b7eea4 fix(webui): stabilize repeated model preset rows 2026-07-27 18:11:10 +08:00
chengyongruandchengyongru 3f808d0a68 docs: improve README discoverability 2026-07-27 15:57:03 +08:00
yu-xin-candXubin Ren 7fd28c9f06 fix(memory): preserve unprocessed dream history 2026-07-27 15:47:21 +08:00
chengyongruandGitHub c13df29457 feat(memory): restore Dream model preset override (#5107) 2026-07-27 14:43:25 +08:00
chengyongruandGitHub 281b4b7f0b chore: remove expired v0.3.1 compatibility shims (#5106) 2026-07-27 13:53:04 +08:00
chengyongruandchengyongru 39348dfafe refactor(agent): remove dead lifecycle scaffolding 2026-07-27 12:00:06 +08:00
chengyongruandXubin Ren b3d3a3e6c3 fix(image): delegate DNS to explicit proxy 2026-07-27 10:06:19 +08:00
chengyongruandXubin Ren d73794bc68 fix(image): honor provider proxy for URL downloads 2026-07-27 10:06:19 +08:00
Xubin Ren cc3dbbe804 fix(security): block IPv6 unspecified SSRF targets 2026-07-27 10:06:19 +08:00
Xubin Ren 4408cde019 fix(security): harden generated image downloads 2026-07-27 10:06:19 +08:00
Xubin Ren cf1e801a29 fix(image): align Gemini hints with model capabilities 2026-07-27 03:07:41 +08:00
Xubin Ren a8604a3172 fix(image): scope Gemini image sizes by model 2026-07-27 03:07:41 +08:00
ef445cc246 fix(image): narrow Gemini Flash aspect-ratio and image-size scoping
Address review feedback that the capability checks were broader than the
documented per-model matrix:

- Drop the extreme aspect ratios (1:4, 4:1, 1:8, 8:1) from the Flash
  allow-list. They are only documented for 3.1 Flash / Flash Lite, so the
  global set could send an unsupported ratio to 2.5 Flash Image or 3.1 Pro
  Image. Keep the ratios common to every Flash image model.
- Identify imageSize support positively via "gemini-3" instead of excluding
  "2.5". The old predicate also matched gemini-2.0-flash-preview-image-
  generation, which (with the default 1K size) altered that model's request
  shape even though only Gemini 3+ image models accept a configurable size.

Add tests for the gemini-2.0 image-size drop and the extreme-ratio drop.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 03:07:41 +08:00
4986590bd7 fix(image): pass aspect ratio and size to Gemini Flash image models
The Gemini Flash image path (`generateContent`) dropped both `aspect_ratio`
and `image_size`: `generate()` never forwarded them and
`_generate_gemini_flash` did not accept them, so every request fell back to
1:1 / input-matched output. The Imagen path was unaffected.

Forward the hints and emit them under
`generationConfig.responseFormat.image` per the current Gemini API. Aspect
ratio is validated against the accepted set; `imageSize` is validated against
{512,1K,2K,4K} and only sent to Gemini 3+ image models, since
`gemini-2.5-flash-image` supports only `aspectRatio`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 03:07:41 +08:00
Xubin Ren b695a7e875 fix(cli): harden quick start OAuth handling 2026-07-27 02:51:04 +08:00
Xubin Ren a4ec83fb0d fix(cli): scope Codex proxy env resolution 2026-07-27 02:51:04 +08:00
chengyongruandXubin Ren 2a1f840ce2 fix(cli): support Codex OAuth in quick start 2026-07-27 02:51:04 +08:00
Xubin Ren addaf2d3fc fix(dingtalk): harden group reply sender labels 2026-07-27 02:33:41 +08:00
9f3dee0192 docs(dingtalk): clarify disable_private_chat intent in comments
Addresses automated review: document that the guard is an intentional hard group-only switch (allowlisted DMs blocked by design) and that str() guards a None sender_id. Comment-only.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-27 02:33:41 +08:00
205889f9e0 feat(dingtalk): prefix group replies with sender mention
In group chats, prefix the outbound markdown reply with an H1 naming the sender (# @<nick>) so the addressed user can spot it in a busy group. Private replies are sent verbatim.

Visual only: DingTalk markdown robot messages do not push real @ notifications (that would require staffId plumbing and a different message type). sender_name is read from OutboundMessage.metadata, which the agent loop already propagates from inbound metadata.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-27 02:33:41 +08:00
14e692e40d feat(dingtalk): add disable_private_chat to reject 1:1 DMs
Add a `disable_private_chat` config flag (JSON alias `disablePrivateChat`,
default False) to the DingTalk channel. When enabled, any non-group (1:1)
message is rejected with a Chinese notice directing the user to group chat
("该机器人未开启私聊,请在群聊中与我对话。") before permission/pairing logic
runs, so even allowlisted senders are redirected. Group messages are
unaffected.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-27 02:33:41 +08:00
Xubin Ren 68717937e8 fix(agent): throttle idle scans by default 2026-07-27 02:15:48 +08:00
Andrew KhmylovandXubin Ren 7aab7e8830 feat(agent): make idle compaction scan interval configurable
Before this change, idle compaction is triggered every 1 second
if the incoming message stream is idle.
When triggered, it enumerates all session files, loads and parses them,
and then checks their expiration.

This becomes too CPU-intensive, especially on low-power devices like Raspberry Pi.
It's unlikely that you actually need to compact every second over the long time.

This change adds a configurable throttling for idle-compaction.

Default behavior is unchanged.
2026-07-27 02:15:48 +08:00
Xubin Ren 4e2640f2d2 fix(memory): keep failed Dream batches retryable 2026-07-27 02:00:41 +08:00
shixi-liandXubin Ren 15e42059bd fix(memory): progress past completed no-op batches 2026-07-27 02:00:41 +08:00
Xubin Ren b55b76d755 fix(streaming): preserve recovered segments across channels 2026-07-27 01:39:46 +08:00
chengyongruandXubin Ren e6baecafcd fix(agent): close length recovery lifecycle gaps 2026-07-27 01:39:46 +08:00
chengyongruandXubin Ren 27a00c7a4f fix(webui): merge length recovery stream segments 2026-07-27 01:39:46 +08:00
chengyongruandXubin Ren 3cc5a98d9f refactor(agent): derive recovery count from segments 2026-07-27 01:39:46 +08:00
chengyongruandXubin Ren 1d2ed6e4d2 fix(agent): reset recovery chains across injections
Reset both the recovered segments and retry budget whenever injected input starts a new logical answer. Cover fatal tool-error boundaries and rename the prompt test module so pytest can collect the full suite.
2026-07-27 01:39:46 +08:00
chengyongruandXubin Ren 154cbc1974 refactor(agent): trim recovery tail anchor 2026-07-27 01:39:46 +08:00
chengyongruandXubin Ren df2e5b7225 fix(agent): anchor truncated response continuations 2026-07-27 01:39:46 +08:00
chengyongruandXubin Ren b19039f9d0 fix(agent): preserve length-recovered output 2026-07-27 01:39:46 +08:00
Xubin Ren c1899e2cb4 fix(mcp): decode URI-encoded schema refs 2026-07-27 01:14:41 +08:00
amplifierplusandXubin Ren 9aae7485d6 fix(mcp): normalize local schema refs 2026-07-27 01:14:41 +08:00
chengyongruandXubin Ren 2e2f15dd0c fix(channels): serialize Feishu connect completion 2026-07-27 01:00:12 +08:00
KDBandXubin Ren 4835814746 fix(channels): ignore confirmations after connect cancellation 2026-07-27 01:00:12 +08:00
Xubin Ren d236883e2d fix(pairing): reject malformed store entries 2026-07-27 00:46:40 +08:00
santhrealandXubin Ren f7bf4c972e fix(pairing): treat null approved/pending maps as empty 2026-07-27 00:46:40 +08:00