Drop ALS fallbacks from containsPath and workspace routing#25374
Merged
kitlangton merged 1 commit intodevfrom May 2, 2026
Merged
Drop ALS fallbacks from containsPath and workspace routing#25374kitlangton merged 1 commit intodevfrom
kitlangton merged 1 commit intodevfrom
Conversation
… routing containsPath now requires an explicit InstanceContext — every existing caller already passes one. Removes the implicit Instance.directory / Instance.worktree reads. WorkspaceRoutingMiddleware's currentDirectory() helper read Instance.directory in a try/catch, but it runs at the routing phase before any instance is bound — the try always threw and the catch always returned process.cwd(). Dead branch removed. Both changes shrink the ALS reader surface by 2 sites.
2b10c53 to
f9a3d0b
Compare
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
Why
Two of the smaller items from the ALS reader audit. Each one shrinks the reader surface without forcing any caller-side change.
On the `process.cwd()` fallback
The new direct `process.cwd()` matches the legacy Hono `InstanceMiddleware` (server/routes/instance/middleware.ts:11), which uses the same chain: `query("directory") || header("x-opencode-directory") || process.cwd()`. If we want a server-bound root (e.g. `opencode serve --directory /foo` captured into a Context.Reference) we should add it to both routing layers in lock-step — separate change.
Tests