Skip to content

Pause DAG runner idle timeout during SDK reconnect - #62

Open
rajarshidattapy wants to merge 4 commits into
cursor:mainfrom
rajarshidattapy:fix/dag-idle-timeout-reconnect
Open

rajarshidattapy wants to merge 4 commits into
cursor:mainfrom
rajarshidattapy:fix/dag-idle-timeout-reconnect

Conversation

@rajarshidattapy

@rajarshidattapy rajarshidattapy commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • The DAG runner treated SDK reconnect silence as a stalled model and marked the task ERROR.
  • Stream idle waits now freeze while onConnectionStateChange reports reconnecting, and still honor the hard task deadline.
  • The same change is mirrored in the copyable .cursor/skills/dag-task-runner skill.

Fixes #59

Test plan

  • cd sdk/dag-task-runner && pnpm test (3/3)
  • pnpm typecheck

Note

Medium Risk
Runner timing and global console patching affect all in-flight DAG tasks; mis-parsed SDK logs could leave idle timeout paused or tasks still failing on long retries, but behavior is covered by new tests and hard deadlines remain.

Overview
Fixes false ERRORs when the Cursor SDK retries transport stalls and the model stream goes quiet during reconnect.

Idle timeout behavior replaces the old fixed withTimeout race with withIdleTimeout, which only counts stream silence toward --stream-idle-timeout-ms when the runner is not in an SDK retry. The per-task deadline (--task-timeout-ms) still applies during retries. Stream iteration and post-stream wait() both use this helper.

Reconnect detection adds createSdkReconnectProbe, which temporarily wraps console.log/warn/info to infer retry state from SDK diagnostics (AGENT_ERROR_DIAGNOSTICS decision=RETRY/THROW, [nal_agent_retries] lines), keyed by originalRequestId for parallel tasks. Local agents are created with enableAgentRetries: true. @cursor/sdk is bumped to ^1.0.30 (lockfile slimmed; Node >=22.13 on the SDK).

Changes are mirrored in .cursor/skills/dag-task-runner; skill docs note that idle timeout pauses while reconnecting. Removes disable-model-invocation from the skill frontmatter. Adds pnpm test covering idle timeout and reconnect probe edge cases.

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

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread sdk/dag-task-runner/src/run_dag.ts Outdated
…cal option.

onConnectionStateChange is not forwarded on LocalAgentOptions, so the reconnect flag never flipped.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread sdk/dag-task-runner/src/sdk_reconnect.ts
Counting every decision=RETRY left isRetrying stuck after a reconnect that retried twice or ended in THROW.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using high effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit e1d79ae. Configure here.

Comment thread sdk/dag-task-runner/src/sdk_reconnect.ts
Unlabeled Request successful / Error not retryable was clearing every in-flight reconnect.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

DAG runner idle timeout kills tasks during an in-progress SDK reconnect

1 participant