Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Plan: Add Local uvx Mode to Serena Tool

  • Understand the current architecture

    • Serena currently runs as Docker container using ghcr.io/oraios/serena:latest
    • Safe-inputs uses HTTP transport with local steps to start server
    • Runtime manager already supports uvx and registers it with setup-uv action
  • Add mode field to SerenaToolConfig

    • Add Mode field to SerenaToolConfig (options: "docker", "local")
    • Default to "docker" for backward compatibility
    • Update tools parser to handle mode field
  • Implement local uvx rendering

    • Add logic to detect local mode in serena rendering
    • For local mode: use HTTP transport instead of stdio
    • Generate step to start serena MCP server locally using uvx
    • Configure fixed port (4000) for HTTP transport
    • Remove API key requirement (not needed for Serena)
    • Refactor startup script to shell file in actions/setup/sh
    • Fix transport flag to use streamable-http (valid option)
  • Update runtime detection

    • Detect uvx when serena is in local mode
    • Ensure setup-uv action is added for local mode
    • Register language runtimes when Serena is in local mode
  • Strict mode validation

    • Add validation to prevent local mode in strict mode
    • Update smoke-copilot to use docker mode (default)
    • Add comprehensive tests for strict mode validation
  • Update smoke-copilot test

    • Change serena config to use default docker mode (strict mode compatible)
  • Update existing tests

    • Update importable_tools_test to handle both modes
    • Update mcp_config_comprehensive_test for local mode
    • Add new tests for local mode HTTP transport
  • Documentation

    • Update comments explaining local vs docker mode
    • Document the HTTP transport configuration for local mode
Original prompt

Add an option tool the serena tool to run using uvx instead of docker and mount a http transport so that it runs locally in the action job (add a step to start Serena MCP at fixed port)

The runtime manager should register uvx and all the required setup-* to support this scenario.

Update smoke-copilot with testing local serena for go.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot when in local mode, register setup languages with runtime manager

Copilot AI changed the title [WIP] Add option to run Serena tool using UVX Add local uvx mode to Serena tool with HTTP transport Jan 15, 2026
Copilot AI requested a review from pelikhan January 15, 2026 13:55
// Local mode: use HTTP transport
yaml.WriteString(" type = \"http\"\n")
yaml.WriteString(" url = \"http://localhost:$GH_AW_SERENA_PORT\"\n")
yaml.WriteString(" headers = { Authorization = \"$GH_AW_SERENA_API_KEY\" }\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot api key not needed for serena

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8a42c68. Removed API key generation and Authorization header from Serena MCP configuration. The HTTP server now runs without authentication.

// generateSerenaLocalModeSteps generates steps to start Serena MCP server locally using uvx
func generateSerenaLocalModeSteps(yaml *strings.Builder) {
// Step 1: Generate API key and choose port for Serena HTTP server
yaml.WriteString(" - name: Generate Serena MCP Server Config\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot refactor as shell script in actions/setup/sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8a42c68. Refactored inline bash script to actions/setup/sh/start_serena_server.sh with proper error handling and health checks. The workflow now calls bash /opt/gh-aw/actions/start_serena_server.sh instead of inline code.

When Serena runs in local mode with uvx, language services need to be installed on the host machine. This change adds detectSerenaLanguageRuntimes() to automatically detect and register language runtimes (Go, Node, Python, Java, .NET) based on the configured languages in the Serena tool.

Maps Serena language names to runtime IDs:
- go -> go
- typescript/javascript -> node
- python -> python
- java -> java
- csharp -> dotnet

Supports both short syntax (serena: ["go"]) and detailed configuration with versions.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot when in local mode, register setup languages with runtime manager

Done in ea29d7c. Added detectSerenaLanguageRuntimes() to automatically register language runtimes (Go, Node, Python, Java, .NET) based on Serena's configured languages when running in local mode. The smoke-copilot workflow now includes Setup Go step before Setup uv.

- Removed API key generation and Authorization header for Serena MCP (not needed)
- Refactored inline bash script to actions/setup/sh/start_serena_server.sh
- Updated collectMCPEnvironmentVariables to only pass SERENA_PORT
- Simplified generateSerenaLocalModeSteps to call the shell script
- Created start_serena_server.sh with proper error handling and health checks

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan added the smoke label Jan 15, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@pelikhan
Copy link
Contributor

@copilot local mode is an error in strict compilation mode

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 merged PRs:

Test Results:

  • ✅ GitHub MCP
  • ✅ Serena Go (v0.1.4)
  • ✅ Playwright (GitHub title confirmed)
  • ✅ Tavily Web Search (5 results)
  • ✅ File Write
  • ✅ Bash Tool

Status: PASS

AI generated by Smoke Claude

In strict mode, Serena local mode is not allowed because it runs the MCP server directly on the host without containerization, bypassing security isolation. This change adds validateStrictTools() to check for serena with mode: local and reject it in strict mode.

Changes:
- Added validateStrictTools() to strict_mode_validation.go
- Updated validateStrictMode() to call validateStrictTools()
- Changed smoke-copilot.md to use default docker mode (removed mode: local)
- Added comprehensive tests in strict_mode_serena_test.go

The validation provides a clear error message directing users to use docker mode for security.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot local mode is an error in strict compilation mode

Done in 809b07c. Added strict mode validation to prevent Serena local mode. In strict mode, local mode is rejected because it runs without containerization, bypassing security isolation. The smoke-copilot workflow now uses default docker mode, and comprehensive tests ensure the validation works correctly.

@pelikhan
Copy link
Contributor

@copilot make sure the conclusion job "needs" the "agent" job

Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot make sure the conclusion job "needs" the "agent" job

The conclusion job already correctly depends on the agent job. The needs array is set at line 311 in notify_comment.go and includes the agent job (passed as mainJobName). Current compilation shows:

conclusion:
  needs:
    - activation
    - agent
    - detection
    - safe_outputs
    - update_cache_memory

No changes needed - this dependency is properly configured.

@pelikhan
Copy link
Contributor

@copilot fix syntax:

Error: Invalid value for '--transport': 'http' is not one of 'stdio', 'sse', 'streamable-http'.

Changed --transport http to --transport streamable-http in start_serena_server.sh. The Serena CLI only accepts 'stdio', 'sse', or 'streamable-http' as valid transport options.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot fix syntax:

Error: Invalid value for '--transport': 'http' is not one of 'stdio', 'sse', 'streamable-http'.

Done in 5e38449. Changed --transport http to --transport streamable-http in start_serena_server.sh. The Serena CLI accepts 'stdio', 'sse', or 'streamable-http' as valid transport options.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

Smoke Test Results (Run #21036691357)

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP - Retrieved PRs successfully
  • ✅ Serena - Initialized project (gh-aw, go/typescript/bash)
  • ✅ Playwright - Navigated to github.com, title verified
  • ✅ Tavily - Web search returned 5 results
  • ✅ File Writing - Created test file successfully
  • ✅ Bash Tool - Verified file creation
  • ❌ Go Command - Not available in environment

Overall: PASS (6/7 tests passed; Go unavailable expected in CI environment)

AI generated by Smoke Claude

@pelikhan
Copy link
Contributor

@copilot Finish adding tests

Added tests to cover Serena local mode functionality:

1. importable_tools_test.go:
   - TestImportSerenaLocalMode: Tests importing Serena with local mode, verifies HTTP transport, port config, shell script call, and runtime setups
   - TestImportSerenaLocalModeMultipleLanguages: Tests local mode with multiple language runtimes (Go, TypeScript, Python)

2. mcp_config_comprehensive_test.go:
   - TestRenderSerenaMCPConfigLocalMode: Tests MCP config rendering for local mode with HTTP transport vs docker mode with stdio

All tests verify:
- HTTP transport configuration for local mode
- Shell script invocation (start_serena_server.sh)
- Language runtime detection and setup
- Proper defaults (docker mode when not specified)
- No API key/Authorization header in local mode

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot Finish adding tests

Done in e07befe. Added comprehensive tests for Serena local mode:

importable_tools_test.go:

  • TestImportSerenaLocalMode: Verifies HTTP transport, shell script call, and runtime setups for single language
  • TestImportSerenaLocalModeMultipleLanguages: Tests multiple language runtimes (Go, TypeScript, Python)

mcp_config_comprehensive_test.go:

  • TestRenderSerenaMCPConfigLocalMode: Tests MCP config rendering for both local (HTTP) and docker (stdio) modes

All tests pass and verify proper HTTP transport configuration, language runtime detection, and correct defaults.

@pelikhan pelikhan marked this pull request as ready for review January 15, 2026 15:54
@pelikhan pelikhan merged commit 01fd250 into main Jan 15, 2026
@pelikhan pelikhan deleted the copilot/add-uvx-support-for-serena branch January 15, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants