Skip to content

Fix mission step sync when stepKey collides with claimed mission steps#358

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-detection-cadf
Closed

Fix mission step sync when stepKey collides with claimed mission steps#358
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-detection-cadf

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 25, 2026

Bug and impact

Impact: After Huge Cleanup (#355), syncMissionFromRun could mark the wrong mission step as failed (and surface the wrong failed_step intervention) when a run graph contained:

  1. A mission-linked orchestrator step (missionStepId set, stepKey e.g. review)
  2. Another orchestrator step with the same stepKey but no missionStepId (coordinator/legacy rows)

The new stepKey fallback in resolveMissionStepForRunStep matched the mission step by metadata stepKey for the unlinked run step, even though that mission step was already owned by the linked run step.

Trigger: Mission with a planned step keyed review → run includes linked step + unlinked coordinator/legacy step sharing review → coordinator/legacy step fails → syncMissionFromRun marks the primary mission step failed.

Root cause

#355 added stepKey-based mission step resolution without checking whether another step in the same run graph had already claimed the mission step via missionStepId, and without requiring an unambiguous stepKey match across mission steps.

Fix

  • Centralize resolveMissionStepForRunStep in missionLifecycle.ts
  • Prefer missionStepId / metadata.orchestratorStepId linkage
  • Only use stepKey fallback when exactly one mission step matches, and skip when another run step already claims that mission step via missionStepId

Validation

  • npm exec vitest run src/main/services/orchestrator/aiOrchestratorService.test.ts -t "does not sync unlinked run steps"

Related open PRs (not duplicated)

Open in Web View Automation 

Huge Cleanup (#355) added stepKey fallback matching in syncMissionFromRun.
When a run graph contains both a mission-linked step and an unlinked
orchestrator step sharing the same stepKey, sync could mark the wrong
mission step failed and open mis-targeted interventions.

Require unambiguous stepKey matches and ignore stepKey fallback for run
steps when another step in the graph already claims the mission step via
missionStepId.

Co-authored-by: Arul Sharma <arul28@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 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 25, 2026 2:38pm

@arul28
Copy link
Copy Markdown
Owner

arul28 commented May 29, 2026

Closing: superseded by #359 (ade/missions removal). The files this patches (aiOrchestratorService.ts, missionLifecycle.ts) no longer exist on main; the stepKey-collision bug is moot.

— 2026-05-29 ADE board cleanup

@arul28 arul28 closed this May 29, 2026
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