Skip to content

fix(code): prevent post-tool hook replay - #5376

Merged
Alexander Olsen (aolsenjazz) merged 3 commits into
mainfrom
mdrxy/code/post-tool-hook-replay
Aug 7, 2026
Merged

fix(code): prevent post-tool hook replay#5376
Alexander Olsen (aolsenjazz) merged 3 commits into
mainfrom
mdrxy/code/post-tool-hook-replay

Conversation

@mdrxy

@mdrxy Mason Daugherty (mdrxy) commented Aug 6, 2026

Copy link
Copy Markdown
Member

Post-execution hooks no longer replay tools when resumed, preventing duplicate side effects in all Hooks v2 sessions.


PostToolUse, PostToolUseFailure, and SubagentStop previously 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 of DEEPAGENTS_CODE_EXPERIMENTAL.

Test plan
  • make lint
  • uv run --group test pytest -q tests/unit_tests/hooks (220 passed)

Made by Open SWE

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Open SWE Review: No issues found

Open SWE reviewed this PR and found no potential bugs to report.

Open in WebView Open SWE trace

@github-actions github-actions Bot added dcode Related to `deepagents-code` fix A bug fix (PATCH) size: M 200-499 LOC labels Aug 6, 2026
Mason Daugherty (mdrxy) and others added 2 commits August 6, 2026 21:55
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>
@aolsenjazz
Alexander Olsen (aolsenjazz) merged commit d37b54f into main Aug 7, 2026
57 checks passed
@aolsenjazz
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dcode Related to `deepagents-code` fix A bug fix (PATCH) size: M 200-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants