Skip to content

Cải thiện kiến trúc agent: thread-safety, native function calling, ch…#389

Open
mekongai wants to merge 1 commit into666ghj:mainfrom
mekongai:claude/code-analysis-Pd4fd
Open

Cải thiện kiến trúc agent: thread-safety, native function calling, ch…#389
mekongai wants to merge 1 commit into666ghj:mainfrom
mekongai:claude/code-analysis-Pd4fd

Conversation

@mekongai
Copy link
Copy Markdown

…eckpoint resume, context budget

P0 - SimulationRunner: thêm RLock (_state_lock) bảo vệ tất cả class-level dicts
(_run_states, _processes, _action_queues, _monitor_threads, _stdout_files,
_stderr_files, _graph_memory_enabled) tránh race condition khi đa luồng.

P0 - ReportAgent: thay custom <tool_call> string-parsing bằng OpenAI native
function calling (chat_with_tools). Thêm _get_openai_tools() chuyển đổi
tool definitions sang OpenAI JSON schema format. Cập nhật system prompt
loại bỏ hướng dẫn XML format. Áp dụng cho cả generate_report và chat().

P1 - ReportAgent: thêm section checkpoint resume — trước khi generate mỗi
section, kiểm tra section_XX.md đã tồn tại; nếu có thì load và skip,
cho phép tiếp tục từ điểm crash. Thêm ReportManager.load_section_checkpoint().

P1 - LLMClient: thêm estimate_tokens() và estimate_messages_tokens() ước tính
token không cần tiktoken. Trong _generate_section_react, khi context vượt
28K tokens thì tự động xóa cặp tool message cũ nhất.

P2 - ZepToolsService.interview_agents: cập nhật comment — đã xác nhận dùng
direct call đến SimulationRunner.interview_agents_batch(), không qua HTTP.

https://claude.ai/code/session_01PaYamLFZVbuSVZgjrHu81G

…eckpoint resume, context budget

P0 - SimulationRunner: thêm RLock (_state_lock) bảo vệ tất cả class-level dicts
  (_run_states, _processes, _action_queues, _monitor_threads, _stdout_files,
  _stderr_files, _graph_memory_enabled) tránh race condition khi đa luồng.

P0 - ReportAgent: thay custom <tool_call> string-parsing bằng OpenAI native
  function calling (chat_with_tools). Thêm _get_openai_tools() chuyển đổi
  tool definitions sang OpenAI JSON schema format. Cập nhật system prompt
  loại bỏ hướng dẫn XML format. Áp dụng cho cả generate_report và chat().

P1 - ReportAgent: thêm section checkpoint resume — trước khi generate mỗi
  section, kiểm tra section_XX.md đã tồn tại; nếu có thì load và skip,
  cho phép tiếp tục từ điểm crash. Thêm ReportManager.load_section_checkpoint().

P1 - LLMClient: thêm estimate_tokens() và estimate_messages_tokens() ước tính
  token không cần tiktoken. Trong _generate_section_react, khi context vượt
  28K tokens thì tự động xóa cặp tool message cũ nhất.

P2 - ZepToolsService.interview_agents: cập nhật comment — đã xác nhận dùng
  direct call đến SimulationRunner.interview_agents_batch(), không qua HTTP.

https://claude.ai/code/session_01PaYamLFZVbuSVZgjrHu81G
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Mar 29, 2026
koyouko added a commit to koyouko/MiroFish that referenced this pull request Mar 30, 2026
… Copilot)

Replaces the single-provider LLM client with a unified 5-provider client.
Adds thread-safety improvements to simulation_runner from upstream PR 666ghj#389,
GitHub Copilot OAuth token support from upstream PR 666ghj#383, and translates
all backend Python modules to English.

Providers supported: Anthropic (Claude), OpenAI, GitHub Copilot (OAuth),
Ollama (local), and the original MiniMax/GLM default.

Co-Authored-By: koyouko <koyouko@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants