fix(core): keep glob/grep permission metadata JSON-encodable - #44375
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
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate PRs found:
Why they're related: Both PR #40852 and the current PR #44375 target the same core problem: preventing |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
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.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