glob: literal null and undefined directory names search the workspace root
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- bun, typescript
Hướng nghiên cứu
Bắt đầu tại packages/core/src/tool/plugin/glob.ts, nơi issue cho biết các đường dẫn nguyên văn bị chuyển thành undefined; lần theo cách đường dẫn được cung cấp đi đến tìm kiếm ripgrep. Tái hiện lỗi bằng tập lệnh Bun được cung cấp từ packages/core và so sánh null, undefined với ordinary. Hoàn thành khi mỗi thư mục được cung cấp chỉ trả về các tệp của chính nó và có kiểm thử hồi quy bao quát các tên nguyên văn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
The glob tool interprets the literal directory names null and undefined as an omitted path. A search scoped to either directory instead runs from the workspace root and includes unrelated files, potentially hiding relevant results under the result limit. Other directory names work normally.
Reproduction
On dev commit 82666b6612cdb2ba13a7a26e150b21e897a80373, save the following as /tmp/oc-glob-repro.ts and run from packages/core:
bun -e "$(cat /tmp/oc-glob-repro.ts)"
import { Effect, Layer } from "effect"
import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder"
import { makeLocationNode } from "@opencode/util/effect/app-node"
import { LayerNode } from "@opencode/util/effect/layer-node"
import { Environment } from "@opencode/core/environment/index"
import { Location } from "@opencode/core/location"
import { FileAccess } from "@opencode/core/file-access"
import { Permission } from "@opencode/core/permission"
import { Ripgrep } from "@opencode/core/ripgrep"
import { AbsolutePath } from "@opencode/core/schema"
import { Session } from "@opencode/core/session"
import { GlobTool } from "@opencode/core/tool/plugin/glob"
import { Tool } from "@opencode/core/tool"
import { location } from "./test/fixture/location"
import { permissionLayer } from "./test/lib/permission"
import { executeTool, registerToolPlugin, toolIdentity } from "./test/lib/tool"
import { mkdtemp, mkdir } from "node:fs/promises"
const dir = await mkdtemp("/tmp/oc-glob-")
await mkdir(`${dir}/null`)
await mkdir(`${dir}/undefined`)
await mkdir(`${dir}/ordinary`)
await Bun.write(`${dir}/null/inside.txt`, "x")
await Bun.write(`${dir}/undefined/inside.txt`, "x")
await Bun.write(`${dir}/ordinary/inside.txt`, "x")
await Bun.write(`${dir}/outside.txt`, "x")
const node = makeLocationNode({ name:"glob-repro", layer:Layer.effectDiscard(registerToolPlugin(GlobTool.Plugin)), deps:[Tool.node,Environment.node,Ripgrep.node,Location.node,FileAccess.node,Permission.node] })
const layer = AppNodeBuilder.build(LayerNode.group([Tool.node,node]), [Location.node.replace(Layer.succeed(Location.Service,Location.Service.of(location({directory:AbsolutePath.make(dir)})))),Permission.node.replace(permissionLayer({assert:()=>Effect.void}))])
await Effect.runPromise(Effect.gen(function*(){const registry=yield* Tool.Service; for(const path of ["null","undefined","ordinary"]) {const r=yield* executeTool(registry,{sessionID:Session.ID.make("ses_repro"),...toolIdentity,call:{type:"tool-call",id:`call-${path}`,name:"glob",input:{pattern:"*.txt",path}}}); console.log(path,JSON.stringify(r.output));}}).pipe(Effect.provide(layer)))
Actual: both null and undefined calls return all four files, including outside.txt; ordinary returns only ordinary/inside.txt. Logs show ripgrep runs at the workspace root for the first two calls and inside ordinary for the third. Expected: each supplied path scopes the search to that directory. This executes the registered GlobTool and real ripgrep, with a test permission fixture. glob.ts explicitly converts the two strings to undefined; its source blob matches upstream dev.
- Ngôn ngữ chính
- TypeScript
- Star
- 224k
- Fork
- 30k
- Merge trung bình
- 7 giờ 30 phút
- Pull request đã merge (30 ngày)
- 489
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của anomalyco/opencode
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
anomalyco/opencode#60584 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
core: OpenRouter BYOK sessions record cost = 0 since v2.2.0 (ignores cost_details.upstream_inference_cost)Có thể đã có người làm @tneemo đã nhận 2 ngày trước. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#60558 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#60541 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
anomalyco/opencode#60529 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anomalyco/opencode#60469 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/opencode
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Doist/todoist-sdk-typescript#740 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:auth-provider issue-rating: 🦞 diamond lobster no-stale P1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
steipete/oracle#614 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MoonshotAI/kimi-code#4591 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Koenkk/zigbee-herdsman-converters#13656 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Report: Mooz Dance SDĐang mởcheck:passed streams:remove
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày