Fixes #37650 - #41671
Fixes #37650#41671asiimhusain wants to merge 4 commits into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #37965: This PR appears to be directly related to your current PR #41671. Both address the same issue: omitting undefined optional keys from glob/grep permission metadata. This could indicate that:
Recommend checking PR #37965 to understand if it covers the same fixes or if they target different but related parts of the system. |
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Issue for this PR
tools: optional search metadata breaks pending permission listing
#37650
Type of change
What does this PR do?
When executing
globandgreptools without optional parameters,params.pathandparams.includeareundefined. Previously, these were passed directly into the permission requestmetadataobject (e.g.,{ pattern: "...", path: undefined, include: undefined }), leaving keys withundefinedvalues that can cause schema encoding or serialization issues.This PR fixes the issue by:
pathandincludeto permission requestmetadataonly when defined inGlobTool(packages/opencode/src/tool/glob.ts) andGrepTool(packages/opencode/src/tool/grep.ts).undefinedmetadata values inPermission.ask(packages/opencode/src/permission/index.ts) before building the permission request object.How did you verify your code works?
Added unit tests to verify permission request metadata construction and schema encoding:
packages/opencode/test/permission/next.test.ts: Verified permission requests omitundefinedmetadata properties and encode properly withSchema.encode(Schema.Array(PermissionV1.Request)).packages/opencode/test/tool/glob.test.ts: VerifiedGlobToolomitspathkey when not supplied and includes it when provided.packages/opencode/test/tool/grep.test.ts: VerifiedGrepToolomitspathandincludekeys when not supplied and includes them when provided.Screenshots / recordings
N/A (No UI changes)
Checklist