Refresh step world state for all sessions (#33665)

## Why

Changes to the selected working directory can select different `AGENTS.md`
instructions. These updates need to reach the model even when the deferred
executor feature is disabled.

## What changed

- Refresh environment readiness and `AGENTS.md` before capturing each step.
- Record model-visible world-state changes for every session instead of gating
  them on the deferred executor feature.
- Preserve the initial environment context without duplicating it.

## Testing

- Cover `AGENTS.md` replacement after a working-directory change.
- Verify that initial environment context remains unique with the deferred
  executor both enabled and disabled.

GitOrigin-RevId: ea5dbe590cc049170259e7eccb6a3346fb2ed8e6
This commit is contained in:
sayan-oai authored and copyberry committed 2026-07-16 18:45:42 +00:00
1 parent 5331d20f6e
commit 71448a29e7
8 files changed
+63 -74

No files matched your search

+3 -9
View File
@@ -259,15 +259,9 @@ pub(crate) async fn run_turn(
)
.await?;
if turn_context
.config
.features
.enabled(Feature::DeferredExecutor)
{
world_state = sess
.record_step_world_state_if_changed(&world_state, step_context.as_ref())
.await;
}
world_state = sess
.record_step_world_state_if_changed(&world_state, step_context.as_ref())
.await;
// Construct the input that we will send to the model.
let sampling_request_input: Vec<ResponseItem> = async {