Commit Graph
656 Commits
Author SHA1 Message Date
Michael Panchenko bc6b0f2eba Replaced queue-based approach to worker with pipe-based one 2025-06-15 17:57:36 +02:00
Michael Panchenko 1327c7a118 Tests for isolated agent 2025-06-15 17:47:46 +02:00
Michael Panchenko fd90ec471d Brought normal and isolated agent interfaces closer together 2025-06-15 17:47:36 +02:00
Michael Panchenko b284eed69c Replaced string interfaces by enum 2025-06-15 16:36:31 +02:00
Michael Panchenko ad96a7b255 Minor renaming 2025-06-15 16:14:40 +02:00
Michael Panchenko a0c820cc33 Removed unused method 2025-06-15 15:51:41 +02:00
Michael Panchenko b87caf7e0a Merge branch 'main' into fix_deadlocks
# Conflicts:
#	test/conftest.py
2025-06-15 15:17:48 +02:00
Michael Panchenko 8c76eb0adf Update mcp dependency, remove not needed fastmcp 2025-06-15 15:15:23 +02:00
Michael Panchenko 37d1004460 Fixes in SerenaAgent isolation in process creation
make_tool previously depended on tool instances in the main process, but the tool instances are no longer available there

To solve this, the tool interface was adjusted to provide static information which is used in the ProcessIsolatedTool wrapper.

I also tried another approach before, where ProcessIsolatedTool would accept tool metadata at init, but this lead to serialization issues that couldn't be easily solved (mcp's FuncMetadata is not serializable, despite being a BaseModel...).

Tests for checking that the wrapped tool instance has the same metadata as the wrapper have been added.
2025-06-15 15:15:23 +02:00
Michael PanchenkoandGitHub df5b68c6b4 Merge pull request #157 from diazoxide/main
Add Docker support with GitHub Actions workflow and updated Readme.md
2025-06-15 11:45:01 +02:00
Aaron Yordanyan 0401123008 Refine Docker configuration handling and documentation
- Updated exception handling in `agent.py` for better error specificity (catching `FileNotFoundError`).
- Added contextual comment for `CONFIG_FILE_DOCKER` in `agent.py`.
- Updated `DOCKER.md` to reflect the new GitHub repository link.
2025-06-14 10:19:12 +04:00
Michael Panchenko 4a4b665d60 Testing: allow setting PYTEST_MARKERS to control which tests to run by default 2025-06-14 01:25:31 +02:00
Michael Panchenko 9c28f90139 Major: Implement process isolation for MCP server to prevent asyncio deadlocks
ROOT CAUSE: Asyncio event loop contamination between MCP server and SerenaAgent
  was causing intermittent deadlocks. MCP server runs in its own asyncio loop,
  but SerenaAgent creates coroutines that leak into the MCP context, leading to
  unawaited coroutines and eventual event loop blocking.

  SOLUTION: Complete process isolation with clean architecture

  Process Isolation Changes:
  - Add ProcessIsolatedSerenaAgent wrapper that runs SerenaAgent in separate process
  - Implement JSON-RPC based IPC for communication between MCP server and agent
  - Add SerenaAgentWorker class to handle requests in the isolated process
  - Centralize error handling in _make_request_with_result() helper method
  - Use serena_config.tool_timeout instead of hardcoded timeout parameters

  Architecture Improvements:
  - Define ToolProtocol interface for clean tool contracts
  - Implement ProcessIsolatedTool with complete Tool interface (apply + apply_ex)
  - Remove hacky make_process_isolated_tool function - use single make_tool path
  - Eliminate inheritance abuse - ProcessIsolatedTool implements protocol cleanly
  - Preserve full docstring parsing functionality through process boundary

  MCP Server Updates:
  - Update start_mcp_server() to use process isolation by default
  - Maintain backward compatibility with create_mcp_server_and_agent()
  - Retrieve tool metadata from isolated process for proper MCP tool creation
  - Ensure proper process lifecycle management in server lifespan handlers

  Key Benefits:
  - Prevents asyncio contamination deadlocks completely
  - Maintains full docstring parsing and parameter schema generation
  - Clean protocol-based architecture with no inheritance hacks
  - Centralized configuration-driven timeout handling
  - All tools implement consistent apply_ex interface
  - Process isolation is transparent to MCP clients

  This fix ensures that MCP symbolic tools no longer create deadlocks
2025-06-14 01:25:30 +02:00
Michael Panchenko 4514d04c90 Minor (docstrings, validation) 2025-06-14 00:27:25 +02:00
Michael Panchenko f3901dfec2 Fix: trace_lsp_communication in yaml was ignored 2025-06-14 00:01:10 +02:00
Michael Panchenko cd10d2f056 Minor 2025-06-13 23:33:15 +02:00
Michael PanchenkoandMichael Panchenko 3f5b4da532 More config options for logging in tests, formating 2025-06-13 23:31:48 +02:00
Michael PanchenkoandMichael Panchenko 2fba67f231 LS: hacky solution for waiting till pyright and ts servers are ready 2025-06-13 23:31:31 +02:00
Michael PanchenkoandMichael Panchenko 5c530fa642 Multilspy logger: default stacklevel to 2 2025-06-13 23:31:31 +02:00
Michael PanchenkoandMichael Panchenko 8c465b53f7 LS: minor deduplication, logging 2025-06-13 23:31:27 +02:00
Michael PanchenkoandMichael Panchenko 386a8df54e Timeout fixup 2025-06-13 23:30:58 +02:00
Michael Panchenko b1e14d8267 Force-added ingored file in test resources
Needed for tests involving ignored patterns
2025-06-13 23:29:35 +02:00
Michael Panchenko 71ab18fddf Agent: force log format through basicConfig
Needed to make multilspy logs respect our log format
2025-06-13 23:29:35 +02:00
Michael Panchenko 40e9bb87c1 Tests: use gitignore parser in LS setup, remove duplication 2025-06-13 23:29:35 +02:00
Michael Panchenko 47a133a7c0 Typo 2025-06-13 23:29:35 +02:00
Michael Panchenko 3ca27e47d5 Fix tests to correctly use gitignore for LS setup 2025-06-13 23:29:35 +02:00
Michael Panchenko 287e59e45e Merge remote-tracking branch 'origin/main' 2025-06-13 18:13:58 +02:00
Michael Panchenko 3c4e9d77d7 Agent: force log format through basicConfig
Needed to make multilspy logs respect our log format
2025-06-13 18:13:46 +02:00
Michael Panchenko b185a9f595 Tests: use gitignore parser in LS setup, remove duplication 2025-06-13 18:13:46 +02:00
Michael Panchenko 099ab41203 Typo 2025-06-13 18:13:46 +02:00
Michael Panchenko 8cd50fab16 Force-added ingored file in test resources
Needed for tests involving ignored patterns
2025-06-13 18:13:46 +02:00
Michael Panchenko b0ade9e9fa Fix tests to correctly use gitignore for LS setup 2025-06-13 18:13:46 +02:00
Michael PanchenkoandGitHub c545f1d46e Merge pull request #167 from oraios/codex/fehler-in-codebasis-suchen-und-beheben
Fix glob pattern escaping
2025-06-13 13:09:01 +02:00
Dominik Jain 34cef92c6c Fix glob escaping for search_text 2025-06-13 12:51:53 +02:00
Dominik Jain e19b0b6d34 Fix glob pattern escaping 2025-06-13 11:54:56 +02:00
Michael Panchenko 3b04d0b867 Advice to restart LS in tool failure message 2025-06-12 15:09:38 +02:00
Michael Panchenko 36dbf5c681 Possibility to override tool timeout through CLI 2025-06-12 15:09:38 +02:00
Michael Panchenko bdaedfd3e5 Added Claude.md 2025-06-12 15:09:38 +02:00
Michael Panchenko 0c5a98236f Gitignore: fix handling of anchored ignores
Previously anchored ignores would be erroneosly ingored everywhere
2025-06-11 17:09:33 +02:00
Michael Panchenko 40b9a246f0 Multilspy: fix dotnet version detection
don't just use first line of output, instead use latest available and allowed version
2025-06-11 17:08:32 +02:00
Michael PanchenkoandGitHub b33af12203 Merge pull request #166 from oraios/enhance_nonsymbolic_search_tools
Gitignore handling and read-edit tools - important fixes and improvments
2025-06-11 16:01:23 +02:00
Michael Panchenko 9c7440861b Gitignore handling and read-edit tools - important fixes and improvments
1. Use all gitignore files in SerenaAgent, not just top level
2. Listing and file finding tools now can find all non-ignored files (previously they would only find code files)
3. Read and edit tools will raise an error on attempting to operate on an ignored file or a path outside the project root
2025-06-11 15:56:54 +02:00
Michael PanchenkoandGitHub 9cf18b3b0c Merge pull request #164 from oraios/fix_ls_stop_racing_conditions
Fix ls stop racing conditions
2025-06-10 01:22:17 +02:00
Michael Panchenko 6c03f10f8d No rust tests on ubuntu either for now 2025-06-10 01:09:36 +02:00
Michael Panchenko c14fff0517 No java tests on ubuntu for now 2025-06-10 01:03:45 +02:00
Michael Panchenko d1537d682c CI: maybe rust and java run? 2025-06-10 00:36:25 +02:00
Michael Panchenko 993c6f6dfd Mercilessly kill all asyncio stuff at shutdown 2025-06-10 00:29:37 +02:00
Michael Panchenko d2cd006007 More logging in tests 2025-06-09 22:01:03 +02:00
Michael Panchenko 1c6af8cfea LS: attempt at more robust shutdown 2025-06-09 21:54:55 +02:00
Michael Panchenko ce0c82869b LS: thread-safe cache read/write through locking 2025-06-09 18:07:24 +02:00