docs(hooks): note stateful-provider caveat on ephemeral context injections - #329
Merged
Brian Krabach (bkrabach) merged 1 commit intoAug 28, 2026
Merged
Conversation
…tions
context/understanding-mechanisms/mechanisms/hooks.md's 'Ephemeral
Injections' section describes only what Amplifier's local context module
does with an ephemeral=True injection (never passed to
context.add_message(), 'evaporates after the call'). That's accurate
locally, but on providers that chain conversation state server-side
(e.g. OpenAI's Responses API with previous_response_id), the message still
persists in the provider's own server-held history for the rest of the
chain once sent -- there is no retraction API, and repeated injections
accumulate rather than replace. Hook authors reading this doc had no way
to know the local guarantee doesn't extend past the wire.
Adds one caveat paragraph pointing to amplifier-core's docs/HOOKS_API.md
('Ephemeral Semantics on Stateful Providers', added in a companion PR)
for the full contract.
Investigated microsoft/amplifier-foundation's modules/ tree for the same
overclaim in hook module docstrings, per the task's request to check
modules/hooks-status-context and modules/hooks-todo-reminder specifically:
neither exists in this repo -- both are external modules (sourced via
behaviors/status-context.yaml and behaviors/todo-reminder.yaml from
microsoft/amplifier-module-hooks-status-context and
microsoft/amplifier-module-hooks-todo-reminder respectively, confirmed via
git log -- these paths never existed in this repo's history), the same
situation as wayfinder. The only in-tree modules using ephemeral=True
(hooks-process-guard, hooks-progress-monitor) don't carry an explanatory
docstring claim, so there was nothing to correct there. modules/tool-delegate
left untouched, per scope.
Docs-only -- zero behavior changes. Full suite: 1790 passed, 1 skipped
(1791 collected; no regressions from baseline).
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Collaborator
Author
|
Admin merge notice: this PR is self-authored (docs-only, zero behavior |
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.
Summary
context/understanding-mechanisms/mechanisms/hooks.md's "EphemeralInjections" section describes what Amplifier's local context module
does with an
ephemeral=Trueinjection ("never passed tocontext.add_message()", "evaporates after the call"). That's accuratefor the local context module, but on providers that chain conversation
state server-side (e.g. OpenAI's Responses API with
previous_response_id), the message still persists in the provider's ownserver-held history for the rest of the chain once sent — there's no
retraction API, and repeated injections accumulate rather than replace.
Hook authors reading this doc had no way to know the local guarantee
doesn't extend past the wire.
This is a docs-only PR — zero behavior changes.
What's added
One caveat paragraph in the "Ephemeral Injections (recommended default)"
section, pointing to amplifier-core's
docs/HOOKS_API.md("EphemeralSemantics on Stateful Providers", added in microsoft/amplifier-core#105)
for the full contract:
Scope note (discrepancy found during investigation)
The task driving this PR named two specific targets to check:
modules/hooks-status-contextand the todo reminder hook(
hooks-todo-reminder). Neither exists in this repo. Both areexternal modules, sourced via
git+https://inbehaviors/status-context.yamlandbehaviors/todo-reminder.yamlrespectively:
hooks-status-context→microsoft/amplifier-module-hooks-status-contexthooks-todo-reminder→microsoft/amplifier-module-hooks-todo-reminderConfirmed via
git log --all -- modules/hooks-status-context/modules/hooks-todo-reminder(empty — these paths never existed in thisrepo's history). This is the same situation the task already flagged for
wayfinder("lives in its own repo — skip it"); I've applied the sametreatment here rather than fabricating edits to nonexistent paths.
I grepped the full
modules/tree for the same overclaim pattern. Theonly in-tree modules constructing
HookResult(..., ephemeral=True, ...)are
hooks-process-guardandhooks-progress-monitor— neither carriesan explanatory docstring/comment making the "not stored" claim, just the
field usage itself, so there was nothing to correct there.
modules/tool-delegatewas left untouched, per scope.If the two external modules' own docstrings need the same fix, that's a
follow-up PR against their own repos (out of scope here, same as
wayfinder).
Testing
Docs-only change (one markdown file). Full test suite run before opening
this PR: 1790 passed, 1 skipped (1791 collected via
uv run pytest -q) — no failures, no regressions.🤖 Generated with Amplifier