Skip to content

ENG-2071: stop naming Picker-granted Drive files in anton's prompt - #417

Merged
martyna-mindsdb merged 1 commit into
stagingfrom
alejandrocantu/eng-2071-google-picker-files-listed-twice
Sep 1, 2026
Merged

ENG-2071: stop naming Picker-granted Drive files in anton's prompt#417
martyna-mindsdb merged 1 commit into
stagingfrom
alejandrocantu/eng-2071-google-picker-files-listed-twice

Conversation

@alecantu7

Copy link
Copy Markdown
Contributor

Closes the unscoped half of the duplicated Google Drive guidance. Ticket: ENG-2071 (assigned to @martyna-slawinska — raising the PR so the diff isn't stuck on a laptop; happy to hand it over).

The problem

build_datasource_context() listed every _picked_files entry for a google_drive connection. It has no project in scope — projects is a cowork concept — so the list was unscoped and named files the user had granted inside other projects, under "you MUST include every file above".

cowork-server already renders this list correctly, scoped through ConnectionsService.picked_files_by_project() (whose docstring says "A file tagged to OTHER projects only is excluded — that's the scoping leak this closes"), and with richer prose (resourceKey, supportsAllDrives, the corpora warning). Both ran on desktop, so the correctly-scoped block and the unscoped one landed in the same prompt a few hundred tokens apart.

Not an edge case: PickedFile.projects is populated whenever a file is picked via the chat composer or the Project files rail — the ordinary in-project flow.

Why anton's copy is the one that goes

The two were introduced six days apart and never reconciled — ebf3a59f (2026-07-08, cowork-server) and 089c287a (2026-07-14, anton, "review fixes" from ENG-687 PR #241). The review evidently intended a move; the original was never deleted.

The project filter cannot be ported into anton: build_datasource_context(vault, active_only=...) has no project name. So cowork-server stays the single renderer.

What is deliberately unchanged

The availability paragraph and its exact trigger. Presence of picked files is still computed through _parse_picked_files rather than a bare truthiness check, so a Picker-only connection still fires it and a _picked_files holding only malformed entries still reads as "none". Gating on auth_type == "oauth" alone would have been a quieter second behaviour change riding along.

Accepted consequence, stated so it's a decision and not an oversight: a pure anton CLI user with _picked_files set no longer gets the picked-files guidance. The Picker is a cowork-only flow, so a CLI-only user never has that field populated. CLI coverage would need the project name transported into anton — the same transport ENG-1157 designs, and it belongs there.

Recovers ~238 tokens per LLM call for every user with a Drive connection.

Tests

  • 457 pass across datasource|vault|drive|prompt|scrub|connection.
  • Mutation-verified: restoring the listing fails all six guards, including test_file_granted_in_another_project_is_not_named, which is the leak itself.
  • test_build_chat_session_google_drive.py was updated deliberately rather than deleted — it now asserts the availability paragraph still reaches the real assembled prompt while file ids do not.

Security

This only removes data from the prompt. No new input accepted, no credential handling changed. The exposure it closes is file names/ids crossing a project boundary within one user's own account — not cross-tenant, since the underlying Drive grant is connection-wide either way.

Delivery

cowork-server vendors anton from git main, so merging here ships nothing on its own. This reaches desktop only after it lands on anton main and cowork-server cuts a version.

…rompt (ENG-2071)

build_datasource_context() listed every `_picked_files` entry for a
google_drive connection. It has no project in scope — `projects` is a
cowork concept — so the list was unscoped and named files the user had
granted inside *other* projects, together with "you MUST include every
file above".

cowork-server already renders this list correctly, scoped via
ConnectionsService.picked_files_by_project() ("that's the scoping leak
this closes"), and with richer prose. Both ran on desktop, so the
correctly-scoped block and the unscoped one appeared in the same prompt
a few hundred tokens apart. This removes the duplicate and leaves
cowork-server as the single renderer.

The availability paragraph stays, and its trigger is unchanged: presence
of picked files is still parsed (not merely truthy-checked), so a
Picker-only connection still fires it and a `_picked_files` holding only
malformed entries still reads as "none".

Removes ~238 tokens per LLM call for every user with a Drive connection.

Security: this only removes data from the prompt. No new input is
accepted, no credential handling changes, and the exposure it closes is
file names/ids crossing a project boundary within one user's own
account (not cross-tenant — the underlying Drive grant is
connection-wide either way).
@martyna-mindsdb
martyna-mindsdb merged commit 8a555f3 into staging Sep 1, 2026
12 checks passed
@martyna-mindsdb
martyna-mindsdb deleted the alejandrocantu/eng-2071-google-picker-files-listed-twice branch September 1, 2026 10:21
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants