fix(agent): stop follow-up turns after In Review / Merging (MT-247)#61
Merged
Conversation
Cursor stream-json may emit camelCase sessionId without snake_case session_id. Mirror Claude adapter resolution so AgentRunner passes a real --resume id on continuation turns after the issue stays active (MT-247). Adds regression test with init payload using sessionId only. Co-authored-by: Cursor <cursoragent@cursor.com>
Tracker active_states include In Review and Merging for orchestrator polling, but those handoff states must not trigger another coding-agent turn in the same run. Gate continuation on follow_up_turn_allowed?/1. Adds regression tests for In Review and Merging with WORKFLOW-shaped active_states. Co-authored-by: Cursor <cursoragent@cursor.com>
2 tasks
ivanzzeth
commented
May 9, 2026
Owner
Author
ivanzzeth
left a comment
There was a problem hiding this comment.
Review: PR #61 — MT-247 stop follow-up turns after In Review / Merging
Summary
Stops agent follow-up turns when the refreshed issue state is "In Review" or "Merging". The orchestrator continues polling these states, but the agent runner does not dispatch another turn.
Analysis
follow_up_turn_allowed?/1correctly distinguishes "active for polling" from "active for agent turns"normalize_issue_stateis already used byactive_issue_state?— the same normalization applied to "In Review"/"Merging" is consistent- Tests cover both In Review and Merging cases with
FakeCodingAgent - This PR includes the same cursor adapter fix as PR #58 (camelCase
sessionId) — if both merge, there will be a conflict. Recommend closing PR #58 and keeping this one since it has both fixes for MT-247.
Recommendation: Approve — correct logic, good tests, but coordinate with PR #58 (same MT-247 fix, same cursor adapter change).
ivanzzeth
commented
May 9, 2026
Owner
Author
ivanzzeth
left a comment
There was a problem hiding this comment.
Reviewed by human. Approved.
Resolved conflict in agent_runner.ex: combined develop's active_issue_state? opts arity with HEAD's follow_up_turn_allowed? guard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tracker.active_statesincludes In Review and Merging so the orchestrator keeps polling those issues.AgentRunnerreused the same rule to decide multi-turn continuation, so after the first completed turn—when the agent moved the ticket to In Review—the runner still treated the issue as "active" and scheduled another turn. That contradicts the WORKFLOW handoff (In Reviewwaits on humans; no further coding in the same run).Changes
follow_up_turn_allowed?passes (excludes In Review and Merging, case-insensitive).AgentRunnermoduledoc.active_states.Validation
mix formaton touched files.mix test test/symphony_elixir/agent_runner_test.exscould not be completed in this environment: application boot timed out reachingapi.linear.appvia Finch. CI should run the full suite.Linear: MT-247
Made with Cursor