fix(core): keep glob/grep permission metadata JSON-encodable - #44417
Closed
Enough1122 wants to merge 1 commit into
Closed
Enough1122 wants to merge 1 commit into
Enough1122 wants to merge 1 commit into
Conversation
Pending glob and grep permissions stored absent optional tool inputs (path/include/limit) as undefined inside JSON permission metadata, which made session.permission.list reject its own response body with 'Expected JSON value, got undefined'. Build the metadata through a small jsonMetadata helper that omits undefined fields, so permission listing stays schema-valid whether or not optional search inputs are supplied. Fixes anomalyco#37650
Contributor
|
The following comment was made by an LLM, it may be inaccurate: I found two potentially related PRs that address similar permission metadata issues:
These PRs appear to address similar or overlapping issues with undefined values in permission metadata. You may want to check if #40852 is still open or if it was previously closed, since the PR description mentions that #44375 was auto-closed before the template could be completed. |
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.
Issue for this PR
Closes #37650
Type of change
What does this PR do?
Pending
globandgreppermissions store absent optional tool inputs (path,include,limit) asundefinedinside JSON permission metadata, so whensession.permission.listencodes its response, schema validation fails withExpected JSON value, got undefined.This adds a small
jsonMetadatahelper inpackages/core/src/tool/metadata.tsthat omitsundefinedfields, and builds the glob/grep permission metadata through it: absent optional inputs are simply left out of the record, so permission listing stays schema-valid whether or not the model supplied them.(Supersedes #44375, which was auto-closed before its description could be brought up to the PR template.)
How did you verify your code works?
packages/core/test/tool-permission-metadata.test.tscover the all-optional-absent case from the issue, the fully-populated case, and the mixed path-only case: 3 pass.bun run typecheckclean in @opencode-ai/core and across the monorepo.Screenshots / recordings
Not a UI change.
Checklist