Skip to content

feat: refactor ai agent executor#247

Merged
pikann merged 2 commits into
masterfrom
feature/refactor-ai-agent-executer
Jul 3, 2026
Merged

feat: refactor ai agent executor#247
pikann merged 2 commits into
masterfrom
feature/refactor-ai-agent-executer

Conversation

@pikann

@pikann pikann commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • services/ai-agent/src/agent/executor.py — refactored the conversation-run/event-persistence pipeline after reading the installed openhands-sdk 1.30.0 source directly:
    • Removed the dead _make_token_callback / _TurnState machinery. RemoteConversation.__init__'s real constructor has no token_callbacks parameter — it's silently absorbed by a **_: object catch-all (only the Conversation factory's type-checking overload claims to support it), so this code had never fired in production; every agent reply was always persisted through _persist_event's fallback path anyway. Zero behavior change, ~90 fewer lines.
    • Throttled the events.reconcile() workaround (added to unblock the WS-client-thread-dies-permanently upstream bug, OpenHands/software-agent-sdk#1532) from every 2s poll to every 10s. reconcile() re-walks the entire event history over REST with no incremental cursor, and the SDK's own internal blocking run() only pays that cost once, at completion — not on every tick. The cheap execution_status poll stays at 2s for stop-responsiveness; a final reconcile() is still guaranteed on every exit path (done/error/timeout/manual-stop) so a run can never end with an un-persisted tail.
    • Swapped the hand-maintained "done" status set for the SDK's own ConversationExecutionStatus.is_terminal().
  • services/ai-agent/src/agent/repo_tools.py — removed the built-in create_pull_request tool. PR/MR creation, review, and commenting is repository-plugin-specific and is handled entirely by each plugin's own tools now, not a built-in agent tool.
  • scripts/install-local-plugin.sh — added support for building and installing a plugin's MCP bundle (mcp/dist/mcp.js) alongside the existing backend/frontend artifacts, for plugins that define an mcp/ directory.

Type of Change

  • Other (refactor / internal cleanup)

Test plan

  • pytest tests/ --ignore=tests/e2e — 83 passed
  • ruff check — clean
  • PACA_E2E=1 pytest tests/e2e — requires Docker; not run in this environment, recommend running before merge since it exercises the real sandbox + WebSocket path this PR touches

Checklist

  • The change is focused and scoped per area above.
  • No behavior change intended in the executor beyond the reconcile-interval widening (2s → 10s), called out explicitly above.

@pikann pikann mentioned this pull request Jul 3, 2026
@pikann pikann merged commit be88d8d into master Jul 3, 2026
7 checks passed
@pikann pikann deleted the feature/refactor-ai-agent-executer branch July 3, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant