Skip to content

fix: prevent async functional API from double-consuming interrupt resume values#6739

Open
abhigyan631 wants to merge 4 commits intolangchain-ai:mainfrom
abhigyan631:fix/async-functional-api-double-resume-consumption
Open

fix: prevent async functional API from double-consuming interrupt resume values#6739
abhigyan631 wants to merge 4 commits intolangchain-ai:mainfrom
abhigyan631:fix/async-functional-api-double-resume-consumption

Conversation

@abhigyan631
Copy link

Fix for issue #6660.

In async mode, both parent and child scratchpads were capturing references to the same resume tuple in pending_writes. When both attempted to consume the value, it caused iterations to be skipped (e.g., output 1, 123, 12345 instead of expected 1, 12, 123, 1234, 12345).

The fix ensures child scratchpads always delegate to parent for null_resume, preventing the double-consumption race condition. Only the parent scratchpad now 'owns' the resume value lookup.

Thank you for contributing to LangGraph! Follow these steps to mark your pull request as ready for review. If any of these steps are not completed, your PR will not be considered for review.

  • PR title: Follows the format: {TYPE}({SCOPE}): {DESCRIPTION}

    • Examples:
      • feat(core): add multi-tenant support
      • fix(cli): resolve flag parsing error
      • docs(openai): update API usage examples
    • Allowed {TYPE} values:
      • feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, release
    • Allowed {SCOPE} values (optional):
      • langgraph, docs, cli, checkpoint, checkpoint-postgres, checkpoint-sqlite, prebuilt, scheduler-kafka, sdk-py
    • Once you've written the title, please delete this checklist item; do not include it in the PR.
  • PR message: Delete this entire checklist and replace with

    • Description: a description of the change. Include a closing keyword if applicable.
    • Issue: the issue # it fixes, if applicable
    • Dependencies: any dependencies required for this change
    • Twitter handle: if your PR gets announced, and you'd like a mention, we'll gladly shout you out!
  • Add tests and docs: If you're adding a new integration, you must include:

    1. A test for the integration, preferably unit tests that do not rely on network access,
    2. An example notebook showing its use. It lives in docs/docs/integrations directory.
  • Lint and test: Run make format, make lint and make test from the root of the package(s) you've modified. We will not consider a PR unless these three are passing in CI. See contribution guidelines for more.

Additional guidelines:

  • Make sure optional dependencies are imported within a function.
  • Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests.
  • Most PRs should not touch more than one package.
  • Changes should be backwards compatible.

abhigyan631 and others added 2 commits February 2, 2026 16:19
…ume values

Fix for issue langchain-ai#6660.

In async mode, both parent and child scratchpads were capturing references
to the same resume tuple in pending_writes. When both attempted to consume
the value, it caused iterations to be skipped (e.g., output 1, 123, 12345
instead of expected 1, 12, 123, 1234, 12345).

The fix ensures child scratchpads always delegate to parent for null_resume,
preventing the double-consumption race condition. Only the parent scratchpad
now 'owns' the resume value lookup.
@hinthornw
Copy link
Collaborator

Do you happen to have a test case that reproduces this?

@abhigyan631
Copy link
Author

Do you happen to have a test case that reproduces this?

Yes, I've added a regression test case, test_repro_issue_6660.py, that reproduces the reproduction scenario (5 async tasks/resumes).

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.

2 participants