Leave the trash out of Google Drive search and recent files - #588
Merged
Merged
Conversation
files.list returns trashed files unless the query excludes them, and neither search_files nor list_recent_files did, so a document somebody had thrown away came back to the Bot as a match or a recent file with nothing to say it was in the trash. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 16, 2026 21:52
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
9 tasks
# Conflicts: # CHANGELOG.md
davidmckayv
approved these changes
Sep 16, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Code-verified clean; CI green on this sha.
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.
What this changes
Google's reference for
files.listsays:The Drive connector's two listings did not do that:
mainsearch_filesq=name contains '…' or fullText contains '…'list_recent_filesq,orderBy=modifiedTime descA document somebody moved to the trash (an outdated plan, or a draft replaced by a newer one) still came back to the Bot as a match or as a recently changed file.
fileLineshows name, type, modified time, link and id, and Drive was not asked for anything that would say the file was trashed. The Bot had no way to tell it apart from a live document and could answer from it.After this change:
search_filessends(name contains '…' or fullText contains '…') and trashed = false. The brackets maketrashed = falseapply to both halves of theor. The escaping of'and\is unchanged.list_recent_filessendsq=trashed = falsewith the sameorderBy.get_file_metadataandread_file_contentare unchanged. A file read by its id is still read whether or not it is trashed, because that is a request for that particular file.Where it runs
Boundary and audit
callToolare untouched.Changelog
CHANGELOG.mdunderUnreleased.Proof
server/tests/google-drive-rest.test.tsalready asserts the exact request each listing becomes, so three existing assertions change and no test is added:qwas sent, and now assertsq=trashed = false. A comment on it says why.With
google-drive-rest.tsfrommain(only the tests changed):With the fix:
bun test --coverage server/tests/google-drive-rest.test.ts: 18 pass, 0 fail. The only uncovered lines ingoogle-drive-rest.tsare 160–166, the network-error branch ofrequest, which this change does not touch.bun test server/tests/tool-selection-environment-restoration-driver.test.ts: 3 pass. Nothing else in the repo asserts on these query strings.bun run typecheck(app, server, worker): exit 0.bunx biome checkandbiome lint --error-on-warningson the changed files: clean.I have no Google account wired to a deployment here, so this was not driven against live Drive. The claim rests on Google's documented default quoted above, and on the tests pinning the request this connector sends.
This PR adds its entry at the top of
## Unreleased, where other open PRs add theirs, so the changelog may conflict. I can rebase if it does.🤖 Generated with Claude Code