Repository navigation
Workspace file APIs: glob and search - #13633
Merged
Merged
Conversation
This was referenced Jul 13, 2026
vito
force-pushed
the
llm-workspace-file-apis
branch
from
July 13, 2026 21:27
a401ef8 to
c5420c2
Compare
vito
force-pushed
the
llm-workspace-engine-tui-fixes
branch
from
July 13, 2026 21:57
320d61a to
a0981f4
Compare
vito
force-pushed
the
llm-workspace-file-apis
branch
4 times, most recently
from
July 14, 2026 02:13
1d2c945 to
ad03dfd
Compare
vito
marked this pull request as ready for review
July 14, 2026 02:41
grouville
force-pushed
the
llm-workspace-engine-tui-fixes
branch
from
July 14, 2026 08:56
a0981f4 to
e38e693
Compare
grouville
reviewed
Jul 14, 2026
grouville
reviewed
Jul 14, 2026
grouville
reviewed
Jul 14, 2026
database/sql had no MaxOpenConns limit, so each concurrent query got its own SQLite connection. SQLite only allows one writer at a time; under write contention every extra connection spins in the busy handler, and in modernc.org/sqlite that wait is a raw nanosleep syscall pinning an OS thread per connection. During a burst of concurrent telemetry inserts this exhausted the Go runtime's 10000-thread limit and crashed the engine. With a single connection, concurrent queries queue in database/sql's pool (plain goroutine parking) rather than busy-waiting inside SQLite. This trades away WAL-mode read/write concurrency, which is acceptable now that log writes are batched and reads are periodic bounded drains. Signed-off-by: Alex Suraci <[email protected]>
clientLogs was registered directly as a log Processor, so every log record emitted anywhere in the engine did a synchronous InsertLog into the per-client SQLite DB on the emitting goroutine (plus one more per parent client). A single query fanning out into thousands of parallel resolutions (e.g. a large Workspace.search result with all fields selected) piled thousands of concurrent writers onto SQLite's write lock, each busy-waiting in a raw nanosleep syscall that pins an OS thread in modernc.org/sqlite, crashing the engine with "fatal error: thread exhaustion" once the runtime hit its 10000-thread limit. Wrap the exporter in a BatchProcessor with the same NearlyImmediate interval already used for live span batching, so records are queued and inserted by one background goroutine per client instead. The synchronous OnEmit path is removed so it can't be reintroduced by accident. Signed-off-by: Alex Suraci <[email protected]>
Resolve and the list-element path in resolvePath used unbounded conc pools: one goroutine per sibling selection and one per list element, recursively. A single query selecting several fields on a large list (e.g. thousands of Workspace.search results) exploded into tens of thousands of concurrent resolutions, each emitting telemetry, which contributed to a thread-exhaustion engine crash. Cap each pool at 100 goroutines. Pools are per-node, so this bounds fan-out width rather than total request concurrency, and each pool's limiter is independent, so a blocked parent pool cannot deadlock a child pool. Legitimate parallel workloads still run 100 wide per level; pathological fan-outs are throttled instead of unbounded. Signed-off-by: Alex Suraci <[email protected]>
IsExpanded gated tool-call and rolled-up spans behind an unconditional neverExpand check, so no verbosity level could ever open them. Zooming a slow LLM tool call with 'dagger trace --span <id> -vvvvv' showed the same collapsed rollup as with no flag, hiding the call tree beneath it. Let a verbosity at or above the expand-completed threshold punch through the rollup boundary, matching the existing alwaysExpand gate, and honor per-span verbosity like the sibling ShouldShow checks. Below that threshold the guts stay hidden as before. Signed-off-by: Alex Suraci <[email protected]>
The trace loader always streamed priority spans and backfilled subtrees lazily on expand. But at a verbosity that expands every completed span (or --debug/--expand), the whole tree renders open, so lazy loading just leaves never-expanded spans unfetched in report mode's single render and costs a round-trip per expand interactively. Fetch the entire trace up front (Incremental: false) when the tree is going to be fully expanded anyway, keyed on the same threshold IsExpanded uses. Lower verbosities keep the incremental behavior. Signed-off-by: Alex Suraci <[email protected]>
Mirrors Directory.glob for the host filesystem. Adds a new GlobCallerHostPath engine capability that walks the host directory and matches paths against a glob pattern using the same patternmatcher used by Directory.glob, avoiding any filesync. Signed-off-by: Alex Suraci <[email protected]>
Mirrors Directory.search for the host filesystem. Runs ripgrep client-side via a new SearchCallerHostPath engine capability, falling back to grep if rg is unavailable. Avoids any filesync — the search tool runs directly on the caller's host and returns structured results over the existing diffcopy protocol. Emits search results to the span's stdout using the same format as Directory.search: file paths for files-only mode, or file:line:content for full results. Logging happens engine-side as results are received from the client. The client additionally creates an internal span so you can see exactly the command it shelled out to and results it saw. Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
TestBaseSchemaAllowlist failed in CI because the new Workspace.glob and
Workspace.search fields were installed without a view gate, leaking them
into the base schema visible to the oldest supported module view. Gate
both fields with View(AfterVersion("v1.0.0-0")) like the rest of the
native workspace API surface, and bump the globber, searcher, and
files-searcher test fixture modules to engineVersion v1.0.0 so they can
still see the gated fields, mirroring the precedent set for
Workspace.cwd fixtures in b1fab4b.
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Workspace.search passed explicit path operands straight to ripgrep or grep with cmd.Dir set to the workspace root, so arguments like ../secret.txt could read files outside the workspace. Validate and normalize paths the same way Directory.search does: treat absolute paths as root-relative, reject anything non-local after cleaning, and resolve symlinks scoped to the root so a symlinked operand cannot point outside it either. Signed-off-by: Alex Suraci <[email protected]>
The grep fallback only honored the search limit when parsing content matches; the files-only branch appended every file grep printed. Stop appending once the limit is reached, matching the ripgrep path. Signed-off-by: Alex Suraci <[email protected]>
globHostPath walked the entire host directory tree even after the request context was canceled, since WalkDir had no way to observe it. Pass the stream context in and check it from the walk callback so the walk stops promptly when the caller goes away. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
llm-workspace-file-apis
branch
from
July 14, 2026 14:55
aad0a00 to
c767c6f
Compare
Contributor
Author
|
@grouville Fixed all three and pulled in the tests - thanks! edit, related: also pointed this PR against |
grouville
self-requested a review
July 14, 2026 17:46
grouville
force-pushed
the
llm-workspace-file-apis
branch
from
July 14, 2026 17:47
c767c6f to
03f6e49
Compare
grouville
approved these changes
Jul 14, 2026
vito
force-pushed
the
llm-workspace-file-apis
branch
from
July 14, 2026 18:02
03f6e49 to
c767c6f
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.
Note
Stack 2/5, stacked on #13600 — each PR is based on the one below it, so the diff shows only this PR's own changes. Merge bottom-up; when a PR below merges and its branch is deleted, GitHub retargets this one automatically and the rest of the stack gets rebased.
Adds two file-discovery APIs to Workspace:
🤖 Generated with Claude Code