Skip to content

Missions Tab Overhaul And Fixes#257

Merged
arul28 merged 10 commits into
mainfrom
ade/missions-tab-overhaul-and-fixes-ece96cdb
May 8, 2026
Merged

Missions Tab Overhaul And Fixes#257
arul28 merged 10 commits into
mainfrom
ade/missions-tab-overhaul-and-fixes-ece96cdb

Conversation

@arul28
Copy link
Copy Markdown
Owner

@arul28 arul28 commented May 8, 2026

Summary

Describe the change.

What Changed

Key files and behaviors.

Validation

How you tested.

Risks

Anything to watch.


Note

Medium Risk
Touches mission orchestration/RPC routing (resume, worker messaging, worker-state reporting) and introduces new headless RPC/MCP servers, which could affect run control and inter-agent communication if regressions occur.

Overview
Adds a typed missions command surface to ade-cli (create/launch/start/watch/graph/runs/pause/resume/cancel), including optional wait-for-run-graph polling to keep headless runtimes alive and richer text formatters for mission outputs.

Extends the CLI to run as a stdio MCP server via ade mcp, with tool-name normalization and optional scoping to coordinator tools; headless mode now also spins up local TCP + mirror socket RPC servers (with ADE_RPC_URL/ADE_RPC_SOCKET_PATH overrides) to support worker/tool callers.

Improves mission-runtime RPC behavior: routes resume_mission through aiOrchestratorService.resumeRun, exposes message_worker to agent callers with enforced worker ownership and a queued-for-polling fallback when live delivery fails, and expands get_worker_states to include persisted runWorkers derived from the run graph while filtering out non-worker/task/system steps.

On the desktop side, tightens embedding usage by gating hybrid search + embedding worker processing when there are active runs/sessions, and makes Codex task execution more robust by converting structured output schemas into stricter Codex-compatible JSON Schemas (with accompanying tests).

Reviewed by Cursor Bugbot for commit fe0b741. Configure here.

Greptile Summary

This PR adds a typed missions CLI surface (create/list/launch/start/watch/graph/runs/pause/resume/cancel) with text formatters and a headless wait-run-graph polling loop, and introduces ade mcp mode that exposes ADE tools over stdio MCP with optional coordinator-only scoping.

  • Mission RPC overhaul: message_worker is exposed to agent callers with strict caller-context enforcement; when live delivery fails the message is queued to the DB poll path (only on failed delivery); resume_mission is rerouted through aiOrchestratorService.resumeRun so coordinator restart and resume-message injection occur correctly.
  • get_worker_states enriched: Response now includes a runWorkers array derived from the run graph via isRunWorkerStep filtering, correctly excluding planner, system-managed, and display-only task steps from peer discovery.
  • Worker spawn improvements: spawnWorkerStep now fuzzy-matches reusable task shells by name/token overlap, applies phase hints, propagates readOnly metadata, and threads retryLimit from delegation contracts into step creation and task-shell conversion.

Confidence Score: 4/5

Safe to merge with review of the intervention_required status handling in missionService and the run-view subscription resilience; the core RPC and MCP plumbing is sound.

The isRunWorkerStep filter, the conditional DB queue write in message_worker, and the rerouting of resume_mission through aiOrchestratorService.resumeRun are all correct. The riskier areas are the ACTIVE_MISSION_STATUSES change that drops intervention_required from the concurrency cap and the active dashboard query, and the removal of the periodic polling fallback in the run view — both are live behavioral changes affecting mission coordination and UI state during user-input pauses that deserve targeted validation.

apps/desktop/src/main/services/missions/missionService.ts (intervention_required concurrency and dashboard filtering), apps/desktop/src/renderer/components/missions/useMissionRunView.ts (subscription-only refresh with no safety fallback), apps/desktop/src/renderer/components/missions/MissionChatV2.tsx (load-older path is now dead code)

Important Files Changed

