Skip to content

cp: fix(agent): keep observations from every SimpleAgent session activation (4114) into r0.7.0 - #4123

Merged
ananthsub merged 1 commit into
r0.7.0from
cherry-pick-4114-r0.7.0
Oct 6, 2026
Merged

ananthsub merged 1 commit into
r0.7.0from
cherry-pick-4114-r0.7.0

Conversation

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

beep boop [🤖]: Hi @ananthsub 👋,

we've cherry picked #4114 into  for you! 🚀

Please review and approve this cherry pick by your convenience!

…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]>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor Author

/ok to test b6af5a0

@copy-pr-bot

copy-pr-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ananthsub
ananthsub enabled auto-merge (squash) October 6, 2026 19:03
@ananthsub
ananthsub merged commit 9f8b218 into r0.7.0 Oct 6, 2026
40 checks passed
@ananthsub
ananthsub deleted the cherry-pick-4114-r0.7.0 branch October 6, 2026 19:16

This branch was previously deployed

1 inactive deployment
public — b6af5a06 Deployed Oct 6, 2026 by copy-pr-bot[bot] via release / finalize / notify #4457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants