You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(workflows): an agent step's turn no longer waits on its issue tracker - #49582
Issue linking runs on the deadline path, before the turn and its start time are recorded: link separately, with a bound.
An agent step given issue reads that issue from its tracker and links the thread to it inside WorkflowAgents.start. The step records its thread and turn (stepThread) and takes its start time only after start returns (workflowAgent.ts). The tracker read has no time limit. So:
a slow tracker delays when the step shows its thread and when its timeout starts counting;
a tracker that never answers leaves the step waiting even after its agent's turn has ended.
Change
showIssue in WorkflowAgentThreads.ts now runs in the background, forked into the service's scope, so start returns as soon as the turn is sent.
The read and link are given up after 30 seconds, with the same warning a failing tracker already logs.
The background fiber keeps the step's context, so the issue is still recorded as something the step touched.
If the server restarts or the engine is rebuilt while a link is still pending, the link is dropped and a warning says so. Before, the step had not recorded its turn yet, so start ran again on resume and linked then. That window is now one tracker round trip, at most 30 seconds.
Scope
A bug fix for one item of #39013. #39013 is a list of follow-ups, so this PR doesn't close it.
Not changed: steps on a linked environment, which don't pass issue on, and corrections, which call start again and so link again. Both work as before.
Verification
Test kept: "starts a step's turn without waiting on its issue tracker, and gives up on it" in runtimeLayer.test.ts, next to the reply test from #48614. It guards a stuck step, which the keep bar names. It continues a real thread with an issue whose tracker never answers, checks that start returns the turn, then moves the test clock 30 seconds and checks that the read was given up.
On main's source the test never gets past start. To see it, from this branch, put main's WorkflowAgentThreads.ts back and run the test with a short timeout:
git checkout e7a610766f -- apps/server/src/workflows/WorkflowAgentThreads.ts
vp test run apps/server/src/orchestration-v2/runtimeLayer.test.ts -t "without waiting on its issue tracker" --testTimeout=10000
git checkout HEAD -- apps/server/src/workflows/WorkflowAgentThreads.ts
FAIL |t3| src/orchestration-v2/runtimeLayer.test.ts > workflow agent replies > starts a step's turn without waiting on its issue tracker, and gives up on it
TestTimeoutError: Test timed out in 10000ms.
Tests 1 failed | 159 skipped (160)
With the fix: Tests 1 passed | 159 skipped (160). The whole describe block passed 3 runs out of 3.
Context check. A fiber forked with Effect.forkIn still sees services provided around the fork (Effect 4.2.0), so noteReference inside issues.read still reaches the step's StepReferences:
forked fiber sees: step-references
Checks.vp run check:changed passed:
format, lint, knip, graphql and typecheck (3 packages)
tests (2 files): 162 passed
Not checked. No real-server run. That would need a real issue tracker that never answers. The test above uses the real thread code with only the tracker replaced.
Windows 11, Node 24.19.0, Effect 4.2.0.
Claude Opus 5.5 in Claude Code, run from T3 Code. An independent Claude Opus 5.5 review found no bugs. Its two suggestions are applied: the warning when a pending link is stopped, and a test that waits for the read to start before moving the clock.
…cker
An agent step with `issue` read the issue from its tracker and linked the thread before
`start` returned. The step records its thread and turn, and starts its timeout, only after
`start` returns, so a slow tracker delayed both, and a tracker that never answered left the
step waiting after its agent had finished.
The issue is now read and linked in the background, and given up after 30 seconds, with the
same warning as a tracker that fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A restart or engine rebuild while the link waits on the tracker drops it, since the step already
recorded its turn. Log that, and have the test wait for the read before moving the clock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Macroscope's review found this PR approvable — Workflow agents no longer wait for optional issue linking before returning their turn. Linking remains best-effort, with a 30-second timeout and logging; agent launch settings and external issue contents are unchanged.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 72434fa and fc8ea17.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Issue linking now runs in the captured Effect scope and has a 30-second timeout. A test verifies that workflow startup returns before the issue read completes and that the read is interrupted after the timeout.
Changes: Issue-link timeout
Layer / File(s)
Summary
Issue-link timeout and regression test apps/server/src/workflows/WorkflowAgentThreads.ts, apps/server/src/orchestration-v2/runtimeLayer.test.ts
showIssue forks issue linking into the captured scope, applies a 30-second timeout, and logs when linking is interrupted. The test setup reuses extracted mock dependencies. A new test verifies that WorkflowAgents.start returns before an issue read completes and that the read is interrupted after 30 seconds.
Workflow agent steps no longer wait on the issue tracker before their turn is recorded, and a slow link is abandoned after 30 seconds. A link still pending during a restart is dropped, which the change documents. No merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: an agent step's turn no longer waits on its issue tracker. The raw summary and objectives confirm that issue linking now runs in the background with a 30-second bound,…
Description check
The description follows the template well. It has Problem, Change, Scope and Verification sections, each with specific content. The Problem section explains the blocking behavior and links #39013. The…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: an agent step's turn no longer waits on its issue tracker. The raw summary and objectives confirm that issue linking now runs in the background with a 30-second bound, so the title matches the primary change. It uses the conventional commit format from the template.
Full details: Description check
Explanation
The description follows the template well. It has Problem, Change, Scope and Verification sections, each with specific content. The Problem section explains the blocking behavior and links #39013. The Change section lists the 30-second bound, the warning, the retained context, and the restart behavior. Scope states what is not changed. Verification gives a kept test, the exact commands to reproduce the failure on main, observed results, and what was not checked. The template's closing line asks for the model and harness used, and the description includes it.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Environment: Linux web, Chromium 156, 1280×800, light theme; fresh databases, real Linear test team, Replay multi-turn.
Steps: connect Linear and bind project app; run tracker-stall (agent fix, one-minute timeout, issue link, then code step after) with requests passing through as a control; hold only T3Issue open in a forwarding proxy; run again and observe after 90 seconds.
Scenario: A completed workflow agent advances while Linear's issue read is held open
Base: the agent thread completed, but the workflow remained running with no step thread attached after 90 seconds. Head: the thread was attached and both steps completed in 901ms; the optional issue read logged a 30-second timeout. Real Linear requests passed in both control runs; test issues were archived afterward.
Not shown:
A deadline firing for an agent that itself runs longer than one minute was not exercised: Replay completed quickly. The reproduced failure was the completed agent being blocked by its issue read.
Cancellation during server shutdown was not exercised; the optional read's 30-second timeout and warning were observed.
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
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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
Part of #39013, which lists:
An agent step given
issuereads that issue from its tracker and links the thread to it insideWorkflowAgents.start. The step records its thread and turn (stepThread) and takes its start time only afterstartreturns (workflowAgent.ts). The tracker read has no time limit. So:timeoutstarts counting;Change
showIssueinWorkflowAgentThreads.tsnow runs in the background, forked into the service's scope, sostartreturns as soon as the turn is sent.startran again on resume and linked then. That window is now one tracker round trip, at most 30 seconds.Scope
A bug fix for one item of #39013. #39013 is a list of follow-ups, so this PR doesn't close it.
Not changed: steps on a linked environment, which don't pass
issueon, and corrections, which callstartagain and so link again. Both work as before.Verification
Test kept: "starts a step's turn without waiting on its issue tracker, and gives up on it" in
runtimeLayer.test.ts, next to the reply test from #48614. It guards a stuck step, which the keep bar names. It continues a real thread with an issue whose tracker never answers, checks thatstartreturns the turn, then moves the test clock 30 seconds and checks that the read was given up.On main's source the test never gets past
start. To see it, from this branch, put main'sWorkflowAgentThreads.tsback and run the test with a short timeout:With the fix:
Tests 1 passed | 159 skipped (160). The whole describe block passed 3 runs out of 3.Context check. A fiber forked with
Effect.forkInstill sees services provided around the fork (Effect 4.2.0), sonoteReferenceinsideissues.readstill reaches the step'sStepReferences:Checks.
vp run check:changedpassed:Not checked. No real-server run. That would need a real issue tracker that never answers. The test above uses the real thread code with only the tracker replaced.
Windows 11, Node 24.19.0, Effect 4.2.0.
Claude Opus 5.5 in Claude Code, run from T3 Code. An independent Claude Opus 5.5 review found no bugs. Its two suggestions are applied: the warning when a pending link is stopped, and a test that waits for the read to start before moving the clock.
🤖 Generated with Claude Code