Filename Overview
apps/ade-cli/src/cli.ts Adds ~1400 lines covering missions CLI surface, MCP server mode, headless wait-run-graph polling loop, and worker mission tool passthrough; overall logic is sound but the 1-second polling interval in waitForRunGraph can produce up to 3600 requests per 30-minute wait window.
apps/ade-cli/src/adeRpcServer.ts Exposes message_worker to agent callers with strict fromWorkerId enforcement; DB queue write correctly conditioned on failed live delivery; isRunWorkerStep filter properly excludes planner/system-managed/display-only steps from runWorkers; resume_mission rerouted to aiOrchestratorService.resumeRun for full coordinator restart semantics.
apps/desktop/src/main/services/orchestrator/coordinatorTools.ts Adds fuzzy task-shell matching, phase-hint resolution, readOnly metadata, retryLimit propagation, and auto-spawned validation proof step exclusion from run completion checks; isTaskShellStep now correctly excludes plannerLaunchTracker and systemManaged steps.
apps/desktop/src/main/services/missions/missionService.ts ACTIVE_MISSION_STATUSES now excludes intervention_required, affecting both the concurrency cap (missions awaiting user input don't count toward the limit) and the active dashboard query (they are post-filtered out of the live list).
apps/desktop/src/main/services/orchestrator/aiOrchestratorService.ts Large additions covering resumeRun coordinator-restart flow, steering autopilot start, and auto-resume guard checking run status before resuming; changes are well-structured with appropriate error handling.
apps/desktop/src/main/services/orchestrator/workerDeliveryService.ts Adds shouldPreferSteerForWorkerSession to route Codex provider messages through steer instead of direct send, avoiding rejection on concurrent turns; clean implementation.
apps/desktop/src/renderer/components/chat/missionControlTextTools.ts New file parsing mission control tool calls from free-text agent output using fenced code blocks and comment-label fallback; findBalancedJson handles standard string escapes correctly.
apps/desktop/src/main/services/orchestrator/executionPolicy.ts Improves phase resolution (phaseKey/phaseName priority over stepType), excludes auto-spawned validation proof steps from required-validation checks, widens phaseKeyToExecutionPhase to handle prefixed/suffixed keys, and uses resolveModelDescriptor for better model lookup.
apps/desktop/src/renderer/components/missions/useMissionRunView.ts Removes the periodic polling fallback; run view now refreshes only on mount and subscription events, leaving no recovery path if the IPC subscription stalls mid-run.
apps/desktop/src/renderer/components/missions/MissionChatV2.tsx Removes loadOlderSelectedMessages and the threadMessagesHasMore/threadMessagesLoadingMore state; the append-older branch in refreshThreadMessages is now dead code, making messages beyond THREAD_MESSAGE_PAGE_SIZE permanently inaccessible.

Sequence Diagram

sequenceDiagram
    participant CLI as ade CLI
    participant ADE as ADE RPC Server
    participant ORC as aiOrchestratorService
    participant DB as DB / KV Store
    participant AGENT as Worker Agent

    Note over CLI,AGENT: missions launch --wait-ms 30000
    CLI->>ADE: "mission.create (autostart=false)"
    ADE->>DB: INSERT mission
    CLI->>ADE: orchestrator.startMissionRun
    ADE->>ORC: ensureCoordinatorAgentV2
    ORC-->>AGENT: start coordinator
    CLI->>ADE: ade-cli/wait-run-graph (poll 1s)
    loop until terminal or deadline
        CLI->>ADE: orchestrator_core.getRunGraph
        ADE-->>CLI: "{run.status, steps, attempts}"
    end
    CLI-->>CLI: format mission-watch output

    Note over CLI,AGENT: resume_mission RPC tool
    AGENT->>ADE: "resume_mission {runId}"
    ADE->>ORC: aiOrchestratorService.resumeRun
    ORC->>ORC: ensureCoordinatorAgentV2
    ORC->>AGENT: injectMessage [RUN RESUMED]
    ORC-->>ADE: OrchestratorRun

    Note over AGENT,DB: message_worker (agent caller)
    AGENT->>ADE: "message_worker {toWorkerId, content}"
    ADE->>ADE: normalizeAgentDelegationToolArgs (enforce fromWorkerId)
    ADE->>ORC: coordinatorTool.execute
    alt live delivery succeeds
        ORC-->>AGENT: "{delivered:true, queuedForPolling:false}"
    else live delivery fails
        ADE->>DB: maybeSendInterAgentMessage (polling queue)
        ADE-->>AGENT: "{delivered:false, queuedForPolling:true}"
    end

    Note over CLI,DB: ade mcp (stdio MCP server)
    CLI->>CLI: runMcpServer (headless)
    CLI->>CLI: startJsonRpcServer over stdin/stdout
    loop MCP requests
        CLI->>ADE: ade/actions/call (scoped by ADE_MCP_TOOL_SCOPE)
        ADE-->>CLI: result
        CLI-->>CLI: MCP tools/call response
    end
Loading

Reviews (6): Last reviewed commit: "fix: address headless drain review" | Re-trigger Greptile

Summary by CodeRabbit

  • New Features

    • Mission orchestration with new integration and closeout phases
    • Mission management commands (create, launch, show, runs, graph, watch, pause, resume, cancel)
    • MCP server mode for ADE CLI
    • Codex reasoning effort configuration and persistence
    • OpenCode integration with ADE MCP support
    • Improved worker messaging and delegation handling
  • Bug Fixes

    • Better git error reporting for missing working directories
    • Improved run completion validation and phase transition logic
    • Fixed embedding worker deferral during sensitive activity
    • Enhanced worker startup and lifecycle management
  • Improvements

    • Phase sequence validation with predecessor/successor ordering enforcement
    • Stricter validation gating and completion requirements
    • Better sensitive activity detection to defer embeddings
    • Improved chat persistence and replay for missions
    • More robust orchestrator recovery and health monitoring

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview May 8, 2026 5:27am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds mission CLI/MCP mode, run-graph waiting, coordinator message queueing, resume via AI orchestrator, expanded phase/validation policy, coordinator tools updates, IPC compaction/redaction, embedding gating/defer, logging refactor, lane linking, OpenCode ADE MCP config, Codex schema strictification, and tests.

Changes

End-to-end mission and runtime orchestration

Layer / File(s) Summary
All changes
apps/*/*
Contracts/policies, orchestrator/coordinator tools/services, CLI/MCP and RPC handlers, desktop IPC/memory/logging/git/lanes/OpenCode/provider schema, and tests consolidated for review.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • arul28/ADE#144 — Switches resume routing to AI orchestrator and related coordinator resume behavior.
  • arul28/ADE#219 — Overlaps desktop services (IPC, embedding) touched here.
  • arul28/ADE#190 — Modifies agentChatService; relates to reasoning effort and mission-surface handling.

Suggested labels

desktop

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/missions-tab-overhaul-and-fixes-ece96cdb

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@copilot review but do not make fixes

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@cursor review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 8, 2026

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

@capy-ai
Copy link
Copy Markdown

capy-ai Bot commented May 8, 2026

Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

@copilot review but do not make fixes

Reviewed the current PR changes through commit b145f74 and did not apply any fixes, per your request. I don’t see any additional blocking issues from this pass.

Copilot finished work on behalf of arul28 May 8, 2026 04:00
Comment thread apps/desktop/src/renderer/components/missions/useMissionRunView.ts
Comment thread apps/desktop/src/main/services/missions/missionService.ts Outdated
Comment thread apps/desktop/src/main/services/missions/missionService.ts
Comment thread apps/desktop/src/main/services/missions/missionService.ts
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@copilot review but do not make fixes

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@cursor review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 8, 2026

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

@copilot review but do not make fixes

Reviewed the branch through commit 077eb53 and kept this pass review-only (no fixes applied). I don’t see additional blocking issues from this pass.

Copilot finished work on behalf of arul28 May 8, 2026 04:19
@arul28 arul28 force-pushed the ade/missions-tab-overhaul-and-fixes-ece96cdb branch from 077eb53 to 1070291 Compare May 8, 2026 04:20
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@cursor review

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@copilot review but do not make fixes

@cursor
Copy link
Copy Markdown

cursor Bot commented May 8, 2026

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

@copilot review but do not make fixes

Reviewed the branch through commit 1070291 and kept this pass review-only (no fixes applied). I don’t see additional blocking issues from this pass.

Copilot finished work on behalf of arul28 May 8, 2026 04:21
Comment thread apps/desktop/src/renderer/components/missions/MissionChatV2.tsx
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@cursor review

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@copilot review but do not make fixes

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

@copilot review but do not make fixes

Reviewed the branch through commit 01b40f2 and kept this pass review-only (no fixes applied). I don’t see additional code-level blockers from this pass; current runs for 01b40f2 are still in progress, and the prior 1070291 CI failure was in missionService.test.ts (stale lane-claim FK setup).

Copilot finished work on behalf of arul28 May 8, 2026 04:30
Comment thread apps/ade-cli/src/cli.ts
Comment thread apps/desktop/src/renderer/components/missions/missionHelpers.ts Outdated
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@copilot review but do not make fixes

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@cursor review

Comment thread apps/ade-cli/src/adeRpcServer.ts
Comment thread apps/ade-cli/src/cli.ts
Comment thread apps/ade-cli/src/adeRpcServer.ts
@arul28 arul28 force-pushed the ade/missions-tab-overhaul-and-fixes-ece96cdb branch from 0f8f8c4 to 918a4cd Compare May 8, 2026 05:19
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@copilot review but do not make fixes

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@cursor review

Comment thread apps/ade-cli/src/cli.ts
Comment thread apps/ade-cli/src/cli.ts Outdated
method: "ade-cli/sleep",
params: { ms: Math.min(30 * 60 * 1000, Math.max(0, Math.floor(ms))) },
};
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dead code: sleepStep defined but never called

Low Severity

sleepStep creates an InvocationStep with method: "ade-cli/sleep" and a runtime handler exists for that method (line 6595), but no call site in buildMissionsPlan or any other plan builder ever invokes sleepStep. If a deliberate pause between plan steps was intended (e.g., before polling after launch), the delay is silently skipped.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 918a4cd. Configure here.

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@copilot review but do not make fixes

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 8, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit fe0b741. Configure here.

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.

2 participants