Skip to content

Add FS abstraction and use in view_image#14960

Merged
pakrym-oai merged 6 commits intomainfrom
pakrym/add-fs-abstraction-and-use-in-view-image
Mar 18, 2026
Merged

Add FS abstraction and use in view_image#14960
pakrym-oai merged 6 commits intomainfrom
pakrym/add-fs-abstraction-and-use-in-view-image

Conversation

@pakrym-oai
Copy link
Collaborator

@pakrym-oai pakrym-oai commented Mar 17, 2026

Adds an environment crate and environment + file system abstraction.

Environment is a combination of attributes and services specific to environment the agent is connected to:
File system, process management, OS, default shell.

The goal is to move most of agent logic that assumes environment to work through the environment abstraction.

/// Session-scoped model client shared across turns.
pub(crate) model_client: ModelClient,
pub(crate) code_mode_service: CodeModeService,
pub(crate) environment: Arc<Environment>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended to be an ExecutorEnvironment, is that right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, do you want it renamed? type or type and field?


if !metadata.is_file() {
let abs_path =
AbsolutePathBuf::try_from(turn.resolve_path(Some(args.path))).map_err(|error| {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so ultimately, this view_image tool should be run on the executor? So resolve_path() will work since it will be speaking in terms of its own local path?

Though I don't know if it will ultimately have TurnContext?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll move resolve_path to be remote path aware.

}
}

fn copy_dir_recursive(source: &Path, target: &Path) -> io::Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, given the recursion, I guess sync makes this all a bit simpler. Maybe we add a _blocking suffix to this name?

source: &Path,
destination: &Path,
) -> io::Result<bool> {
let source = std::fs::canonicalize(source)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is tricky. Canonicalization is not always what you want here?

}
}

fn copy_dir_recursive(source: &Path, target: &Path) -> io::Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just use fs_extra?

@bolinfest bolinfest self-requested a review March 18, 2026 00:06
@pakrym-oai pakrym-oai merged commit 83a60fd into main Mar 18, 2026
33 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/add-fs-abstraction-and-use-in-view-image branch March 18, 2026 00:36
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants