mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-18 23:08:26 +01:00
a3f86e5cc8bbfc4af89fe57715bcace543089270
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
23ce68a8dc |
feat(connections): end Google access when a Paperclip-managed Google connection is removed (#22065)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Connectors let agents use Google Workspace through a Google sign-in
that Paperclip Cloud manages for the user
> - When a user removes a Paperclip-managed Google connection, Paperclip
deletes the tokens locally, but the grant stays live at Google
> - Google's OAuth review expects that a disconnect ends the app's
access, and users expect it too
> - Google's revoke ends the user's whole grant to the shared client, so
only the Paperclip Cloud broker can decide when it is safe to revoke
> - This pull request asks the broker to revoke each removed grant,
keeps local removal unconditional, and tells the user the outcome in
plain language
> - The benefit is that removal ends Google access when no other
Paperclip connection needs it, and the user knows what to do when it did
not
## Linked Issues or Issue Description
**Subsystem affected**
Connectors: Paperclip-managed Google Workspace and the legacy
per-service Google connections (server removal, shared contracts,
connection UI).
**Problem or motivation**
Removing a Paperclip-managed Google connection or grant was local only.
The refresh token was deleted in Paperclip, but Google still listed
Paperclip as having access to the account. The docs said so ("Removal is
local for managed grants").
**Proposed solution**
On removal, send each removed grant's refresh token to the broker's
signed `POST /v1/connector/revoke`. The broker revokes at Google only
when no other live binding could share the grant. Paperclip records the
broker's outcome code and shows one of three plain messages. Local
removal never waits on, or fails because of, that call.
**Alternatives considered**
Call Google's revoke endpoint from the app. This ends the user's whole
grant to the shared client and can break their other Google connections,
so the broker owns the decision.
**Additional context**
Older brokers answer 409 `REVOCATION_NOT_AVAILABLE`. The app treats
that, a timeout, and a network error as "could not end access at Google"
and still removes the connection.
## What Changed
- `paperclip-cloud-connector.ts`: `revoke()` takes an optional
`timeoutMs`, returns the broker's `outcome` from an allowlist, and keeps
`REVOCATION_NOT_AVAILABLE` as an allowed rejection reason.
- New `tool-access/connections/google-access-removal.ts`. For a managed
Google connection, `prepare()` reads each removed grant's refresh token
and returns a `send()` step. `send()` calls the broker for each distinct
token, one after another, under one 5-second deadline. Every result and
every error (including a Paperclip Cloud client that cannot be created)
becomes an outcome code. It never rejects and never logs a token. An
unexpected error is logged with the error name only and reported as
`unexpected_error`.
- Order for removing a whole connection: read the tokens, run the whole
local teardown (grants, installs, app profile, gateway tokens, runtime
slots, catalog, OAuth state, archive the connection), call the broker,
delete the sent refresh-token secrets whatever the outcome, then delete
the remaining secrets. A failure anywhere in the teardown makes no
broker call. Order for removing one grant: read the token, commit the
revocation, call the broker, delete the grant's refresh-token secret.
`send()` owns the call and the deletion through an injected
secret-removal function.
- Owed revocations: a revoked managed Google grant whose refresh-token
secret still exists (and that nothing live uses) is sent by every later
removal, then the secret is deleted. This covers a process stop after
the teardown and before the call, with no new column. Once the secret is
deleted, nothing is sent again.
- Shared tokens: the shared (organization) sign-in writes the same
secret refs to the organization grant and the connection. So revoking an
organization grant alone neither calls the broker nor deletes the
secret, because the connection still uses that token; removing the
connection does both. The same rule applies to any refresh token still
used by another live grant or connection.
- Audit history: once the broker call settles, a
`connection.google_access_removal` audit event records `reasonCode` =
result and `providerAccess` (plus `grantId` for a single grant). If that
write fails, the removal still succeeds and the failure is logged.
- Revoke signs with the subject that consented to the grant
(`providerTenant.externalId`, saved by the managed callback from the
claim). Grants saved without it fall back to the refresh rule. Refresh
is unchanged; see Risks.
- `removal.ts` and `grants.ts`: `providerAccess: { provider, result,
outcomes }` goes to the responses and to the `tool_connection.archived`
and `tool_connection.grant_revoked` activity entries. The tool access
audit field `providerRevocation` keeps its Vercel meaning only.
- `packages/shared`: `ManagedGoogleAccessRemoval`,
`ManagedGoogleRevocationOutcome`, `ConnectionGrantRevocationResult`.
- UI: one helper, `connectionRemovalToast`, builds the removal toast
(base sentence plus the Google notice, tone and action) for Connectors,
Connections and the app page. No codes are shown.
- API: `docs/api/tool-connections.md` documents both DELETE responses
and `providerAccess`. The OpenAPI registration describes the optional
field and its four results.
- Docs: `GOOGLE-WORKSPACE.md` (order, owed revocations, decision table),
`GMAIL.md`, the Google connector memory note, and the help page on
deleting connection data.
Decision table, judged over the distinct tokens sent in this removal:
| Outcomes | `result` | User message |
| --- | --- | --- |
| Every token `revoked` | `ended` | "Paperclip's access to this Google
account was also ended at Google." |
| Any failure-type code: `provider_revocation_failed`,
`binding_not_known` (the broker had no record, so Google was not
called), `provider_revocation_disabled`, `revocation_in_progress`,
`revocation_not_available`, `broker_unavailable`, `broker_error`,
`credential_unavailable`, `unexpected_error` | `not_ended` | "Paperclip
removed the connection but couldn't end its access at Google. You can
remove Paperclip from your Google account's third-party connections." +
"Open Google account connections" |
| Only `other_connections_remain` | `other_connections_remain` | "Other
Paperclip connections still use this Google account, so Google keeps
Paperclip's access until you remove those too." |
| At least one `revoked`, the rest `other_connections_remain` |
`ended_unconfirmed` | "Paperclip's access was ended at Google. If more
than one Google account was connected here, check your Google account's
third-party connections to be sure." + "Open Google account connections"
|
Grants record no Google account identity: the managed callback saves
`externalId` (the Paperclip subject), `name` (the provider name), and
OAuth timing and scopes, and none of the 14 scopes returns an account
identifier. So the last row is always `ended_unconfirmed`. This includes
two tokens of one user and several agent grants on one Google account.
## Verification
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/google-managed-connection-removal.test.ts
src/services/tool-access
src/services/paperclip-cloud-connector-revoke.test.ts
src/services/paperclip-cloud-connector.test.ts
src/__tests__/tool-connection-removal.test.ts
src/__tests__/tool-access-service.test.ts
src/__tests__/openapi-routes.test.ts` (714 passed)
- `pnpm --filter @paperclipai/ui exec vitest run
src/features/connections/googleAccessRemoval.test.ts src/pages/apps`
(passed)
- Server test typecheck (`node server/scripts/typecheck-layers.mjs`)
passes.
- Red then green: the server tests failed on `master` sources (21), then
each review round's new tests failed on the previous head and pass now.
They cover: the order on both paths, local failure before the grant
commit making no call and the retry sending, cleanup failure after the
call making no second call, a process stop between commit and call being
sent on retry with the secret deleted after, a Paperclip Cloud client
that cannot be created, the consenting subject for an organization
grant, sequential sends under one deadline, each row of the decision
table (per-agent and same-user cases give `ended_unconfirmed`, a mixed
failure gives `not_ended`), the unexpected-error log without a token, no
token in any log call, the delete-stored-data option, and a toast test
per surface.
- Added time, measured locally with a stubbed broker that answers at
once: median 22.1 ms against 20.3 ms without the broker step (12 runs
each), about 2 ms. With a real broker, one round trip per removed token,
capped at 5 seconds in total.
- `pnpm verify` exits 2 (a global CI input changed), so required CI
supplies the broad coverage.
- Not verified against a live broker or a real Google account.
## Risks
- A removal of a managed Google connection or grant can take up to 5
seconds longer when the broker is slow.
- Refresh subject is not changed in this PR. In the broker
(`recordProviderGrant`), a ledger row's subject is fixed when the row is
first written, and a refresh under another subject leaves that row
untouched. So moving refresh to a new subject could stop updating the
row's last-seen time. After 200 days the row would then count as not
live, and a later removal elsewhere could revoke at Google while this
connection still works. That risk cannot be ruled out from code for rows
written before this release, so both refresh paths keep their old rules.
The two refresh paths already use different subject orders today: the
gateway prefers `connectorSubjectAgentId` and then
`connectorSubjectUserId`, while background refresh prefers the grant's
own subject. That is pre-existing, and this PR leaves it unchanged.
Revoke uses the consenting subject, which matches the claim-time ledger
row. When the row was first written by a refresh under a different
subject, the broker answers `binding_not_known` and the user gets the
warning.
- Repeated removals can send an already-removed token again; the broker
returns its recorded outcome and changes nothing at Google.
- Against an older broker, users see the "could not end access at
Google" message, which is accurate.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and
code execution.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
56023fe80f |
feat(google-workspace): gateway sets the REST tool result size limit for all six services; update connector docs (#22050)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents read Gmail, Calendar, Drive, Docs, Sheets and Slides through the built-in Google Workspace connection > - Paperclip now has its own REST-backed Google tools in `server/src/google-workspace-rest-tools/`. No service uses them yet > - That folder guessed a result size limit of 250,000 bytes. It applied the limit only to Drive, Docs, Sheets and Slides. Gmail and Calendar had no limit > - The guess was wrong in both directions. It refused documents that Paperclip can deliver, and the folder should not know Paperclip's limits > - This pull request makes the limit a number that the gateway gives. The folder applies it to every tool in all six services through one check. It also brings three Google planning docs up to date > - The benefit is that a REST result is refused only when the gateway would also refuse the same result from Google's own MCP server ## Linked Issues or Issue Description Refs #22027, #22028, #22029, #22026 **Is your feature request related to a problem?** The REST tools refused results over a size the folder chose itself (250,000 bytes). Paperclip can deliver larger results: the runner saves a large result as an artifact and gives the agent a pointer. Gmail and Calendar results had no limit at all. **Describe the solution you'd like** The gateway gives the limit. The folder applies the given number to the final serialized result of every tool, with one helper. A result over the limit is an error that says how to ask for less. It is never cut short. **Describe alternatives you've considered** A larger number chosen from the runner's 1 GiB capture limit. Google's own transfer limit (20 MB per response) and memory use make that a poor choice. Also, results would then differ between the REST path and Google's MCP path. ### Limits a tool result passes on the way to an agent | Point | Limit | What happens over it | | --- | --- | --- | | Google response read by `google-http.ts` | 20 MB (`MAX_RESPONSE_BYTES`) | Tool error. Nothing returned | | REST folder result (new) | the number the gateway passes: 999,885 bytes | Tool error with "read less" advice. The gateway returns `tool_error` (502) | | Gateway read of a remote MCP response (`MAX_REMOTE_MCP_RESPONSE_BYTES` in `tool-gateway.ts`) | 1,000,000 bytes per JSON body or event-stream message | `mcp_remote_response_too_large` (502). This is the "1,000,000 bytes are rejected" statement in `doc/prompt-injection-prevention.md`. It applies to the Google MCP path only; the REST path has no HTTP read | | Injection screening model check | 256 KiB model request | Not a delivery limit. A larger result is checked by the built-in patterns only | | Gateway HTTP route (`POST /tool-gateway/.../tools/call`) | none in Paperclip | `res.json(result)` | | Runner (`captureRunnerToolResult`) | 500,000 bytes (`RUNNER_TOOL_RESULT_MAX_BYTES`) | Saved as an artifact. The agent gets a pointer and reads it with `read_tool_result` | | Runner capture | 1 GiB (`RUNNER_API_RESPONSE_MAX_BYTES`) | `SemanticToolOutcomeUnknownError` | The gateway wraps the result as `{ content, data: { content, structuredContent, ... } }`, so the payload occurs again. Measured: a Gmail result of 676,459 bytes from the folder became 1,017,386 bytes delivered (ratio 1.50). The ratio cannot be more than 2. ### The budget `GOOGLE_WORKSPACE_REST_MAX_RESULT_BYTES` in `tool-gateway.ts` = `MAX_REMOTE_MCP_RESPONSE_BYTES` less the JSON-RPC envelope and event-stream framing (`event: message\ndata: {"jsonrpc":"2.0","id":"paperclip-tool-<uuid>-version","result":...}`) = **999,885 bytes**. A result that Google's MCP server could deliver through the gateway is also delivered over REST, and the reverse. With the wrapper, the largest delivered result is less than 2 MB. The runner saves it as an artifact (far below 1 GiB). So the folder never refuses a result that the runner can give as a pointer. Practical limits at that budget (plain ASCII; escaped and non-ASCII characters count more): | Tool | Largest content | | --- | --- | | Gmail `get_message` | about 500 KB plain body, or about 250 KB each for plain plus HTML | | Calendar `get_event` | about 500 KB description | | Drive `read_file_content` | about 500 KB text | | Drive `download_file_content` | about 375 KB file bytes | | Docs `read_doc` | about 240 KB document text | | Slides `read_presentation` | about 250 KB text | | Sheets `get_values` | about 500 KB cell text, at most 50,000 cells | ## What Changed - `tool.ts`: `defineTool` takes `whenTooLarge` advice per read tool (required for reads, refused for writes) and a `ToolLimits` argument. It measures the final `CallToolResult` once (`withinResultBudget`) and replaces an oversized result with a `too_large` tool error. `FALLBACK_MAX_RESULT_BYTES` (250,000) applies only when a direct caller gives no limit. - `callGoogleWorkspaceRestTool` and `createGoogleWorkspaceRestServer` take `maxResultBytes`. A value that is not a positive integer is refused before any request. - All 23 read tools state their advice: a smaller `pageSize` for list tools, `messageFormat` or `view` for Gmail, a narrower range for Sheets, `fields` for Slides. Write tools are not checked: a completed write is never reported as an error, so an agent is not led to repeat it. - Drive, Docs, Slides and Sheets no longer have their own byte checks (`boundedStructuredResult`, `boundedResult`, `sizedResult`, `MAX_CONTENT_BYTES` removed). Drive downloads stop reading at the given limit. The Sheets 50,000-cell limit stays. - Two Drive tool descriptions no longer state a fixed number. - Adapter `google-workspace-rest-dispatch.ts`: `maxResultBytes` is a required input and is passed through. - `tool-gateway.ts`: new `GOOGLE_WORKSPACE_REST_MAX_RESULT_BYTES`, passed on the REST branch. - Folder README: new "Result size" section with the limits and costs; old 250,000-byte text replaced. - Docs: `doc/memory/google-connector-memory.md`, the production checklist and the code-fix plan now list #22026 to #22029, the REST status (36 of 36, none switched on), the November 17 decisions, the known differences from Google's tools, open risks and next steps. ## Verification - `cd server && npx vitest run src/google-workspace-rest-tools` passes (53 files, 1,361 tests with the adapter test). - New `result-budget.test.ts`: for Gmail (read, list), Calendar (list, read), Drive, Docs, Slides and Sheets, a result just under a given budget is returned and one just over is refused with the tool's advice. Without a budget, the fallback applies; with a larger budget, the same result is returned. Drive downloads use the given cap. A Gmail list tells the caller to lower `pageSize`. A Gmail draft result over the budget is still returned, not an error. `defineTool` refuses a read tool without advice and a write tool with it. - `npx vitest run src/services/google-workspace-rest-dispatch.test.ts`: the adapter passes the gateway's number, and the folder applies exactly that number. - `npx vitest run src/__tests__/google-workspace-rest-transport.test.ts` (24 tests): with Gmail on REST, a 330 KB email passes the gateway with screening, is more than 500,000 bytes delivered, and `captureRunnerToolResult` turns it into a `read_tool_result` pointer. A 520 KB email is refused with `tool_error` and the advice, after one Google request. - `npx tsc --noEmit -p server/tsconfig.json`: no errors. - `pnpm verify --explain`: broader verification required (a doc under `doc/` is a global CI input). CI supplies that coverage. - Time per call: the check is one `JSON.stringify` of the result. About 5 µs for a 4 KB result, 18 µs for 42 KB, 0.24 ms for 700 KB. Drive, Docs, Sheets and Slides had the same pass before, so they add nothing. Gmail and Calendar add this one pass. ## Risks - Gmail and Calendar results now have a limit. Direct callers that pass no limit get the 250,000-byte fallback. The gateway always passes its number. - Drive, Docs, Slides and Sheets accept results up to about 4 times larger than before through the gateway. Large results reach agents as artifact pointers. - Error text for oversized results changed to one shared form. - No service is switched to REST, so users see no change today. ## Model Used Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used in Claude Code with tool use (shell, file edits, GitHub CLI) and extended reasoning. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7f1f0eef67 |
fix(google-workspace): request free/busy with read & write Calendar, and update connector docs (#22026)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The built-in Google Workspace connector gives agents Gmail, Drive and Calendar through one connection, behind an experimental setting > - The user picks each service as read only or read & write. Paperclip then requests only scopes from a fixed list of 14 > - Read & write Calendar requested `calendar.calendarlist.readonly` and `calendar.events`. Our code assumed `calendar.events` also covers free/busy lookups > - Google's REST `freeBusy.query` does not accept `calendar.events`. So the REST `suggest_time` tool cannot read free/busy on a read & write grant, and falls back to reading each attendee's events > - This pull request adds `calendar.events.freebusy` (already one of the 14) to the read & write Calendar selection of the unified connection, and stops treating `calendar.events` as implying free/busy > - The benefit is that `suggest_time` on REST can see coworkers who share only free/busy, and the stored grant no longer claims a permission that Google did not give. It also brings three Google connector planning docs up to date ## Linked Issues or Issue Description Refs #22016, #22017, #22010, #22014 **What happened?** The read & write Calendar selection of the unified Google Workspace connection requests `calendar.calendarlist.readonly` and `calendar.events`. `toolScopes.calendar.suggest_time` lists `calendar.events` as sufficient, and `googleWorkspaceEffectiveScopes` treats `calendar.events` as implying `calendar.events.freebusy`. Google's two references differ: - REST [`freeBusy.query`](https://developers.google.com/workspace/calendar/api/v3/reference/freebusy/query), checked 2026-11-17: "This request allows authorization with at least one of the following scopes:" `calendar.readonly`, `calendar`, `calendar.events.freebusy`, `calendar.freebusy`. `calendar.events` is not in the list. - Google's hosted Calendar MCP [`suggest_time`](https://developers.google.com/workspace/calendar/api/v3/reference/mcp/tools_list/suggest_time), checked 2026-11-17: "Requires one of the following OAuth scopes:" `calendar`, `calendar.readonly`, `calendar.events`, `calendar.events.freebusy`, `calendar.freebusy`. Here `calendar.events` is accepted. So `calendar.events` is enough for Google's MCP tool but not for the REST endpoint that our REST `suggest_time` uses. **Expected behavior** A user who picks read & write Calendar gets a grant that allows `freeBusy.query`. A grant that does not have the free/busy permission is not recorded as having it. Grants made before this change keep working as read & write. **Steps to reproduce** 1. Call `googleWorkspaceSelectedScopes({ calendar: "write" })`. It returns two scopes, without `calendar.events.freebusy`. 2. Call `googleWorkspaceEffectiveScopes(readOnlyCalendarScopes, [calendar.events])`. It returns `calendar.events.freebusy`, which Google did not grant. 3. With Calendar on the REST transport, `suggest_time` on a read & write grant gets an insufficient-scope answer from `freeBusy.query` and uses the events fallback. ## What Changed - `packages/shared/src/google-workspace-connectors.ts`: - `googleWorkspaceSelectedScopes` adds selection-level scopes from a new `SELECTION_ADDED_SCOPES` map. Read & write Calendar adds `calendar.events.freebusy`. The per-service `calendar.write` profile (`SERVICE_PROFILES["calendar.write"]`) is unchanged, because the Cloud broker matches legacy profiles by exact scope set. - `googleWorkspaceEffectiveScopes` no longer expands `calendar.events` to `calendar.events.freebusy`. `calendar.events` still implies `calendar.events.readonly`. `calendar.readonly` still implies free/busy, which Google's reference allows. - `googleWorkspaceSelectionForScopes` is unchanged. It needs the legacy write profile's scopes, so a two-scope grant and a three-scope grant both read back as read & write. - `toolScopes.calendar.suggest_time` is unchanged. It still accepts `calendar.events`: Google's MCP tool accepts it, and on REST the tool has an events-based fallback that names attendees it cannot read. - Counts: default all-read-and-write selection is now 10 scopes (was 9); all read-only stays 8; the union of all 27 selections stays exactly the 14. - Tests (written first and seen failing on `master`): - `packages/shared/src/google-workspace-connectors.test.ts`: scopes for read and for read & write Calendar; the legacy `calendar.write` profile keeps two scopes; default count 10 and read-only count 8; old two-scope grant, new three-scope grant and partial consent (user declines free/busy) all round-trip as read & write and keep `list_calendars`, `list_events`, `suggest_time`, `create_event` and `delete_event`; no recorded free/busy that Google did not grant. The existing exhaustive test still checks that no selection requests a scope outside the 14. - `server/src/__tests__/tool-access-service.test.ts`: customer-owned Workspace OAuth with read & write Calendar asks Google for all three scopes. With and without free/busy in Google's answer, the connection is active, the Calendar tools are listed, the grant stores exactly what Google granted, and it reads back as read & write. - Stale tests on `master` fixed: `#22014` made Gmail 9 of 9 in the REST tool set while `#22016` still expected 3 Gmail REST tools. `google-workspace-rest-dispatch.test.ts` and `google-workspace-rest-transport.test.ts` now derive the Gmail list from the allowlist and use Chat as the service with no REST tools. - Docs: `doc/connections/GOOGLE-WORKSPACE.md`, `doc/connections/GOOGLE-WORKSPACE-SERVICE-CONSENT.md` and `doc/connections/tool-method-permission-reviews.json` say ten scopes and explain the Calendar change. - Docs: `doc/memory/google-connector-memory.md` (shipped PRs #22010, #22014, #22016, #22017; three Nov 17 decisions; "Where Google content is kept" replaced with #22010's inventory, what deletion keeps and its limits; Scopes section; REST tools status table; still-open list), `doc/plans/2026-11-17-google-workspace-production-checklist.md` (help page and retention audit ticked with #22010; REST tool progress), `doc/plans/2026-11-17-google-workspace-code-fixes.md` (fix 6 done with limits; section 9 status table; fix 10 note). - `tests/runner-e2e/source-sdk-public-inputs.json`: refreshed pins for the changed shared files. Not changed: - `server/src/google-workspace-rest-tools/**`. Another change owns that folder. Its README open question about this scope is now resolved and can be removed there. - The picker disclosure (`googleWorkspaceDisclosure.ts`). Read & write Calendar already says agents "can see your calendars, events and free/busy times". With this change that line is accurate on REST too. Behavior for existing grants: a saved read & write grant without free/busy still reads back as read & write, keeps every Calendar tool, and refreshes without change. Nothing prompts the user to reconnect. A user who chooses read & write Calendar in the picker is asked for the new scope. An account-page reconnect without a new choice still restores the exact saved request, as before. Cloud broker and Google Console: no change needed. `calendar.events.freebusy` is one of the 14 in `workspace.all`, the broker accepts any nonempty subset of `workspace.all` (`doc/connections/GOOGLE-WORKSPACE-SERVICE-CONSENT.md`), and the legacy `calendar.write` profile's exact scope set did not change. ## Verification - `cd packages/shared && npx vitest run src/google-workspace-connectors.test.ts src/app-definitions.test.ts`: 55 passed. On `master` the new shared tests fail (3 failed). - `cd server && npx vitest run src/__tests__/tool-access-service.test.ts -t "free/busy"`: 2 passed. With `master`'s `google-workspace-connectors.ts`: 2 failed. - `cd server && npx vitest run src/__tests__/google-workspace-rest-transport.test.ts src/services/google-workspace-rest-dispatch.test.ts`: 29 passed (4 failed on `master` before this change). - `cd ui && npx vitest run src/features/connections/GoogleWorkspaceServices.test.tsx src/pages/apps/AppDetail.test.tsx`: 115 passed. - `cd packages/shared && npx tsc --noEmit -p .`: clean. - `pnpm verify` exits 2 (a global CI input changed), so required CI supplies the broad coverage. - Docs facts checked against `gh pr view` for #22010, #22014, #22016, #22017, the code, and paperclipai/paperclip-website PR 197 (still a draft; does not mention OpenRouter). ## Risks - Low risk. The submitted set of 14 does not change, and the broker contract does not change. - New read & write Calendar grants record `calendar.events.freebusy` next to `calendar.events`. Code that reads stored scopes sees one more scope. All consumers (callback, refresh, discovery, picker pre-fill) are covered by the tests above. - A read-only Calendar request on an account that Google reports only `calendar.events` for no longer records free/busy. That matches what Google granted; `suggest_time` is then not offered on that grant. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, via Claude Code with tool use, web fetch and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1ca90d2d6f |
docs(connections): record Nov 17 Google Workspace progress in memory, checklist and plan (#22007)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The built-in Google Workspace connector is going through Google's restricted-scope review > - Three docs track that work: the working memory, the production checklist and the code-fix plan > - Four pull requests merged on November 17 and one more is open, so the docs are out of date > - This pull request updates the three docs to match the merged work and the Cloud audit results > - The benefit is one current place for decisions, scopes, shipped work and open questions ## Linked Issues or Issue Description Refs #21996, #21998, #21999, #22000, #22001 **Issue type** Outdated documentation. **Where is the issue?** `doc/memory/google-connector-memory.md`, `doc/plans/2026-11-17-google-workspace-production-checklist.md` and `doc/plans/2026-11-17-google-workspace-code-fixes.md`. **What's wrong?** The docs describe fixes 1 to 4 as not done. They plan a new npm package for the REST tool set, but the tool set is a folder inside the server. The scope table is in two files. The docs do not record the Cloud broker audit or where Google content is kept. **Suggested fix** Record what shipped, add the new decisions, keep one scope table, add the broker and data-retention findings (marked as reported), and tick the checklist items that are now true. ## What Changed - Working memory: three new decisions (no new npm packages, the scope handling contract, agents merge their PRs on the coordinator's approval at green checks and Greptile 5/5). - Working memory: new "What has shipped" table (#21996, #21998, #21999, #22001 and #22000, with merged commits). - Working memory: the single copy of the 14-scope table. "Known mismatches" now lists only what is still true after #22001. - Working memory: new "Cloud broker (paperclip-cloud)" and "Where Google content is kept" sections, from the November 17 read-only audit, marked as reported and not re-verified. - Working memory: how to create the staging tester, its two obstacles, and two new open decisions with a recommendation. - Working memory: the privacy policy draft location and what it must also cover (the OpenRouter screening model and the picker's retention statement). - Working memory: a note that the ponytail reviewer flagged the summary of Google's reply. The summary stays. - Checklist: the scope table is now one sentence with a link. Four product items are ticked with date and PR link. Items that are not fully true stay unticked. - Code-fix plan: fixes 1 to 4 marked done with PR links. Section 9 layout is now the folder inside the server. Two one-line lessons. Section 10 lists the broker changes and the deploy order. ## Verification - Each fact was checked against `gh pr view` for #21996, #21998, #21999, #22000 and #22001, and against `packages/shared/src/google-workspace-connectors.ts` and `server/src/services/tool-access/oauth/grant-refresh.ts` on `origin/master`. - The broker and data-retention facts come from an audit that this PR does not re-verify. The docs say so. - Searched the changed files for client IDs, secrets and project numbers: none. - Docs only. No tests apply. ## Risks - Low risk. Docs only. No code or behavior changes. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use (shell, file edits, GitHub CLI). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
12cb18e17d |
docs(connections): Google Workspace approval checklist, code-fix plan and working memory (#21996)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The built-in Google Workspace connector lets agents read and write Gmail, Drive, Docs, Sheets, Slides and Calendar data > - The connector stays behind an experimental setting until Google approves its data access and the security assessment is accepted > - The approval work has many steps, and the decisions behind them were spread across chats and private notes > - This pull request adds one checklist, one code-fix plan and one temporary working-memory file for that effort > - The benefit is that contributors and agents share one source for the scope contract, the decisions and the remaining work ## Linked Issues or Issue Description **Type of issue** Missing documentation for an in-progress effort. **Description** The Google Workspace connector needs Google approval before it can go to all users. There is no single document that lists what "approved and released" means, which code changes must land before submission, or the decisions taken so far (launch transport, owner, test instance, 14-scope contract). **Proposed change** Add a production and approval checklist, a code-fix plan for section 2 of that checklist, and a temporary working-memory file. Keep identifiers, credentials and review correspondence out of the public repository. ## What Changed - Added `doc/plans/2026-11-17-google-workspace-production-checklist.md`: the "done means" criteria, the 14-scope contract, and checklists for decisions, baseline, product and code, policy, security assessment, reviewer environment, live acceptance, demo video, submission, release and ongoing work. - Added `doc/plans/2026-11-17-google-workspace-code-fixes.md`: ten ordered code fixes (disclosure in the picker, scope lock to 14, `gmail.modify` removal from the managed client, injection screening check, revoke on last disconnect, retention audit, scan findings, gate removal, REST-backed tool set, scope cleanup). Each item is marked confirmed or to check. - Added `doc/memory/google-connector-memory.md`: a temporary file with decisions, open questions, environments, Google app layout, scopes, review history and privacy-policy gaps. It says to delete it once the connector is released. ## Verification - Docs only. No code, schema or test changes. - Read all three files before the push and confirmed that they contain no passwords, client IDs, client secrets, project numbers or review login codes. - Relative links between the three files and to `doc/connections/GOOGLE-WORKSPACE.md` resolve in the repository. - CI checks on this PR. ## Risks - Low risk. Documentation only. - The plans describe intended work. Some items are marked "to check" and can change after the code is traced. - The working-memory file is temporary and must be deleted after release. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`, Anthropic), used through Claude Code with tool use (shell, git, GitHub CLI) to commit the files and open this PR. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |