Skip to content

fix(agent): prevent historical OOB steer replay - #78386

Closed
burak33bb wants to merge 1 commit into
NousResearch:mainfrom
burak33bb:agent/prevent-historical-steer-replay
Closed

burak33bb wants to merge 1 commit into
NousResearch:mainfrom
burak33bb:agent/prevent-historical-steer-replay

Conversation

@burak33bb

@burak33bb burak33bb commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #78237

Summary

Prevent an already-delivered mid-turn user message from being interpreted again as a fresh OUT-OF-BAND instruction during a long-running turn.

Root cause

Hermes appends trusted OOB messages to a tool result. That marker remains in immutable conversation history and is therefore included in later API requests.

The existing system-prompt contract established that the marker was trustworthy, but did not distinguish:

  • a newly delivered marker in the latest tool-result batch, from
  • a historical marker already followed by an assistant response.

A model could consequently interpret the historical marker as a new instruction and repeat previously completed, potentially non-idempotent work.

Fix

  • Mark each OOB block as a single delivery at its exact conversation position.
  • Explicitly state that replaying the block from history is not another delivery.
  • Define a marker as fresh only when it belongs to the latest tool-result batch and no later assistant message follows it.
  • Tell the model not to repeat completed work solely because an OOB record remains in history.

The fix does not mutate previous messages, rebuild the system prompt mid-conversation, or change message-role alternation, so prompt-cache stability is preserved.

Duplicate check

No PR currently references or fixes #78237.

Related work was inspected and is distinct:

None defines the one-shot lifetime of a genuine historical OOB marker.

Validation

  • tests/run_agent/test_steer.py
  • tests/agent/test_prompt_builder.py
  • 83 targeted tests passed
  • Ruff passed
  • git diff --check passed

The broader tests/agent/test_system_prompt.py file has an unrelated pre-existing Windows path-normalization assertion (/hermes vs \hermes); the changed OOB suites are green.

@burak33bb burak33bb changed the title fix(agent): prevent historical steer replay fix(agent): prevent historical OOB steer replay Aug 4, 2026
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P1 High — major feature broken, no workaround sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 4, 2026
@kshitijk4poor

Copy link
Copy Markdown
Contributor

Merged via #79170 — your commits cherry-picked onto current main with authorship preserved (rebase merge).

Thank you for the contribution! The steer marker one-shot lifetime contract is a solid defense-in-depth improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P1 High — major feature broken, no workaround sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User message re-injected mid-turn hours after original delivery (duplicate OUT-OF-BAND message)

3 participants