gdrive connector with google picker api#178
Merged
Merged
Conversation
martyna-mindsdb
marked this pull request as ready for review
July 10, 2026 15:50
ZoranPandovski
requested changes
Jul 14, 2026
| data_vault.inject_env(conn["engine"], conn["name"]) | ||
|
|
||
| # TODO: Add guidance for integrations | ||
| # Google Drive's google_drive connector uses the drive.file OAuth |
Member
There was a problem hiding this comment.
Move the Google Drive logic out of the harness and into the connector service. (the harness parses _picked_files JSON, checks engine != "google_drive", and applies project-scoping rules itself. This is connector logic, not agent logic
Contributor
Author
There was a problem hiding this comment.
Thanks. I moved this from harness to connections and tested the entire flow successfully. Done.
ZoranPandovski
approved these changes
Jul 15, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Linear ticket: https://linear.app/mindsdb/issue/ENG-687/google-drive-google-picker-api
Demo video: https://www.loom.com/share/6c689e3708664779aa13900ae20e4e49
Adds the server-side infrastructure for the Google Drive Picker, including endpoints to persist, query, and untag picked-file grants on a connection record, per-project scoping so the agent only sees files relevant to the current project, and delivery of the Google Picker API key required by the desktop app.
This PR also includes several reliability improvements from code review: a shared per-connection lock to eliminate read-modify-write races, preservation of picked files and custom connection labels across OAuth reconnects and token refreshes, and consolidation of duplicated connection-loading logic.
cowork/schemas/connectors.pyPickedFile(including project tags) andPatchPickedFilesBodyrequest models.cowork/common/settings/app_settings.pygoogle_picker_api_key(GOOGLE_PICKER_API_KEY) setting used by the browser-based Google Picker widget.cowork/services/connectors/oauth/config.pyuses_pickerflag toGoogleServiceConfigso the credentials endpoint determines whether to include the Picker API key from configuration instead of relying on a hardcoded engine-name check.cowork/api/v1/endpoints/connectors/oauth.py/credentialsresponse to includepicker_api_keywhenuses_pickeris enabled.cowork/api/v1/endpoints/connectors/connections.pyPATCH .../picked-filesto merge Picker selections andDELETE .../picked-files/{file_id}?project=...to remove a file's association with a single project.cowork/services/connectors/connections.pymerge_picked_filesunions project tags instead of overwriting them, whileremove_picked_fileonly removes a project association and never revokes the underlying grant. Added a shared per-(engine, name)lock around all read-modify-write operations (merge_picked_files,remove_picked_file,patch_token) to eliminate concurrent update races. Extracted shared_read_recordand_load_picked_fileshelpers to remove duplicated logic, and renamed the vault field to_picked_filesso it is treated as an internal field rather than an agent-visible credential.cowork/services/connectors/oauth/google.py_picked_filesand_labelacross OAuth reconnects and token refreshes instead of overwriting them. Wrapped updates in the shared connection lock to prevent races with concurrent Picker operations.cowork/services/connectors/persist.pypersist_connectionto preserve_picked_filesduring full-record saves, wrapped it in the shared lock, and also synchronizedset_connection_labelfor consistency.cowork/services/connectors/vault_lock.py(engine, name)lock registry used by all connection write paths to serialize concurrent operations. Includes cleanup when connections are deleted to prevent the registry from growing indefinitely.cowork/harnesses/anton_harness/harness.pyuv.lock