feat(multi-env): manifest provider + per-env tool family + system prompt block#5
Open
imryao wants to merge 33 commits into
Open
feat(multi-env): manifest provider + per-env tool family + system prompt block#5imryao wants to merge 33 commits into
imryao wants to merge 33 commits into
Conversation
…SERVERS_JSON constant
…eExecServerClient
…entry auth resolution
…provider default id honored
…pagates LLM env_id
…iedExecRequest" This reverts commit 79f4e6d.
…vironment_id property" This reverts commit 27b8f73.
…d property" This reverts commit 7d1b2f2.
…arams" This reverts commit 03f0098.
…f apply_patch (JSON variant)
…er attaches per-entry description
…wing Pa.5 mirrors view_image but routes the image read to a non-default env's ExecutorFileSystem::read_file. Schema requires environment_id + path; no detail=original knob (re-plumbing the model capability gate would risk silent divergence — added in a future spec when needed). Output mirrors view_image: emits ImageView turn item, returns an InputImage content block carrying the resized data URL with default detail. Module is dead code until Pa.7 wires registration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… — env-aware file IO
Pa.7. Registers the seven env-aware tools (exec_command_in_environment, apply_patch_in_environment, list_environments, list_dir_in_environment, view_image_in_environment, read_file_in_environment, write_file_in_environment) so the LLM actually sees them. Gating: ToolsConfig gains multi_environment_count (default 1). The new tools are advertised only when has_environment is true and the count is >= 2. With a single environment, env routing is meaningless and the native tools cover the surface byte-identically to upstream. Plumbing: TurnContext supplies the count from its TurnEnvironment list (turn_context.rs and review.rs). EnvironmentManager gains a public environments_count() accessor for callers that want to drive the gate from the registry directly. Dispatch: ToolHandlerKind grows seven new variants and spec.rs maps each to its handler. Removes the #![allow(dead_code)] umbrella from the seven handler modules and the #[allow(unused_imports)] from the re-exports in tools/src/lib.rs and core/src/tools/handlers/mod.rs; TOOL_NAME constants get per-item allows since runtime registration uses string literals.
added 3 commits
May 6, 2026 19:24
…nts> system prompt block
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
End-to-end multi-environment support in our agentserver codex fork. 33 commits ahead of
main. Lets a singlecodexsession run shell/file ops against multiple execution environments declared via a JSON manifest, with per-environment auth tokens and an LLM-facing tool family that explicitly carriesenvironment_id.What landed (4 layers)
P1 — manifest loader (
exec-servercrate)ManifestEnvironmentProviderreadsCODEX_EXEC_SERVERS_JSON, validates entries (no dupe ids, default present), resolves per-entry bearer tokens from env varsEnvironment::remote_with_auth(...)constructor;Environment.description: Option<String>LazyRemoteExecServerClient::with_auth(...)injectsAuthorization: Bearer …on connectCODEX_EXEC_SERVER_URLpath preserved byte-identically; manifest wins when both set (withtracing::warn!)exec-server/tests/manifest_provider.rsP2 — env selection in
coreTurnContext::select_environment(Option<&str>) -> Option<&TurnEnvironment>(None → primary)UnifiedExecRequest.environment_idandApplyPatchRequest.environment_idfieldsprimary_environment()→select_environment(env_id)intercept_apply_patch(env_id)lets shell→apply_patch chains carry envP3 — schema honesty (REVERSAL from original plan)
Initial implementation added
environment_idto nativeshell/apply_patchschemas. Reverted in commits0d820d5961/bbba7c6ac2/ddeb163d17/aefa1f7d95to preserve upstream training compatibility — native tools must keep schemas the model has seen during pretraining. See `fix(core): shell schema honesty …` for rationale.Replacement: a parallel `*_in_environment` tool family (gated on `env_count >= 2`):
All file-system tools route through `Environment::get_filesystem()`, no direct `tokio::fs`.
P4 — system prompt block
Backwards compatibility
Out of scope (known limitations)
Test Plan
Local verification (run from `/root/codex-multi-env/codex-rs` on this branch):
Notes for reviewers
🤖 Generated with Claude Code