Repository navigation
馃С fix: Skip Agent Tool Schemas During File Inspection #16804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1029,6 +1029,7 @@ function omitResolvedFileLocators( | |
| depth = 0, | ||
| state?: { | ||
| readonly seen: WeakMap<object, unknown>; | ||
| readonly omittedRootKeys?: ReadonlySet<string>; | ||
| visited: number; | ||
| }, | ||
| ): unknown { | ||
|
|
@@ -1098,6 +1099,9 @@ function omitResolvedFileLocators( | |
| }; | ||
|
|
||
| for (const [key, child] of entries) { | ||
| if (depth === 0 && traversal.omittedRootKeys?.has(key)) { | ||
| continue; | ||
| } | ||
| if (resolvedFile != null && key === 'file_id') { | ||
| continue; | ||
| } | ||
|
|
@@ -1143,14 +1147,19 @@ export function omitResolvedCanonicalFileLocators<T>( | |
| resolvedFilesById: ReadonlyMap<string, CanonicalFileInspectionFile>, | ||
| context: { | ||
| readonly messageCount?: number; | ||
| readonly omittedRootKeys?: ReadonlySet<string>; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 馃憤聽/ 馃憥. |
||
| readonly onTraversalFailure?: LocatorTraversalReporter; | ||
| } = {}, | ||
| ): T { | ||
| if (resolvedFilesById.size === 0) { | ||
| return input; | ||
| } | ||
| try { | ||
| return omitResolvedFileLocators(input, resolvedFilesById) as T; | ||
| return omitResolvedFileLocators(input, resolvedFilesById, 0, { | ||
| seen: new WeakMap<object, unknown>(), | ||
| omittedRootKeys: context.omittedRootKeys, | ||
| visited: 0, | ||
| }) as T; | ||
| } catch (error) { | ||
| if (error instanceof ContentTraversalLimitError && error.diagnostics != null) { | ||
| context.onTraversalFailure?.({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
files.pii.uninspectable: block, a Responses API caller can place an opaque file payload such asdata:application/pdf;base64,...in a function tool's description or parameters and have it sent to the provider whenever the agent also has a hydrated attachment. Fresh evidence beyond the earlier thread is thatapi/server/controllers/agents/responses.js:1136-1145mergesrequest.toolsintoprimaryConfig.toolDefinitionsafter the initial check at line 1078, while the post-merge check at line 1196 reaches this new omission;extractAgentContentthen subjects the schema only to tool-argument/agent-instruction policies, not the file policy. Preserve opaque-file validation for caller-supplied definitions before omitting trusted initialized schemas.Useful? React with 馃憤聽/ 馃憥.