fix: prevent pipeline hang when subroutine completes with empty result#993
Open
acarr wants to merge 1 commit into
Open
fix: prevent pipeline hang when subroutine completes with empty result#993acarr wants to merge 1 commit into
acarr wants to merge 1 commit into
Conversation
When a subroutine (especially changelog-update) completes with subtype="success" but no result text, the condition `"result" in resultMessage && resultMessage.result` evaluated to false. All else-if branches check `subtype !== "success"` which was also false, causing completeSession() to silently return without advancing the pipeline. This left the Linear ticket appearing "hung" indefinitely. Fix: check `resultMessage.subtype === "success"` instead, and synthesize a placeholder result text for the empty case. Also handle the case where a stop signal arrives after a successful completion (stop arrived too late). Reproduced and verified with live Cyrus sessions (WAZ-215, WAZ-216) using diagnostic logging that confirmed the exact code path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
thanks @acarr we are queueing this up for review |
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.
Problem
Cyrus intermittently appears "hung" in Linear — the timer keeps running, the transcript shows work is done, but the ticket is never updated with a commit, PR, or summary. The only recourse is to manually stop the session.
Root Cause
In
AgentSessionManager.completeSession(), the condition that decides whether to advance the subroutine pipeline is:Some subroutines (observed on
changelog-update, but could affect any) complete withsubtype: "success"but no result text —resultisundefinedor empty string. When this happens:ifabove evaluates tofalse(result is falsy)else ifbranches checksubtype !== "success", which is alsofalseFix
Change the primary check from requiring result text to checking the success status:
When result text is empty, a placeholder
"(completed successfully)"is synthesized so downstream code that expects a string still works.Also fixes a secondary issue: when a user clicks "stop" in Linear but the session had already completed successfully, the pipeline was being abandoned. Now it checks whether the stop was actually effective (non-success result) vs. arrived too late (success result).
Evidence
Reproduced
changelog-updatewith diagnostic logs showingsubtype=success hasResult=falsefollowed by silencehasResult=falsecondition, but with the fix active — logs showsuccess with empty result — synthesizing result textand the pipeline continued to completionDiagnostic log showing the fix in action (WAZ-227)
Historical analysis
Analyzed 28 previous Cyrus tickets. 6 hung with the same pattern —
Session completed with N messageslogged by ClaudeRunner but noSubroutine completed, advancing to nextfrom AgentSessionManager. Task type and complexity showed no correlation — both simple (Settings screen) and complex (4-package polling system) tickets hung.Test plan
advances pipeline when success result has empty result text— the core regression testcontinues pipeline when stop arrives too late— stop + success doesn't kill pipelineskips pipeline when stop is effective— uses non-success subtype🤖 Generated with Claude Code