Repository navigation
cp: fix(agent): keep observations from every SimpleAgent session activation (4114) into r0.7.0 - #4123
Merged
Merged
Conversation
…on (#4114) ## What does this PR do? Makes a SimpleAgent agent session return the observations of every activation at close, not only the last one. During a session, each `/v1/responses` call replaced `state.observations` with that call's invocation. An environment server that drives several activations through one session, such as the user simulation stack (#3800, #4080), would receive only the final activation's invocation at close, and `ng_agent_observations` would show one model call where there were several. `single_agent_turn` makes one call per session, so it was unaffected. The fix: - Records and gaps now accumulate across a session's activations. The bundle is rebuilt each time, so its unique-ID and parent-graph checks still run. - Every activation used the invocation ID `"root"`, so accumulating them would fail the bundle's unique-ID check. Later activations in a session now use `activation-<n>`. The first keeps `"root"`, so single-activation sessions report exactly what they did before. No issue is linked; this is a follow-up to #3784, found while reviewing the SimpleAgent changes in the user simulation stack. ## Validation - New test `test_agent_session_returns_observations_from_every_activation`: two activations in one session return two invocations, `root` and `activation-2`, each linked to its own model response. It fails without the fix. - `pytest responses_api_agents/simple_agent/tests environment_servers/single_agent_turn/tests environment_servers/single_agent_turn_legacy/tests`: all pass. - `pytest tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_base_responses_api_agent.py tests/unit_tests/test_rollout_observability.py`: all pass. - `pre-commit run` on the changed files: all pass. ## Rollouts N/A. Single-activation sessions, which every current configuration uses, produce the same observations as before. The change affects only sessions with several activations, which the user simulation environment server introduces; that stack carries its own rollout evidence. ## Compatibility No configuration change. For sessions with more than one activation, `ng_agent_observations` now contains one invocation per activation instead of only the last. Signed-off-by: Ananth Subramaniam <[email protected]> Signed-off-by: NeMo Bot <[email protected]>
Contributor
Author
|
/ok to test b6af5a0 |
ananthsub
approved these changes
Oct 6, 2026
This branch was previously deployed
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.
beep boop [🤖]: Hi @ananthsub 👋,