Skip to content

singleTurn subroutines don't post results to Linear due to error_max_turns handling #662

@panosdigital

Description

@panosdigital

Description

When a subroutine with singleTurn: true completes (e.g., question-answer), Claude returns subtype: "error_max_turns" because it hit the maxTurns=1 limit. However, the handleProcedureCompletion() method treats any non-"success" subtype as an error and returns early, preventing the result from being posted to Linear.

Steps to Reproduce

  1. Create an issue and mention the agent with a question
  2. Agent routes to simple-question procedure → question-investigationquestion-answer
  3. question-answer runs with singleTurn: true (converted to maxTurns=1)
  4. Claude generates a response and the session completes with subtype: "error_max_turns"
  5. Result is NOT posted to Linear
  6. Session appears to hang indefinitely in Linear UI

Expected Behavior

  • Claude's response should be posted to Linear as a comment/activity
  • Session should be marked as complete
  • Linear UI should show the session as finished

Actual Behavior

  • Response is generated but never posted to Linear
  • Session stays in "active/running" state in Linear
  • No visible output from the agent

(Potential) Root Cause

In AgentSessionManager.ts, handleProcedureCompletion() (around line 269):

// Check if error occurred
if (resultMessage.subtype !== "success") {
    console.log(
        `[AgentSessionManager] Subroutine completed with error, not triggering next subroutine`,
    );
    return;  // <-- Early return prevents addResultEntry() from being called
}

The addResultEntry() at line 415 that posts results to Linear is only reached if there's no early return.

Environment

  • Running on a local machine via tmux with cloudflared tunnel
  • Linear integration with agent sessions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions