39 Commits
Author SHA1 Message Date
Wei Chengqian f13363afec fix: attach Gemini tool images to their function responses (#11424)
* fix(gemini): attach tool images to their function responses

* test: simplify Gemini tool image ownership regression
2026-11-27 22:12:32 +08:00
Soulter 57415b79e0 fix(agent): interrupt model generation on steer (#11384)
* fix(agent): interrupt model generation on steer

* fix(agent): prompt for a brief steering update

* fix(agent): shorten the steering reminder
2026-11-26 17:02:38 +08:00
Soulter 9f0334f6d5 refactor: make plugin locale and agent session lookups async (#11355)
* refactor: make plugin locale and agent session lookups async

* test: remove standalone locale lookup test
2026-11-24 22:10:11 +08:00
100yoGranny 6f376c5b04 fix(context): truncate history by complete user turns (#11316)
* fix(context): truncate history by complete user turns

* fix(context): preserve internal turn boundaries
2026-11-24 18:09:22 +08:00
Sha1rholder 24b7f903ea fix: CI broken by #11254 (#11260) 2026-11-19 17:39:21 +08:00
Soulter 456217fc52 feat: background pending tools when steering arrives (#11142)
* fix: append steering input as user messages

* fix: group steering input into one user message

* feat: detach pending tools on steering and wake on completion

* fix: continue pending steering after plain replies

* test: decode prepared media file URIs on Windows

* fix: preserve whitespace in steering input

* fix: separate batched steering inputs with newlines

* docs: remove verbose steering implementation details

* fix: preserve Gemini user agents and verify background delivery

* fix: honor realtime segmented replies in QQ group chats

* revert: keep QQ streaming changes out of this PR

* test: align plugin page expectations with view metadata

* fix: preserve background tool permissions and result handling

* fix: retain wakeup ownership and initialize context before appending

* fix: combine background wakeup input into one user message

* test: remove redundant background wakeup coverage

* fix: relax background completion prompt restrictions

* fix: simplify background completion prompt
2026-11-18 11:13:21 +08:00
Soulter 303a702a00 fix: persist assistant tool calls before execution (#11162) 2026-11-15 22:58:18 +08:00
Soulter d978ee29e0 refactor: persist model usage with assistant messages (#11158)
* refactor: persist model usage with assistant messages

* refactor: remove unused provider request recorders
2026-11-15 21:11:42 +08:00
Soulter 133dd9f86f fix: append steering input as user messages (#11141)
* fix: append steering input as user messages

* fix: group steering input into one user message

* fix: continue pending steering after plain replies

* test: decode prepared media file URIs on Windows

* fix: preserve whitespace in steering input

* fix: separate batched steering inputs with newlines

* docs: remove verbose steering implementation details
2026-11-15 18:21:42 +08:00
Soulter 863e675582 feat: expose prepared agent outputs and honor delivery policy (#11153)
* feat: expose prepared agent outputs and honor delivery policy

* fix: honor turn delivery policy in built-in media tools

* test: keep agent output regression coverage minimal

* docs: trim agent delivery policy explanation

* docs: simplify agent output usage guide
2026-11-15 13:02:50 +08:00
Soulter c5ec2392eb refactor: migration to event log backend for conversation storage (#10077)
* stage

* refactor: linearize conversation events and reclaim plugin snapshots

* test: adapt master tests to event-context APIs after merge

- test_tool_loop_agent_runner: restore @pytest.mark.asyncio on
  test_step_notices_reach_model_once_per_threshold (lost in merge).
- test_cron_manager: give the build_main_agent / runner mocks the
  conversation_events field and an awaitable aclose, matching the
  event-writer wiring in cron/manager.py.

* style: apply ruff formatting to exclude_ids filter in sqlite.py

* test: adapt gemini/message-tools tests to event-context APIs

- test_gemini_source: fake_retry now accepts request_event_recorder,
  matching retry_provider_request's new keyword argument.
- test_message_tools: _DummyRespondEvent exposes conversation_events,
  which call_event_hook now reads when emitting the after-send hook.

* fix: merge duplicate chat history translations

* refactor: consolidate plugin conversation APIs

* refactor: bind conversation writers to agent execution context

* refactor: separate conversation migration and display projection

Remove deprecated conversation metadata methods and align architecture and plugin documentation with the current APIs.

* refactor: make conversation writer ownership explicit

Use per-run hooks instead of ambient writer and plugin identity bindings. Require explicit conversation IDs for append APIs and separate persistence from execution context mutation.

* fix: harden conversation event writes and request capture

* refactor: remove legacy checkpoints and unify conversation history

* perf: incrementally project acknowledged conversation events

* refactor: clarify agent event and persistence boundaries

* docs: remove event context design notes

* perf: reduce conversation SQL round trips and support PostgreSQL

* refactor: remove PostgreSQL support while retaining SQL optimizations

* refactor: store raw context once and filter temporary content on replay

* test: retain essential event context regression coverage

* refactor: derive conversation revisions from events

Remove persisted event head, context leaf and replay baseline pointers. Derive positions through indexed queries, migrate existing databases and preserve backup compatibility. Refresh conversation activity at turn settlement instead of every execution event.

* refactor: use compact IDs for conversation events
2026-11-14 23:46:45 +08:00
Soulter 6a782b7be6 refactor: run built-in agents through runtime sessions (#11052) 2026-11-09 09:48:25 +08:00
Soulter 2e35670a0c refactor: reorganize built-in agent modules (#11051) 2026-11-09 09:47:49 +08:00
Soulter e9879c55fb refactor: unify main agent construction and wakeup execution (#10934)
* refactor: centralize main agent construction by feature

* fix: unify agent wakeups without rewriting conversation context

* refactor: introduce generic agent wakeup events

* fix: require a valid target UMO for agent wakeups

* refactor: route agent wakeups through the message pipeline

* test: trim duplicate main agent and wakeup coverage
2026-11-01 23:40:53 +08:00
Soulter 3c149fed76 feat: add agent step budget reminders and migrate legacy limits (#10133)
* feat: add agent step budget reminders and migrate legacy limits

* docs: leave configuration reference unchanged
2026-09-19 12:13:17 +08:00
若月千鸮 0f445f5eff fix(agent): deliver skills-like fallback replies when streaming (#10025)
* fix(agent): deliver skills-like fallback replies when streaming

* fix(agent): limit fallback fix to missing streaming events
2026-09-10 23:34:33 +08:00
wangyuxy9805-webandwangyuxy9805-web 1fc3d33455 fix: preserve context prefix during tool requery (#9957)
Co-authored-by: wangyuxy9805-web <319040411+wangyuxy9805-web@users.noreply.github.com>
2026-09-06 18:48:55 +08:00
mrlonely a436456d42 fix: stop empty LLM requests before provider dispatch (#9815) 2026-08-26 20:50:07 +08:00
Soulter 30e20318cb fix: cancel stopped agent runs immediately (#9602)
* fix: cancel stopped agent runs immediately

* refactor: simplify stopped run history
2026-08-08 17:10:04 +08:00
Soulterandgemini-code-assist[bot] b9c5a1f248 perf: detect repeated tool calls by name and arguments (#9311)
* fix: detect repeated tool calls by name and arguments

* Update tests/test_tool_loop_agent_runner.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-07-18 18:21:32 +08:00
Haoran Xu 8f6a8fad24 feat: stream agent stats after each LLM call (#9260) 2026-07-15 15:31:45 +08:00
Haoran Xu cc0ec5e5c5 fix: report current context usage in token indicator (#9255) 2026-07-13 21:21:17 +08:00
C₂₂H₂₅NO₆andC₂₂H₂₅NO₆ 4b097011cf fix(core): Fix image delivery to the model by treating empty modalities as unconfigured (#8451)
* fix(core): 将空 list modalities 视为未配置,修复图片无法传递到模型的问题

migra_helper 将未配置的 modalities 迁移为空 list [],而新增的
_provider_supports_modality()、_assemble_request_context_for_provider()、
_should_fix_modalities_for_provider()、_func_tool_for_provider() 四个函数
对 [] 和 None 的处理不一致,导致所有未在 WebUI 手动配置 modalities 的
provider 无法传递图片、引用图片被跳过、工具被错误清除。

修改策略:将 [] 与 None 统一视为未配置状态,保持向后兼容。
仅在 modalities 为非空 list 时才启用过滤和修复逻辑。

- _provider_supports_modality: [] 返回 True,默认支持
- _assemble_request_context_for_provider: [] 不过滤图片
- _should_fix_modalities_for_provider: [] 不触发历史上下文修复
- _func_tool_for_provider: [] 不清除工具

复现脚本已确认 Bug 不再复现,82 个相关单元测试全部通过。

* fix(core): 补充修复 tool loop 中 cached images 的 modalities 判断

上一笔 commit 遗漏了 tool_loop_agent_runner.py 第 917 行对
cached images 的 modalities 检查,当 modalities=[] 时,tool call
返回的图片不会被追加到消息中,导致模型看不到 tool 结果中的图片。

修复方式与主修复一致:not modalities or image in modalities

复现脚本和 82 个单元测试全部通过。

* test: 补充 fake_save_image mock 缺少的 mime_type 字段

修复 modalities=[] 导致 cached images 分支变为可达后,暴露
了 test_tool_result_includes_all_calltoolresult_content 中
fake_save_image mock 不完整的问题:返回的 SimpleNamespace
缺少 mime_type 属性,而实际 tool_image_cache.save_image()
始终包含该字段。

---------

Co-authored-by: C₂₂H₂₅NO₆ <Sisyphbaous-DT-Project@users.noreply.github.com>
2026-06-02 08:53:59 +08:00
95d80578bf refactor(ltm): redesign long-term memory with context compaction (reopen of #8144) (#8226)
* refactor(ltm): redesign long-term memory with context compaction

- Add raw_records / contexts / summaries data model per group
- Add LLM summary compaction strategy alongside truncation
- Add turn-based (_split_into_rounds) granularity
- Add image caption integration into LTM history
- Add tool_call / tool_result persistence into raw_records
- Add active reply support driven by LTM state
- Improve summary injection prefix with system note and delimiters
- Add info-level logging for summary compaction lifecycle
- Clarify default summary prompt with explicit preserve/drop rules
- Add context_guard for history overflow protection in agent runner
- Add internal agent history compaction in agent_sub_stages
- Add comprehensive LTM unit tests and compaction test suites

* fix(ltm): handle malformed JSON in tool args and clean up lock on session removal

* fix(ltm): guard against duplicate system prompt note injection

* fix(ltm): fall back to user message when internal marker parsing fails

- Treat lines starting with <T:CALL>, <T:RES, or <BOT/ as regular user
  messages when their respective parsers return None, instead of silently
  dropping them. Defensive guard against malformed internal markers.

* fix(ltm): release session lock during LLM summary generation

* fix(ltm): trim raw_records in handle_message to prevent unbounded growth

* perf(ltm): use len(s) instead of len(s.encode()) in trim loop

Avoid allocating a new bytes object for every string when calculating
buffer size in _trim_raw_records. Character count is sufficient for
the approximate memory cap.

* feat(ltm): make user segment truncation limits configurable

* feat(ltm): pre-fill default LTM summary prompt in config and i18n

* refactor(ltm): hardcode internal segment/trim constants

* refactor(ltm): unify compaction strategy with main agent runner

* feat(ltm): add @mention weight marker for group chat messages

* test: fix test failures from LTM compaction unification

* chore(dashboard): remove obsolete LTM compaction i18n metadata

* chore: shrink codebase

* feat(group-chat): implement group chat context management and related functionality

---------

Co-authored-by: Tsukumi <112180165+Tsukumi233@users.noreply.github.com>
Co-authored-by: zenfun <zenfun510@gmail.com>
Co-authored-by: Soulter <905617992@qq.com>
2026-05-30 17:16:36 +08:00
Soulter e6b68e9b09 perf: update FileReadTool description to mention image, PDF and docx support, and enhance modality checking in tool result case (#7506)
* feat: update FileReadTool description to mention image and PDF support

Add explicit mention of image (OCR) and PDF (text extraction) support
to the FileReadTool description for better discoverability.

* feat: update FileReadTool description to include support for docx and epub files; change base64 decoding to utf-8

* feat: enhance ToolLoopAgentRunner to support image and audio modalities; add context sanitization logic
2026-04-22 11:38:40 +08:00
Soulter 2472a12671 feat: filesystem grep, read, write, edit file and workspace support (#7402)
* feat: filesystem grep, read, edit file

* feat: add file write tool and enhance file read functionality

* feat: enhance tool prompt formatting and add escaped text decoding for file editing

* feat: remove redundant safe path tests from security restrictions

* feat: implement file read tool with support for text and image files, including validation for large files

* feat: add file read utilities and integrate with filesystem tools

* refactor: move computer tools to builtin tools registry

* refactor: remove unused plugin_context parameter from _apply_sandbox_tools

* feat: supports to display enabled builtin tools in configs

* feat: add tooltip for disabled builtin tools and update localization strings

* feat: add workspace extra prompt handling in message processing

* feat: add ripgrep installation to Dockerfile

* perf: shell executed in workspace dir in local env

* feat: enhance file reading capabilities to support PDF and DOCX parsing, including workspace storage for long documents

* feat: update converted text notice to suggest using grep for large files

* feat: implement handling for large tool results with overflow file writing and read tool integration

* fix: test

* feat: enhance onboarding steps to include computer access configuration and related help information

* feat: add support for additional temporary path in restricted environment checks

* feat: update computer access hints and add detailed configuration instructions
2026-04-11 17:01:54 +08:00
Soulter 8c6c00ae62 fix: update tool result assertions to reflect dynamic threshold values 2026-04-06 18:37:52 +08:00
Soulter 571b571e7e feat: implement llm guidance for repetition tool call (#7388)
* feat: implement llm guidance for repetition tool call

fixes: #7387

* feat: enhance tool execution guidance with user interruption and repetition notices

* chore: fix test

* feat: rename guidance method for repeated tool calls to improve clarity

* feat: update repeated tool notice thresholds to improve user guidance
2026-04-06 16:31:59 +08:00
Soulter 551c956107 feat: implement EmptyModelOutputError for handling empty responses across providers and enhance retry logic in ToolLoopAgentRunner (#7104)
closes: #7044
2026-03-29 00:03:05 +08:00
FrankandSoulter 1879e5961d fix: keep all CallToolResult content items (#6149)
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
2026-03-22 17:21:22 +08:00
Ruochen Pan 554c9cecfa feat: fix preserve escaped newlines in frontmatter & update tests & ci workflows (#6783) 2026-03-22 14:23:21 +08:00
Yufeng HeandSoulter 7beab796bb fix: skills-like re-query missing extra_user_content_parts causes image_caption not to be injected (#6710)
当使用 skills-like tool mode 时,_resolve_tool_exec 的 re-query 调用没有
传递 extra_user_content_parts,导致图片描述等附加内容丢失。

fixes #6702

Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
2026-03-21 01:11:34 +08:00
b2797b6f16 fix(agent): reject follow-up messages after stop request (#6704)
* fix: reject follow-up messages after stop requested (#6626)

Once a user sends /stop, follow-up messages should no longer be
accepted for that runner. Previously, there was a race window where
messages sent after stop could still be queued as follow-ups.

This fix gates the follow_up() method to check both done() and
_stop_requested before accepting a new follow-up message.

Acceptance criteria met:
- After /stop, later follow-up messages return None (rejected)
- Post-stop follow-ups are not added to _pending_follow_ups
- No post-stop text is injected into tool results
- Graceful-stop behavior otherwise unchanged
- Follow-ups submitted before stop retain current behavior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add regression tests for issue #6626 follow-up rejection

Add focused tests that verify the complete tool-result injection path
for follow-up messages after stop is requested:

- test_follow_up_rejected_and_runner_stops_without_execution: Verifies
  that when stop is requested before any execution, follow-ups are
  rejected and the runner stops gracefully without executing tools.

- test_follow_up_merged_into_tool_result_before_stop: Verifies that
  follow-ups queued before stop are properly merged into tool results
  via _merge_follow_up_notice().

- test_follow_up_after_stop_not_merged_into_tool_result: Regression
  test that simulates the race condition from issue #6626. Verifies
  that only pre-stop follow-ups are merged into tool results, and
  post-stop follow-ups are rejected at the admission point.

These tests validate the fix in ToolLoopAgentRunner.follow_up() that
checks both self.done() and self._stop_requested before accepting
new follow-up messages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(agent): update stop request check in ToolLoopAgentRunner

---------

Co-authored-by: ccsang <ccsang@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Soulter <905617992@qq.com>
2026-03-21 01:06:37 +08:00
SJandidiotsj b816f26fe6 fix(core): interrupt subagent tool waits on stop (#5850)
* fix(core): interrupt subagent tool waits on stop

* test: relax subagent handoff timeout

* test: cover stop-aware tool interruption

* refactor: unify runner stop state

* refactor: simplify tool executor interruption

* fix: preserve tool interruption propagation

* refactor: tighten interruption helpers

---------

Co-authored-by: idiotsj <idiotsj@users.noreply.github.com>
2026-03-21 00:59:52 +08:00
2a6863cf70 test: add tests for star base class and config management (#5356)
* test: add tests for star base class and config management

- Add Star base class safety helper tests
- Expand config management unit tests
- Update cron manager tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: fix plugin_manager test isolation issues

- Use local mock plugin instead of real network requests
- Clear sys.modules cache for entire data module tree
- Clear star_map and star_registry in teardown
- Use pytest_asyncio.fixture for async fixture support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: fix test isolation and compatibility issues

- test_main.py: fix version comparison and path assertions for Windows
- test_smoke.py: add missing apscheduler.triggers mock modules
- test_tool_loop_agent_runner.py: update assertion for new interrupt behavior
- test_api_key_open_api.py: use unique session IDs to avoid test conflicts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add unit tests for _version_info comparisons

* test: enhance plugin manager tests with mock implementations and improved assertions

* test: add mock plugin builder and updater for plugin management tests

* fix: resolve pipeline and star import cycles (#5353)

* fix: resolve pipeline and star import cycles

- Add bootstrap.py and stage_order.py to break circular dependencies
- Export Context, PluginManager, StarTools from star module
- Update pipeline __init__ to defer imports
- Split pipeline initialization into separate bootstrap module

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add logging for get_config() failure in Star class

* fix: reorder logger initialization in base.py

---------

Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: update cron job scheduling tests and refactor star base tests for clarity

* test: expand star base tests for comprehensive coverage

- Add tests for Star class initialization and context handling
- Add tests for text_to_image with/without config
- Add tests for html_render method
- Add tests for initialize/terminate lifecycle methods
- Add type hint validation tests for Context
- Add circular import prevention tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback - use TYPE_CHECKING instead of Any

- pipeline/context.py: Use TYPE_CHECKING to import PluginManager instead of Any
- pipeline/__init__.py: Add TYPE_CHECKING imports for __all__ exports to satisfy static analyzers
- star/register/star_handler.py: Use TYPE_CHECKING to import AstrAgentContext instead of Any
- tests: Remove invalid type hint tests that tested incorrect assumptions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: improve TYPE_CHECKING pattern for circular import resolution

- star/register/star_handler.py: Use AstrAgentContext instead of Any in generic types
- star/context.py: Remove unnecessary else branch with CronJobManager = Any
  (with __future__ annotations, TYPE_CHECKING imports are sufficient)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
2026-03-01 00:06:04 +08:00
Soulter 5219ba5c4e feat: implement follow-up message handling in ToolLoopAgentRunner (#5484)
* feat: implement follow-up message handling in ToolLoopAgentRunner

* fix: correct import path for follow-up module in InternalAgentSubStage
2026-02-26 21:38:47 +08:00
Soulter e357d9de74 feat: add stop functionality for active agent sessions and improve handling of stop requests (#5380)
* feat: add stop functionality for active agent sessions and improve handling of stop requests

* feat: update stop button icon and tooltip in ChatInput component

* fix: correct indentation in tool call handling within ChatRoute class
2026-02-23 20:21:30 +08:00
Soulter 754144ad99 feat: add fallback chat model chain in tool loop runner (#5109)
* feat: implement fallback provider support for chat models and update configuration

* feat: enhance provider selection display with count and chips for selected providers

* feat: update fallback chat providers to use provider settings and add warning for non-list fallback models
2026-02-15 11:51:34 +08:00
YokamiandSoulter fc5b520f9b perf(agent): add max step limit to prevent infinite tool call loops (#4110)
* perf(agent): add max step limit to prevent infinite tool call loops

* feat: implement max step limit handling in main agent runner

- Enhanced the agent runner to enforce a maximum step limit, logging a warning and forcing a final response when the limit is reached.
- Updated message handling to append a user prompt when the tool call limit is exceeded.
- Refactored tool response handling to yield appropriate messages based on the response type, including handling cases with no response or unsupported types.
- Improved conversation message formatting to ensure consistent output in the assistant's responses.

* chore: ruff format

---------

Co-authored-by: Soulter <905617992@qq.com>
2025-12-21 12:30:43 +08:00