Skip to content

Keep active turn environment during ACP turn/steer - #8530

Open
lanjak wants to merge 2 commits into
get-bb:mainfrom
lanjak:lanjak/fix-8512-keep-active-env-during-acp-turn-steer-thr_9cjr2rrf3c
Open

lanjak wants to merge 2 commits into
get-bb:mainfrom
lanjak:lanjak/fix-8512-keep-active-env-during-acp-turn-steer-thr_9cjr2rrf3c

Conversation

@lanjak

@lanjak lanjak commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

runTurn in packages/provider-bridge-acp/src/bridge/bridge.ts called reconcileExecutionSettings (bridge.ts#L3561) for every pending input, including internal inputs created by turn/steer (queued steers during an active turn and steers during unsolicited agent activity). reconcileExecutionSettings merged launchSpec?.env and options.envVars unconditionally, causing changed environment values on a steer to restart the provider process mid-turn instead of waiting for the next turn/start.

What changed

  • packages/provider-bridge-acp/src/bridge/bridge.ts: added preserveActiveEnv?: boolean to AcpPendingTurnInput, set preserveActiveEnv: true on both turn/steer enqueue paths (activePromptKind === "agent" and queuedInputs), and kept session.construction.envVars in reconcileExecutionSettings when preserveActiveEnv is true. Permission and model reconciliation during steer are unchanged, and new environment values still apply on the next turn/start.
  • packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs, bridge.test.ts: updated "reports a permission-changing steer whose replacement fails to start" to trigger session/new failure via launch args (FAKE_ACP_SESSION_NEW_ERROR_ON_ARG) instead of mid-turn env changes, and added 4 regression tests covering options.envVars, launchSpec.env, and overridden inherited env across ordinary, stacked, unsolicited-agent, and permission-changing steers.
  • Docs: none updated; docs/provider-bridge-protocol.md describes turn/steer generally without env-reconciliation internals.

No wire change and no schema change.

How you verified

Base commit: origin/main 4d7a9af609.

Case Before (origin/main) After (eb2eff955f)
turn/steer with changed options.envVars, launchSpec.env, or overridden inherited env (ordinary, stacked, or unsolicited agent turn) Rebuilds process mid-turn with new env B Keeps active env A for the steer; applies B on next turn/start
Permission-changing turn/steer with changed env Rebuilds with new env B Rebuilds with active env A; applies B on next turn/start

All 4 new regression tests in packages/provider-bridge-acp/src/bridge/bridge.test.ts failed before the fix and pass after (5/5 targeted tests pass).

CI parity command:
pnpm exec turbo run typecheck test lint lint:type-aware --filter=@bb/provider-bridge-acp --filter=@bb/provider-parity --continue

  • 9/9 tasks passed (@bb/provider-bridge-acp:test: 23 files, 648 passed / 4 skipped; 0 lint/typecheck warnings or errors).

Fixes #8512

AGENT GENERATED

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP steer applies a changed environment during an active turn

1 participant