fix(code): prevent post-tool hook replay - #5376
Merged
Alexander Olsen (aolsenjazz) merged 3 commits intoAug 7, 2026
Merged
Conversation
Checkpoint tool results before post-execution hook interrupts so resuming a hook never re-runs side-effecting tools. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Alexander Olsen (aolsenjazz)
force-pushed
the
mdrxy/code/post-tool-hook-replay
branch
from
August 7, 2026 01:56
c4ab7b6 to
aca5c94
Compare
Alexander Olsen (aolsenjazz)
requested a review
from Johannes du Plessis (johannes117)
August 7, 2026 11:44
Alexander Olsen (aolsenjazz)
marked this pull request as ready for review
August 7, 2026 11:45
Johannes du Plessis (johannes117)
approved these changes
Aug 7, 2026
Alexander Olsen (aolsenjazz)
deleted the
mdrxy/code/post-tool-hook-replay
branch
August 7, 2026 14:16
Alexander Olsen (aolsenjazz)
pushed a commit
that referenced
this pull request
Aug 7, 2026
> [!CAUTION] > Merging this PR will automatically publish to **PyPI** and create a **GitHub release**. For the full release process, see [`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md). --- _Release notes preview: keep this section in sync with the package `CHANGELOG.md`. Publish reads the merged CHANGELOG via `release.yml`, not this PR description — keep them aligned anyway so the PR stays an accurate historical record for reviewers and anyone returning later._ --- ## [0.1.54](deepagents-code==0.1.53...deepagents-code==0.1.54) (2026-08-07) ### Features - Added Meta `muse-spark-1.2` to the model switcher ([#5389](#5389)). - Improved diff readability with quieter hunks and word-level highlights ([#5106](#5106)). ### Bug Fixes - Hid startup tips when resuming threads ([#5349](#5349)). - Prevented post-tool hook replay ([#5376](#5376)). - Stored update logs under the OS cache directory ([#5363](#5363)). _End release notes preview._ --- > [!NOTE] > A **New Contributors** section is appended to the GitHub release notes automatically at publish time (see [Release Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline), step 2). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
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.
Post-execution hooks no longer replay tools when resumed, preventing duplicate side effects in all Hooks v2 sessions.
PostToolUse,PostToolUseFailure, andSubagentStoppreviously interrupted inside the tools node after execution but before its result committed. This moves those interrupts to a checkpoint-safe post-tools boundary while preserving duration reporting and result feedback/context rewriting through private state. Hooks v2 has loaded by default since #5307, so the fix applies regardless ofDEEPAGENTS_CODE_EXPERIMENTAL.Test plan
make lintuv run --group test pytest -q tests/unit_tests/hooks(220 passed)Made by Open SWE