GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — refactor(core): file tools use the environment of the path they resolved by kitlangton · Pull Request #64774 · anomalyco/opencode Conversation
|
| Still on the session or the host | Where |
|---|---|
| Running the command | the shell tool; only its working-directory check moved |
| Search | grep, glob |
| Formatting after a write | edit, write, patch |
Finding nested AGENTS.md after a read |
read |
| A move between two environments | patch assumes both ends share one |
| Code Mode's file reads | its writes already go through the target |
| Image and video tools, MCP | untouched |
📊 Proof
The new test points every target at an in-memory environment, while a file with the same name sits on disk, then runs the real write, read, edit and patch tools.
| Check | Result |
|---|---|
| The in-memory file ends with the last edit | ✅ |
| The file on disk is untouched | ✅ |
| The diffs the tools report, and the permission preview, show the in-memory content | ✅ |
The test fails without the change: pointing any one of three reads back at the session (the preview read in write, and the read after the write in edit and in patch) fails it, each on its own assertion.
👀 Read: packages/core/src/tool/plugin/patch.ts. Each pending update now keeps its target beside its content, so the write, the move and the formatting pass each use the right file’s environment. The formatting pass walks the same files in the same order as before. FileMutation and the read tool's filesystem service no longer depend on the environment, so their layers build from nothing. The rest is routine.
🔍 First step of the multi-machine plan · no user reports · no flag, because nothing behaves differently
From packages/core:
bun typecheck: no type errorsbun test test/tool-target-environment.test.ts (new): 1 pass, 0 failtool-read 40 pass · tool-read-filesystem 42 pass · tool-edit 21 pass · tool-write 10 pass · tool-patch 43 passfile-mutation 9 pass · file-access 7 pass · file-access-path 22 pass · session-instructions 8 pass · tool-execute 37 passtool-shell: 96 pass, 2 fail. The two (conditional substitutions respect once and respect always) fail the same way on dev without this change on the Mac they ran on, with wait: pid … is not a child of this shell.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks sound. packages/core type-checks cleanly with tsc (the bun typecheck script needs a newer Bun than this machine has), and the read, write, edit, patch, file-mutation, file-access, session-instructions, tool-execute and shell tests all pass. The new target-environment test passes here and fails on dev, so it covers the change.
I checked the patch.ts formatting pass: de-duplicating the targets by path keeps the same files in the same order as walking the keys of updates, including moves and case-only renames.
Public API: unchanged. FileAccess.Target.environment and the new files argument on the ReadToolFileSystem methods are internal to packages/core.
No blocking concerns.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The new commit looks sound. Formatting in patch.ts now loops over updates, which keeps the same files in the same order as dev, and each file goes through its own target's environment. I re-ran the patch tests and the target-environment test (44 pass, 0 fail), and packages/core type-checks cleanly with tsc. Public API: unchanged. No new concerns.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.