Skip to content

[codex] fix mission ownership convergence and routing#88

Merged
jeremyplichta merged 5 commits into
mainfrom
codex/mission-routing-recovery
Apr 22, 2026
Merged

[codex] fix mission ownership convergence and routing#88
jeremyplichta merged 5 commits into
mainfrom
codex/mission-routing-recovery

Conversation

@jeremyplichta
Copy link
Copy Markdown
Collaborator

@jeremyplichta jeremyplichta commented Apr 22, 2026

What changed

This PR fixes mission-mode divergence when the canonical work item gets stuck on a stale assignee or reviewer path, and it hardens routing so implementation work is much less likely to fall onto tester lanes.

Why it changed

Mission runs were getting into a bad state where real work continued under a conductor redirect, but mission bookkeeping stayed pinned to the old owner. That left the dispatcher reporting stale blockers and re-raising stuck help requests. Separately, routing was still too permissive: implement work could be inferred or scored in a way that let tester lanes win when the task metadata was weak.

Root cause

  • Dispatcher control notes treated redirects as inert notes rather than ownership-changing directives.
  • Scheduler state trusted stale work-item assignment more than live mission-tagged tasks.
  • Progress tracking did not treat reconciliation as forward movement.
  • Compiler role inference could infer tester from incidental mentions of tests inside implementation issues.
  • Scheduler fallback scoring treated tester lanes as too acceptable for Implement work.

Impact

  • Conductor redirect notes can now rebind the canonical work item to the live owner.
  • Stale mission tasks are superseded and replacement tracked tasks are created when needed.
  • Mission status converges toward live mission-tagged work instead of staying blocked on stale ownership.
  • Dispatcher stuck escalation backs off correctly once reconciliation has happened.
  • Implement work now prefers backend/frontend/devops/generalist lanes and strongly de-prioritizes tester lanes.

Validation

  • cargo test test_infer_owner_role_is_kind_aware_for_implement_work
  • cargo test test_mission_scheduler_avoids_assigning_implement_work_to_tester
  • cargo test test_mission_scheduler_
  • cargo test test_mission_dispatcher_
  • cargo test

Note

Medium Risk
Changes core mission orchestration (dispatcher directives, scheduler assignment/reconciliation) and task cancellation/creation, which could affect live work-item state transitions and agent routing if edge cases are missed.

Overview
Improves mission ownership convergence and routing. The dispatcher now parses redirect/reassign/... to ... control notes, resolves agent/work-item references (including short IDs), and invokes the scheduler to redirect ownership while treating reconciliation as progress for help-request backoff.

The scheduler now reconciles persisted work-item assigned_to/status against live mission-tagged tasks each tick, and adds an explicit redirect_work_item flow that cancels superseded tasks and creates a replacement tracked task when needed.

Routing heuristics were tightened: compiler owner-role inference is now WorkKind-aware (avoids inferring tester from incidental “tests”), scheduler role matching normalizes role aliases and introduces lane-based fallback scoring to strongly de-prioritize assigning Implement work to tester/reviewer lanes; integration/unit tests were added/updated accordingly.

Reviewed by Cursor Bugbot for commit b64a3d4. Bugbot is set up for automated code reviews on this repo. Configure here.

@jeremyplichta jeremyplichta marked this pull request as ready for review April 22, 2026 18:35
Comment thread src/mission/dispatcher.rs Outdated
Comment thread src/mission/scheduler.rs
Comment thread src/mission/scheduler.rs
Comment thread src/mission/scheduler.rs
Comment thread src/mission/scheduler.rs Outdated
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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b64a3d4. Configure here.

Comment thread src/mission/scheduler.rs
// Fallback: name-based substring matching
let agent_name = agent.name.to_lowercase();
match role {
match normalize_role_alias(role) {
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 match arms after role alias normalization

Low Severity

The match input in agent_matches_role was changed from role to normalize_role_alias(role), which converts "test""tester", "review""reviewer", "audit""reviewer", and "infra""devops". This makes the "test" alternative in "tester" | "test", the "review" alternative in "reviewer" | "review", and the "infra" alternative in "devops" | "infra" unreachable dead code. The PR discussion explicitly notes these were supposed to be removed ("those unreachable arms were removed") but they remain in the code.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b64a3d4. Configure here.

@jeremyplichta jeremyplichta merged commit 1196972 into main Apr 22, 2026
12 checks passed
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