mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 18:35:33 +01:00
1bea1eeaed2ec751d7e8880bdb882479b5539615
995
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1bea1eeaed |
fix(ai-connections): delete the saved Google Antigravity sign-in on disconnect (#22931)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - AI connections let a company sign in to a model provider, and Google Antigravity uses a Google account sign-in with a long-lived refresh token > - When a user disconnected that account, or removed its connection, Paperclip marked the grant revoked but kept the saved sign-in in its database > - The obvious fix, revoking the token at Google, is unsafe here: the sign-in uses the OAuth client of Google's own Antigravity runtime, and Google revocation removes the grant for that whole client > - A revoke would sign the person out of their own Antigravity app or CLI and out of every other Paperclip connection for that Google account > - This pull request deletes Paperclip's saved sign-in on disconnect and removal, does not call Google, and says plainly that the sign-in stays valid at Google until the person removes it there > - The benefit is that "disconnect" does what the person expects in Paperclip, never breaks their other tools, and never leaves a usable token behind in Paperclip ## Linked Issues or Issue Description No issue exists. This follows the feature request template. **Subsystem affected** AI connections: Google Antigravity subscription sign-in, its disconnect and connection removal paths, the connection removal transaction, and the disconnect messages in the UI and activity log. **Problem or motivation** Disconnecting a Google Antigravity subscription account marked the connection grant revoked in Paperclip only. The saved sign-in (an encrypted company secret that holds the refresh token) was not deleted. Connection removal kept it too, because removal only deletes secrets in the app-owned key namespace. Separately, connection removal revoked the grants and then released usage-limit holds in two separate writes, so a failure between them left the grants revoked while held work kept waiting. **Proposed solution** On disconnect or removal, delete Paperclip's saved sign-in and record the result in plain words. Do not call Google's token revocation. Keep a saved sign-in that another grant or target still uses. If the delete fails, keep the reference and let the next disconnect retry. Never delete a sign-in that a reconnect saved in the meantime. Commit the grant revocation and the hold release in one transaction, as the single-grant revoke already does. **Alternatives considered** Revoking the refresh token at `https://oauth2.googleapis.com/revoke` (the first revision of this pull request). The saved credential always uses client `1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com` (`sanitizeAntigravityCredential` rejects any other), which belongs to Google's own Antigravity runtime that Paperclip runs for sign-in. Google's OAuth guide for installed apps ("Token revocation") says revocation "removes all OAuth 2.0 scopes previously granted to a project" and invalidates tokens for all clients registered under that project. So a revoke would sign the person out of every Antigravity sign-in for that account, not only Paperclip's. Paperclip has no client of its own for this sign-in, so it cannot revoke only its own access. **Roadmap alignment** This is work item 5 of the merged plan `doc/plans/2026-11-25-antigravity-cloud-rollout.md` (gap G10). This pull request updates G10, item 5 and the security table there to record the decision. ## What Changed - `server/src/services/antigravity-access-removal.ts`: for a Google Antigravity subscription connection, deletes the grant's own saved sign-in (the private `ai-<grant>` or `ai_<grant>` slot only). It keeps a sign-in that a live grant or connection elsewhere, a secret binding or user-secret declaration on another target, or another consumer (agent profile, routine trigger, secret proposal) still uses. On connection removal, other grants of the same connection do not count. The delete passes the saved version, and the grant must still be revoked, so a reconnect that saved a new version is never deleted. A failed delete keeps the grant's reference so the next disconnect retries, and the retry finds a sign-in that is already marked deleted and finishes the purge. It also clears the quota-recovery file for that grant. - New `server/src/services/connection-secret-consumers.ts`: one `findSecretConsumers` check for "is this secret used elsewhere?". Connection removal (`classifyConnectionSecrets`), managed Google removal (`secretsHeldElsewhere`) and this change use it. Removal keeps its rule that any grant or connection counts; the two Google paths count only live ones. Managed Google removal now also respects bindings, declarations and other consumers, which only keeps more secrets. - `packages/shared`: new `AiSignInRemoval` result (`savedSignIn: deleted | kept_shared | not_deleted`, `providerSignIn: still_valid`) on the grant revocation result and the connection removal summary. - `grants.ts`, `removal.ts`, `routes/tool-access.ts`: return and log the result. Removal does not clear a grant reference whose delete failed, and its final reference clear only touches revoked grants, so a reconnect that lands during removal keeps its sign-in. - `removal.ts`: the grant revocation and the usage-limit hold release now commit in one transaction. - `ai-connections.ts`: a personal reconnect reuses the grant's existing secret definition only if the owner created it, it is live, and it is a Paperclip-managed local definition. Otherwise the reconnect is refused in plain words and no token is written. - UI: the AI account disconnect shows a toast, and connection removal and the audit feed show the result in plain words, for example "Paperclip deleted its saved Google sign-in. The sign-in stays valid at Google until you remove it in your Google account's third-party connections. Removing it there also signs this Google account out of Antigravity everywhere." A failed delete says "Paperclip couldn't delete its saved Google sign-in. Disconnect again to retry." - Docs: `doc/connections/AI-CONNECTIONS.md` and the rollout plan. - The first revision's direct Google call and its retry branch in the Google revocation queue are removed. `google-pending-revocation.ts` is unchanged from `master`. - `tests/runner-e2e/source-sdk-public-inputs.json`: refreshed pins for the changed shared export. ## Verification - `npx vitest run src/__tests__/antigravity-disconnect-sign-in.test.ts` (server, embedded Postgres, network calls fail the test): 17 cases. Disconnect through the route deletes the sign-in, makes no network call, logs the result with no token, and the owner can reconnect. Connection removal deletes it, also when a second grant of the same connection references it. It is kept when a grant on another live connection, a binding on another target, a declaration on another target, or a routine trigger uses it. A failed delete (forced by a database trigger) is reported, keeps the reference, and the next disconnect deletes it, for disconnect and removal, and also when the failure comes after the sign-in was marked deleted. A reconnect during the delete, or during connection removal, keeps its sign-in. A personal reconnect is refused when the slot was created by someone else, deleted, or moved to another provider, and no token is written. A hold-release failure during removal leaves every grant active and the sign-in saved. - Red/green: with `master`'s `grants.ts`, `removal.ts`, `ai-connections.ts` and `routes/tool-access.ts`, the disconnect and removal cases fail. Each guard was also removed on its own, and its case failed: the saved-version check, the revoked-only final clear, the half-deleted retry, the same-connection exclusion, and the definition ownership check. - `ui`: `npx vitest run src/features/connections/googleAccessRemoval.test.ts` (13 pass, 5 new). - Connection removal and managed Google tests pass: `tool-connection-removal`, `tool-access-service`, `google-managed-connection-removal`, `google-pending-revocation`, `ai-connections`, and the browser-use, client-credentials, generic MCP, Braintrust, 1Password and remote MCP connection suites. - Server typecheck passes. UI `tsc` shows no errors in changed files. `pnpm verify` selects about 1,900 test files for this change (removal is widely imported), so required CI supplies that broad coverage. ## Risks - The Google sign-in stays valid at Google after a disconnect. The UI and activity log say so and link to the Google account page. This is deliberate; see Alternatives considered. - A reconnect still keeps older versions of a rotated shared secret, as before this change. - Company deletion does not change here. - No schema change and no migration. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, file edits, test runs, web reading of Google's OAuth documentation). ## 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> |
||
|
|
aa85bcb518 |
feat(plugins): carry a Google sign-in to plugin Runners for Google Antigravity (#22933)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Plugin environments (for example, an agent computer) run agents as plugin Runner tasks. Core sends each task one typed credential, and gets refreshed sign-ins back through the task's `credentials` snapshot. > - #22930 let a Google Antigravity task carry a Gemini API key. A Google subscription sign-in was still refused with "Google sign-in is not supported." > - The Cloud rollout plan (#22923) needs both routes. This is gaps G3 and G4 and work item 2: deliver the sign-in, and save a rotated refresh token safely, as Codex does. > - This pull request sends the saved, sanitized sign-in as the `antigravity` `provider-env` credential under `PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET`. It saves a refreshed token from the snapshot only after the generation, epoch and Google account checks. > - The benefit is that a plugin (for example, the Cloud agent computer) can run an Antigravity task with a person's Google sign-in, and token refreshes are not lost or saved to the wrong account. The picker, Test and save refusals for plugin targets (item 6) and the qualification flip (item 8) stay out of scope. ## Linked Issues or Issue Description Refs #22923 Refs #22930 **What problem does this solve?** A plugin Runner task cannot use a Google sign-in for Google Antigravity. Core refuses it at run start. There is also no path to save a refresh token that the Runner rotated on the plugin's computer. **Proposed solution** Add the sign-in variable as a second `antigravity` key set in `provider-env`. Core reads the sign-in from the run's private managed home, runs it through `sanitizeAntigravityCredential`, and sends that exact output. Core saves the write-back binding (grant, secret, session epoch, and a SHA-256 of the starting sign-in) on the lease. When the task stops, Core reads the snapshot and saves a new token only if all checks pass. **Alternatives considered** A new credential type for the sign-in. `provider-env` already has the exact-set check, the credential binding contract and the cross-check against the Runner's allowlists. The Cloud plan already describes the Launcher row as "`GEMINI_API_KEY` or the sign-in key". ## What Changed - `packages/plugins/sdk/src/environment-tasks.ts`: the `antigravity` key sets are now `GEMINI_API_KEY` or `PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET`. A mix of both stays rejected. - `server/src/services/native-runtime/plugin-runner-credentials.ts`: with no Gemini API key, Core reads `antigravity-acp/acp_token.json` from the selected managed home and sends the sanitizer's complete output (client ID, client secret, refresh token, token URI, `scopes`, and `project_id` when present). It never sends an access token or the account email. The task needs write-back authority. A sign-in supplied through the environment is refused. An unreadable or invalid saved sign-in fails with "The selected Google Antigravity account is unavailable. Reconnect the Google account, then retry." No error contains credential text. - `server/src/services/ai-connection-runtime.ts`: a Google subscription run now returns a write-back binding with `google.credentialSha256` of the starting sign-in. - `server/src/services/managed-ai-credential-writeback.ts`: new `syncManagedAntigravityCredential`. It requires an active grant, the same secret reference and session epoch, a Google subscription connection, and a saved sign-in that still hashes to the starting generation. It verifies a changed token with the existing account check (`prepareAntigravityCredentialWriteback`) in a private temporary home, then rechecks all of the above under the account lock before it rotates the secret. It writes `ai_connection.credential_refreshed` on save. For a different account, or a connection with no saved account, it saves nothing, writes `ai_connection.credential_refresh_refused` with a plain reason, and settles as `account_refused`. - `server/src/services/plugin-task-credential-writeback.ts`: a handoff with a Google binding takes the snapshot's `provider-env` `antigravity` sign-in and uses the Google write-back. Codex is unchanged. - `server/src/services/native-runtime/native-session-executor.ts`: a sign-in credential needs a Google write-back binding, and a Codex credential needs a non-Google one. - `server/src/services/native-runtime/antigravity-runner-credentials.ts`: the account mismatch is a typed error. The message is unchanged. - Docs: `doc/plugins/PLUGIN_ENVIRONMENT_TASKS.md` and `doc/plugins/PLUGIN_RUNNER_EXECUTION.md` describe the sign-in credential, where the Runner stages it, and the snapshot that the plugin must return. - `tests/runner-e2e/source-sdk-public-inputs.json`: refreshed for the changed SDK source. ## Verification - Red first: with the source changes removed, 22 of the new and updated tests failed (the refusal, no write-back binding, no Google write-back). - Green after the change: - `cd server && npx vitest run src/__tests__/antigravity-plugin-task-credential-writeback.test.ts` (11 passed, embedded PostgreSQL): delivery of the exact sanitized sign-in; same-account rotation saved and logged; a second rotation during the account check saved; a different account refused and recorded in plain words; unchanged token with no Google call; reconnect (new generation and epoch) and a revoked grant discard the write-back without an export; a Google outage keeps the handoff pending and the next cleanup saves it; Codex, API-key and invalid snapshots refused. No token, client secret or access token in lease metadata, activity rows or errors. - `cd server && npx vitest run src/services/native-runtime/plugin-runner-credentials.test.ts src/__tests__/plugin-runner-credential-names.test.ts` (39 passed). The names test checks that the Runner forwards the sign-in variable to the sidecar and keeps it out of the provider process. - `cd packages/plugins/sdk && npx vitest run tests/environment-task-release-resume.test.ts tests/environment-tasks.test.ts` (104 passed) - `cd server && pnpm typecheck` (clean) - `pnpm verify` (see the CI run for broad coverage) - No live run, no Google login and no real token was used. All Google calls are fixtures. ## Risks - Low for current users. Plugin targets still refuse Antigravity in the picker, Test and save (item 6), so no existing agent reaches this path until item 6 merges. - The lease now stores a SHA-256 of the starting sign-in. It is a one-way digest of a high-entropy token, and it is the same kind of generation value that Core already derives for the local route. - If Google rotates the token during the account check and the database save then fails, the cleanup retries from the plugin's snapshot. Google does not normally rotate these refresh tokens, so this matches the local route's exposure without its recovery journal. - The Launcher must return the Runner's `auth-refresh.json` (or `acp_token.json` before lease close) in the snapshot. A Launcher that returns the starting sign-in only records `unchanged`, so no token is lost on the Core side, but a rotation on the computer would not be saved. > 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, test runs). Standard context window, 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> |
||
|
|
57bd302c81 |
feat(antigravity): add hosted Google loopback-relay sign-in (#22932)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Google Antigravity supports Google account sign-in through Paperclip Runner's pinned, isolated `agy_acp_server.par` process. > - On `authenticated + public` deployments (including hosted Cloud instances), `supportsLocalAiLogin` returns `false`, and the user's browser cannot directly reach the server's `127.0.0.1:<ephemeral_port>` loopback callback listener. > - Because `client_secret` lives only inside `agy_acp_server.par` and uses PKCE with a one-shot `127.0.0.1` listener, hosted deployments need an authenticated relay path instead of an anonymous callback route or extracted secret. > - This pull request adds an authenticated loopback-relay flow across Runner, server policy/routes/redaction, and the UI so users on hosted deployments can sign in with Google, copy the `127.0.0.1` redirect URL from their address bar, and paste it to complete authentication. > - The benefit is that Google Antigravity subscription sign-in works on hosted public deployments while keeping Claude, OpenAI, and Grok server-host login disabled and preventing SSRF, secret leakage, or cross-tenant access. ## Linked Issues or Issue Description Refs #22923 **Subsystem affected** Cross-cutting (packages/paperclip-runner, packages/shared, server/, ui/) **Problem or motivation** Google Antigravity sign-in launches Paperclip's pinned, isolated `agy_acp_server.par` closure, which opens a one-shot `127.0.0.1:<ephemeral_port>` OAuth callback listener. On hosted `authenticated + public` deployments, server-host login routes are blocked and the user's browser cannot connect to the server's loopback interface, so users cannot sign in with a Google account on Cloud or remote instances. **Proposed solution** Add an authenticated loopback-relay flow: 1. Runner exposes a single-use `submitRedirect(rawRedirectUrl)` handler on `AntigravityBrowserLoginState` that validates the pasted URL (length, printable ASCII, `http://127.0.0.1:<expectedPort>/`, no credentials/hash, no duplicate `state`/`code`, no `error` param, `timingSafeEqual` state check, bounded 5-attempt bad-paste cap, SHA-256 reused-code tracking) and issues an SSRF-proof reconstructed `GET` to `expectedRedirect.origin` with `redirect: "manual"`. 2. Server adds `supportsHostedGoogleAiLogin` (exposed on `/api/health` as `hostedGoogleAiLoginSupported`), permits Google through the authenticated `/api/companies/:companyId/ai-connections/local/*` routes while keeping `anthropic`/`openai`/`xai` blocked on public deployments, accepts up to 4096-character redirect URLs on `/code` while preserving Claude's 512-byte limit, runs the loopback relay outside DB transactions, falls back cleanly when a stack has no active `local` environment row, and redacts `browserCode`/`redirectUrl` and marks `/code` secret-sensitive. 3. UI enables Google sign-in for `antigravity_runtime` on non-local environments when `hostedGoogleAiLoginSupported` is true, renders the external Google sign-in link plus plain-language `127.0.0.1` copy/paste instructions with analytics masking/no-capture markers, and triggers an immediate status check after submission. **Alternatives considered** - Adding an anonymous public OAuth callback route on the server: rejected because it widens the unauthenticated attack surface and cannot change the loopback `redirect_uri` bound inside `agy_acp_server.par`. - Extracting Google OAuth `client_secret` out of `agy_acp_server.par`: rejected by policy; secrets remain owned solely inside the pinned closure. ## What Changed - `packages/paperclip-runner/src/drivers/acpx/antigravity-auth.ts` & `packages/paperclip-runner/src/index.ts` & `server/src/vendor/paperclip-runner/index.ts`: add single-use `submitRedirect` on `AntigravityBrowserLoginState` with strict validation, `timingSafeEqual` state verification, 5-attempt cap, bounded SHA-256 reused-code set, and SSRF-proof loopback relay. - `packages/shared/src/ai-connections.ts`: add `LOCAL_AI_LOGIN_CODE_MAX_LENGTH` (4096), `localAiLoginCodeSchema`, and `submitLocalAiLoginCodeSchema` while preserving Claude's 512-byte `BROWSER_CODE_MAX_LENGTH` and `browserCodeSchema`. - `server/src/services/local-ai-login-policy.ts` & `server/src/routes/health.ts`: add `supportsHostedGoogleAiLogin` and expose `hostedGoogleAiLoginSupported` on `/api/health`. - `server/src/services/local-ai-browser-login.ts`, `server/src/services/local-ai-login.ts`, `server/src/routes/ai-connections.ts`: permit hosted Google sign-in on authenticated public deployments while keeping Claude/OpenAI/Grok blocked; enforce `Cache-Control: no-store`, owner/company/active/expiry checks, and Claude's 512-byte cap; run Google `submitRedirect` outside any DB transaction; fall back cleanly to an active environment or savepoint-wrapped `ensureLocalEnvironment` when no active `local` environment row exists. - `server/src/middleware/redact-sensitive.ts`, `server/src/middleware/http-log-redaction.ts`, `server/src/middleware/http-log-policy.ts`: redact `browserCode`/`redirectUrl`/`redirect_url` unconditionally and classify `/api/companies/:companyId/ai-connections/local/attempts/:sessionId/code` as secret-sensitive (`local_ai_login_code`). - `ui/src/api/health.ts`, `ui/src/components/ai-connections/useLocalAiLogin.ts`, `ui/src/components/AdapterLoginChrome.tsx`, `ui/src/components/new-agent/AgentProviderConnection.tsx`, `ui/src/components/ai-connections/AiConnectionCredentialStep.tsx`, `ui/src/components/OnboardingWizard.tsx`: enable hosted Google sign-in for `antigravity_runtime` on hosted/non-local environments, render the hosted `127.0.0.1` redirect paste flow with `ANALYTICS_MASK_CLASS` and `ANALYTICS_NO_CAPTURE_CLASS`, preserve retryable paste errors inline, and trigger immediate status re-check on submit. - `tests/runner-e2e/source-sdk-public-inputs.json`: refreshed for the updated `packages/shared/src/ai-connections.ts` schema. - Unit, integration, and UI tests across `antigravity-auth.test.ts`, `local-ai-login-policy.test.ts`, `health.test.ts`, `health-dev-server-token.test.ts`, `redact-sensitive.test.ts`, `http-log-policy.test.ts`, `antigravity-local-ai-login.test.ts`, `ai-connections.test.ts`, `AdapterLoginChrome.test.tsx`, `useLocalAiLogin.test.tsx`, and `AgentProviderConnection.test.tsx`. ## Verification - `pnpm --filter @paperclipai/shared build && pnpm --filter @paperclipai/shared typecheck && pnpm --filter @paperclipai/paperclip-runner typecheck && pnpm --filter @paperclipai/server typecheck && pnpm --filter @paperclipai/ui typecheck` — passed. - `pnpm --filter @paperclipai/shared exec vitest run src/validators/claude-setup-token-session.test.ts` — 15/15 passed. - `pnpm --filter @paperclipai/paperclip-runner exec vitest run src/drivers/acpx/antigravity-auth.test.ts src/drivers/acpx/antigravity-auth-stream-order.test.ts` — 33/33 passed (including real `127.0.0.1` loopback HTTP relay with fake ACP peer, bad-paste cap, reused-code rejection, single-use, and non-200 failure). - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/local-ai-login-policy.test.ts src/__tests__/health.test.ts src/__tests__/health-dev-server-token.test.ts src/__tests__/redact-sensitive.test.ts src/__tests__/http-log-policy.test.ts src/__tests__/antigravity-local-ai-login.test.ts` — all passed. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/ai-connections.test.ts` — 167/167 passed against embedded PostgreSQL (including hosted Google end-to-end route test, redaction of activity and HTTP logs, and continued blocking of Anthropic/OpenAI/xAI on hosted public deployments). - `pnpm --filter @paperclipai/ui exec vitest run src/components/AdapterLoginChrome.test.tsx src/components/ai-connections/useLocalAiLogin.test.tsx src/components/new-agent/AgentProviderConnection.test.tsx` — 30/30 passed. - `pnpm verify --explain` returned exit 2 (`tests/runner-e2e/source-sdk-public-inputs.json` broad input); required CI supplies full-repo coverage. - Note: live end-to-end sign-in against real `agy_acp_server.par` and Google OAuth on a live Cloud stack was not run in this unit/integration environment and remains a live-staging verification step. ## Risks - Low-to-moderate risk. All hosted Google sign-in endpoints stay authenticated, company-scoped, owner-bound, and `Cache-Control: no-store`; `localAiLoginSupported` remains `false` on `authenticated + public` deployments so Claude, OpenAI, and Grok server-host login stay blocked. - Loopback relay runs strictly against the validated `127.0.0.1:<ephemeral_port>` origin printed by `agy_acp_server.par` with `redirect: "manual"` and a 5-second timeout, outside any database transaction. - No database migrations are required. ## Model Used - Google Gemini (Antigravity agent 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 - [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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
07d444a717 |
feat(plugins): carry a Gemini API key to plugin Runners for Google Antigravity (#22930)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Plugin environments (for example, an agent computer) run agents as plugin Runner tasks. Core sends each task one typed credential. > - The typed `provider-env` credential carries API keys for Grok, Copilot and OpenCode. It has no entry for Google Antigravity. > - So an Antigravity agent cannot get its Gemini API key on a plugin Runner task. This is gap G3 and work item 1 in the Antigravity Cloud rollout plan (#22923). > - This pull request adds `antigravity` to `provider-env`, with the single variable set `GEMINI_API_KEY`. It follows the Copilot pattern from #22359. > - The benefit is that a plugin (for example, the Paperclip Cloud agent computer) can now accept a Gemini API key for an Antigravity task. Google sign-in, the plugin-target refusal and the qualification flip stay out of scope. ## Linked Issues or Issue Description Refs #22923 Refs #22359 **What problem does this solve?** A plugin Runner task cannot carry a Gemini API key. `provider-env` accepts only `grok`, `copilot` and `opencode`, and Core throws "Plugin Runner does not support the selected credential provider" for Antigravity. **Proposed solution** Add `antigravity: [["GEMINI_API_KEY"]]` to the published key sets and to the `provider-env` provider enum. Core transfers only that key. Core refuses a Google sign-in or a missing key with a plain message. **Alternatives considered** A new credential type only for Gemini. The generic `provider-env` type already has the exact-set check, the binding contract and the cross-check against the Runner's allowlists, so a new type adds no value. ## What Changed - `packages/plugins/sdk/src/environment-tasks.ts`: `ENVIRONMENT_TASK_PROVIDER_CREDENTIAL_KEY_SETS` has `antigravity: [["GEMINI_API_KEY"]]`. The `provider-env` provider enum accepts `antigravity`. Mixed, partial and extra variable sets stay rejected. - `server/src/services/native-runtime/plugin-runner-credentials.ts`: for provider `antigravity`, Core sends only `GEMINI_API_KEY`. Core refuses a Google sign-in document (`PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET`) or a missing or blank key with "Plugin Runner supports Google Antigravity only with a Gemini API key. Google sign-in is not supported." No key value is in any error message. - Tests: SDK schema cases (accept the key; reject a sign-in document, a key mixed with a sign-in document, `GOOGLE_API_KEY`, extra routing variables, empty values, and the key under another provider). Core transfer and refusal cases. Dispatch only for the matching `antigravity` harness, with no key in persisted lease metadata or in a worker error. A Runner check that the Antigravity process gets the key and no `GOOGLE_*` or other `GEMINI_*` variable. - Docs: `doc/plugins/PLUGIN_ENVIRONMENT_TASKS.md` and `doc/plugins/PLUGIN_RUNNER_EXECUTION.md` list the new set, the binding requirement and the sign-in refusal. - `tests/runner-e2e/source-sdk-public-inputs.json`: refreshed for the changed SDK source. ## Verification - Red first: the new tests failed before the change (the schema rejected `antigravity`, and Core threw "does not support the selected credential provider"). - Green after the change: - `cd packages/plugins/sdk && npx vitest run tests/` (322 passed) - `cd server && npx vitest run src/__tests__/plugin-runner-credential-names.test.ts src/services/native-runtime/plugin-runner-credentials.test.ts src/__tests__/environment-task-runtime.test.ts` (94 passed) - `cd packages/plugins/sdk && npx tsc --noEmit -p .` and `cd server && npx tsc --noEmit -p .` (clean) - `node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --check` (no change) - `pnpm verify` asks for broad CI coverage (exit 2) because an SDK test file changed. Required CI supplies that coverage. - No live run. Antigravity on a plugin target stays refused by Core until a later change lifts that refusal, so this change is not reachable in a run yet. ## Risks - Low risk. The change adds one enum value and one key set. Existing providers keep the same behavior. - Plugins that validate with an older SDK reject an `antigravity` credential. This is the expected fail-closed result. - The key reaches the Runner only through the typed credential. The Runner still requires a matching `PAPERCLIP_ACPX_CREDENTIAL_BINDING` and still removes other `GOOGLE_*` and `GEMINI_*` variables. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use (shell, file edits) and extended thinking. ## 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> |
||
|
|
e198f77cea |
fix(ui): remove obsolete Experimental harness picker from new agent dialog (#22919)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - When a user creates a new agent, `AgentBasicsDialog` shows top-level adapter cards for each supported harness. > - Both OpenCode and Grok Build already resolve automatically to Paperclip Runner through their main adapter cards on supported targets (`#17120`, `#17922`). > - However, `AgentBasicsDialog` still rendered an **Advanced -> Experimental harness** dropdown listing **Grok Build (Paperclip Runner)** and **OpenCode (Paperclip Runner)** left over from the phased Runner rollout. > - Showing both the main cards and a separate experimental Paperclip Runner dropdown for the same two harnesses confuses users into thinking the main cards do not use Paperclip Runner. > - This pull request removes the obsolete dropdown and dead selection state from `AgentBasicsDialog`, cleans up its Storybook story and visual-test override, and updates the E2E tests to pick the main Grok Build and OpenCode cards. > - The benefit is a single clear creation path for every harness without duplicate experimental entries. ## Linked Issues or Issue Description Refs #15993, Refs #17120, Refs #17922. **What happened?** When `enableNativeRunner` is enabled, the **Choose an adapter** step in `AgentBasicsDialog` displays both the top-level **Grok Build** and **OpenCode** cards and an **Advanced -> Experimental harness** dropdown containing **Grok Build (Paperclip Runner)** and **OpenCode (Paperclip Runner)**. **Expected behavior** The new-agent adapter picker should show only the main adapter cards, because selecting **Grok Build** or **OpenCode** already sends `runner: "auto"` and resolves to Paperclip Runner automatically on supported targets and managed Paperclip Cloud sandboxes. **Steps to reproduce** 1. Enable `enableNativeRunner` in instance experimental settings. 2. Open the **New Agent** dialog, enter a name, and click **Choose adapter**. 3. Expand **Advanced** and observe the duplicate **Experimental harness** dropdown listing Grok Build and OpenCode. ## What Changed - Removed the **Advanced -> Experimental harness** `<details>`/`SelectPopover` block and dead `runnerProvider`, `experimentalRunnerAvailable`, and `advancedRunnerOptions` code from `ui/src/components/new-agent/AgentBasicsDialog.tsx`, along with unreachable `"claude"` / `"grok"` branches in its `paperclip_runner` update payload. - Removed the obsolete `ExperimentalNativeHarnesses` story from `ui/storybook/stories/agents/codex-runner/creation.stories.tsx` and its visual-test selector/branch in `tests/storybook-visual/storybook-visual.spec.ts`. - Updated `tests/e2e/onboarding.spec.ts` to assert the **Advanced** section is absent even when `enableNativeRunner` is enabled, select the main **Grok Build** card, and verify the saved setup agent still resolves to `paperclip_runner` (`provider: "acpx"`, `acpxAgent: "grok"`, `model: "grok-4.7"`). - Updated `tests/runner-e2e/chat-catalog-domains/identity-new-company-native.ts` to select the main **OpenCode** card instead of the removed dropdown. ## Verification - `pnpm --filter @paperclipai/ui typecheck` passed. - `node scripts/run-tsc.mjs -p tests/tsconfig.playwright.json --noEmit && node scripts/run-tsc.mjs -p tests/e2e/tsconfig.json --noEmit && node scripts/run-tsc.mjs -p tests/runner-e2e/tsconfig.json --noEmit` passed. - `node scripts/check-test-budget.mjs --base origin/master` and `node scripts/storybook-catalog.mjs` passed. - `pnpm exec vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/chat-catalog-domains/identity-new-company-native.test.ts` passed (51/51 tests). - `pnpm exec playwright test --config tests/e2e/playwright.config.ts tests/e2e/onboarding.spec.ts -g "name-only setup saves the Grok Build Paperclip Runner adapter"` passed locally (1/1). - `pnpm verify` exited 2 because `tests/storybook-visual/storybook-visual.spec.ts` is unclassified; full workspace, build, and E2E verification is covered by required PR CI. ## Risks - Low risk. The main **Grok Build** and **OpenCode** cards already resolve to Paperclip Runner on all supported platforms and managed Cloud sandboxes via `resolveNewAgentRunnerForCompany`. - On platforms where Paperclip Runner is not supported for Grok Build or OpenCode (for example Linux ARM64), the main cards fall back to the legacy adapter instead of forcing `paperclip_runner`, which matches Codex and Claude Code behavior. ## Model Used - Google Gemini (Antigravity agent with tool use, file editing, and terminal 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 - [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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
87083fe982 |
fix(e2e): retry transient journey API read failures (#22917)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Product journeys test real hiring and delegation on a hosted test
stack every day.
> - A journey reads the API many times. The Cloud provider also reads it
when it prepares the lead agent and when it records a new hire.
> - Those provider reads have no retry. One dropped connection fails the
whole journey with `api_request_failed`.
> - #22914 made the failure code visible. The next staging run showed
`api_request_failed` at the moment the hired agent first appeared.
> - This pull request makes `ConnectionApi` repeat a read after a
transient failure. It never repeats a write.
> - The benefit is that a single network failure does not fail a long,
paid journey.
## Linked Issues or Issue Description
Refs #22914
**What happened?**
The QA staging smoke ran `hire-delegate-reuse` alone on the harness pin
that contains #22914. The journey failed with `api_request_failed`,
while the lead agent's hiring run was still running. At that point the
observer records the new agent through `session.own`. In the Cloud
provider, that call reconciles the hire and prepares its budget, with
about 15 API reads and no retry. An earlier failure today was in setup,
during the lead agent's readiness poll. That path also has no retry.
**Expected behavior**
A dropped connection or a gateway error on a read is retried. A real
error, for example a 404, still fails at once. A write is never sent
twice.
**Steps to reproduce**
Run the new `connection-support` test against the previous code. A GET
that fails once with a socket error rejects with `api_request_failed`
instead of reading the next response.
**Paperclip version or commit**
Harness pin
|
||
|
|
0e4dcd9be8 |
fix(e2e): wait for hire retries and keep API failure codes in journey evidence (#22914)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Product journeys test real hiring and delegation on a hosted test
stack every day.
> - The hire-delegate-reuse journey failed on three attempts today, at
three different steps.
> - One failure graded a hired agent's run as final while its
exact-session retry was still scheduled. #22826 fixed the same gap for
agent task journeys, but the hire observer has its own run check.
> - The other two failures recorded only `journey_operation_failed`. The
API client gives fixed failure codes, but the journey result dropped
them.
> - This pull request makes the hire observer wait for a scheduled
same-run retry, and it keeps the fixed API failure codes in the
evidence.
> - The benefit is fewer false failures, and a clear failure code when a
hosted API call fails.
## Linked Issues or Issue Description
Refs #22826, #22825
**What happened?**
The daily QA staging smoke failed `hire-delegate-reuse` three times on
2026-11-25:
1. Setup failed after the lead agent was created. The result said only
`journey_operation_failed`.
2. The lead hired the teammate and replied. On the next observation the
journey failed with `journey_operation_failed`.
3. The first delegated task completed. During the review task, the hired
agent's run was `running`. One second later the journey failed with
`hire_native_run_failed`.
**Expected behavior**
A failed native run with an agent-owned exact-session retry scheduled
inside the campaign deadline is still in progress. The journey keeps
observing it. A failure caused by an API status or transport error is
recorded with that fixed code, for example `api_status_500`.
**Steps to reproduce**
Run the new tests against the previous code. `assertHireRuns` throws
`hire_native_run_failed` for a pending same-run retry. `journeyFailure`
turns `ConnectionFailure("api_status_500")` into
`journey_operation_failed`.
**Paperclip version or commit**
Harness pin
|
||
|
|
8de6686739 |
fix(apps): save action choices when the provider no longer offers some actions (#22877)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Connections give agents actions in other apps, and the Permissions page controls which actions agents can use > - A managed Google Workspace connection moved from Paperclip's REST tools to Google's MCP servers (#22815) > - Google's MCP servers do not list two Gmail actions, so the catalog refresh marked them as removed (`disabled`, `mcp_tool_removed`) > - The Permissions page still sent these two actions as enabled, and the server refused every save that contained them, except on remote MCP aggregators > - An admin could not release the 34 held actions, so the connection stayed unusable > - This pull request makes the server accept a removed action for every connection kind, and makes the UI stop sending disabled or removed actions > - The benefit is that an admin can always save the review after a provider removes actions, and a disabled action still cannot be turned on ## Linked Issues or Issue Description Refs #22815 **What happened?** On a managed Google Workspace connection that runs on Google's MCP servers, the Permissions page showed "Review 34 new actions". After "Turn all on" and "Save choices", the save failed with the message "Couldn't save that — Disabled actions cannot be enabled". The held actions stayed held. **What did you expect to happen?** The save releases the reviewed actions. Actions that Google no longer offers stay off and do not block the save. **Steps to reproduce** 1. Connect Google Workspace with the managed method while the transport is Paperclip REST. Keep all actions on. 2. Move the connection to Google's MCP servers (#22815). The refresh holds the actions for review, and Google's listing does not include `gmail__list_threads` and `gmail__search_messages`. 3. Open the connection's Permissions page. Select "Review 34 new actions", then "Turn all on", then "Save choices". 4. See the error "Disabled actions cannot be enabled". **Cause** - `useConnectionPermissionSave.ts` sent `enabledCatalogEntryIds: [...next.enabled]`. This set came from the saved profile and still contained the two removed actions. - `finishGalleryAppConnection` in `server/src/services/tool-access.ts` refused an enabled row with `status === "disabled"`. It accepted a removed row (`quarantineReason === "mcp_tool_removed"`) only for remote MCP aggregators (`isRemoteMcpConnectorMethod`). The catalog refresh writes `mcp_tool_removed` also for Google Workspace and plugin connections, so these connections did not get the same exception. ## What Changed - Server: `finishGalleryAppConnection` accepts a row that the provider's listing removed (`mcp_tool_removed`) for every connection kind. Only the catalog refresh writes this marker, and only when the provider's listing no longer has the action. This is the same behavior that remote MCP aggregators already had. Any other disabled row is still refused with "Disabled actions cannot be enabled". A removed row is not active, so the gateway does not offer it to agents. - Shared: `@paperclipai/shared` has three named predicates in `tool-catalog-availability.ts`. `isCatalogEntryOffered` is true for active and held actions. `isCatalogEntryRemovedByProvider` is true for `removed` rows and for `disabled` rows with `mcp_tool_removed`. `isCatalogEntryBlocked` is true for every other disabled row. The server and the UI use these predicates, so the rule is in one place. - Server: the review coverage check ignores a reviewed id that the provider removed after the page loaded. Before this change, that save failed with "Action review decisions must cover every currently quarantined action exactly once". - Server: a save no longer sets a `removed` row back to active. - UI: a new `withoutUnavailableActions` helper drops catalog entries that are not offered (`isCatalogEntryOffered` is false) from an enabled list. - UI: the Permissions page save (`finishAppPermissions` in `useConnectionPermissionSave.ts`) sends only available actions as enabled or Ask first. The page already showed and counted only active and held actions, so the removed actions do not show, count, or toggle. The page has no existing pattern for removed actions, so this change adds no new text. - UI: the setup flow (`ConnectionSetupFlow.tsx`, which also serves task-hosted setup) and the pasted-config flow (`PasteConfigTab.tsx`) also drop disabled actions before they finish a connection. Before this change, a provider-blocked action (for example a Gmail write action on a read-only method) could make the first save fail the same way. `RemoteMcpProductionSetup.tsx` already sends only active actions. `QuarantinedActionsReview` in `SetupPanel.tsx` selects only from held actions. ## Verification - Red, then green: `server/src/__tests__/google-workspace-mcp-transport.test.ts` → "saves the review when Google no longer offers actions that were on, and still refuses a disabled action". The test saves a managed Google Workspace connection on REST, moves it to Google's MCP servers while Google does not list `list_threads` and `search_messages`, then saves the review with the removed actions in the enabled list. Before the fix it failed with "Disabled actions cannot be enabled". After the fix it passes. The same test makes sure that a disabled action without the removal marker is still refused, and that agents are not offered the removed actions. - Red, then green: `ui/src/pages/apps/app-detail/action-permissions.test.ts` → "finishAppPermissions never asks to turn on an action Google no longer offers or a disabled action". Without the filter, the test fails. - `packages/shared/src/tool-catalog-availability.test.ts` covers the three predicates. - The transport test also sends the removed ids in `reviewedCatalogEntryIds`. Without the coverage fix it fails with "Action review decisions must cover every currently quarantined action exactly once". It also makes sure that the removed rows stay disabled after the save. - Local runs: `google-workspace-mcp-transport.test.ts` and `tool-access-service.test.ts` (542 passed). UI tests in `app-detail`, `features/connections` and `pages/tools` (143 passed). - `pnpm verify` selected the full server suite (1520 files) because `tool-access.ts` is a shared service. On this machine, under load from other sessions, 31 of 33876 tests failed. The run output did not keep the names of the failed tests. The touched test files pass when run alone, and the CI server shards run the full suite on the final head. - `tsc --noEmit` for `server` and for `ui/src`. ## Risks - Low risk. The security rule stays: a disabled action that the provider did not remove cannot be turned on. - Behavior change: Google Workspace and plugin connections now accept a removed action in the enabled list, as remote MCP aggregators already did. The UI no longer sends removed actions, so after a save from the page a removed action stays off if the provider lists it again. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, file edits, test runs). ## 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 - [ ] 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> |
||
|
|
3fbf872d9e |
fix(antigravity): make the task thread read in plain language (#22886)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - A task thread shows what an agent did during a run, as a list of
activity rows under its reply
> - Google Antigravity runs (ordinary and `/swarm`) send no tool
identity, so each row was named after the CLI's display title
> - Users saw rows like "Ran a command · failed Run
mcp_paperclip_paperclip_finish", "Ran File runtime paperclip runner acpx
…", lowercased sentences, and a sha256 dump
> - Each attached file also showed twice, nothing marked a message as a
swarm request, and a refused send only showed a short toast
> - This pull request gives Antigravity tool calls the identity other
harnesses send, and makes the thread read the same live and after the
run
> - The benefit is a task thread that reads in plain language for
Antigravity, with fixes that also help other harnesses
## Linked Issues or Issue Description
**What happened?**
In a live Antigravity `/swarm` run, the task thread showed raw tool
names and internal paths. Examples: "Run mcp_paperclip_paperclip_finish
· failed", "Ran File runtime paperclip runner acpx 5230… antigravity
home … SKILL md", "Ran Swarm started in the task folder with gemini 3 8
flash low …" (lowercased, punctuation removed), "Registered title:
u1.txt, sha256: 7692…". The live list and the finished list used
different words. The CLI's first reads of u1.txt failed ("must be an
absolute path") and were read again successfully, but the thread showed
"failed". Each file showed twice: a file card, and an agent message
"Prepared u1.txt for this response." with a second card. The user's
bubble did not show that the message was a swarm request. When the
server refused a send (for example `/swarm` in Plan mode), only a short
toast explained it.
**Expected behavior**
Rows say what the agent did in plain words, the same while live and
after the run. No raw tool names, internal paths, hashes or key/value
dumps. The refused-then-accepted completion call is hidden as for every
other harness. A failure that a later call recovered reads as "retried".
Each file shows once. A swarm request has a small "Swarm" marker. A
refused send keeps an inline, dismissible error under the composer.
**Steps to reproduce**
1. Assign a task to a Google Antigravity agent with the experimental
swarm setting on.
2. Send `/swarm Create u1.txt containing "one" and u2.txt containing
"two", one helper per file, then verify both.`
3. Expand the activity list while the run is live, and again after it
finishes.
4. Put another task in Plan mode and send `/swarm do something`.
## What Changed
- Runner (Antigravity-owned): new `antigravity-tool-identity.ts` names
each call. Paperclip bridge tools become
`mcp__paperclip__<canonicalRunnerToolName(tool)>` (from the CLI's
`mcp_paperclip_<tool>`, an ordinary run's `paperclip_<tool>` title, or
ACP `_meta.mcp`). Native CLI tools keep their own names (`run_command`,
`view_file`, …) with the command as the subject. Reads of the CLI's own
built-in files (its private Antigravity home) are dropped. Swarm
progress lines get one neutral identity (`swarm_update`) whose subject
is the plain sentence. Swarm file locations are task-relative.
- Runner: a narrow activity-adapter hook (`createToolEventProjection`)
applies this in both places that pump an ACPX turn (in-process driver
and sidecar). The sidecar now keeps a provider-supplied tool detail
instead of overwriting it.
- UI: live rows use the call's subject, drop raw technical names
(Paperclip's own tools need no source label), and use the same "verb +
subject" form as settled rows, so both lists read the same.
- UI: a bridge call recorded under its own id (providers that pass no
tool-use id) joins the provider's row for the same Paperclip tool, in
the live log and in stored events. `register_deliverable` reads
"Attached u1.txt"; content digests never show in an input summary.
- UI: a failed call whose later call of the same tool on the same target
succeeded shows as "· retried" (token-only, same muted style).
Unrecovered failures stay "· failed".
- UI: generated "Prepared <file> for this response." receipts are hidden
for any file that already shows as the run's file card (before, only
images).
- Server + shared + UI: `IssueComment.nativeCommand` ("swarm") is
derived read-only from the server's own activity record on comment list,
get and the POST response. The user's bubble shows a small "Swarm" note.
The `/swarm` eligibility rule (`isAntigravityAgent`,
`antigravitySwarmAvailable`) now lives in `packages/shared`; the
composer shows a light hint when the text starts with `/swarm` and the
assignee can run a swarm.
- UI: the composer keeps the server's message as an inline, dismissible
error after any 4xx refusal, until dismissed or the next send. The
optimistic "Working" row behaviour is unchanged.
Not changed, by design: after a reload, a settled run's activity is
deferred behind "More run output" for every native harness (cold-load
speed), so Antigravity already matches the others.
## Verification
- Red/green runner test `antigravity-tool-identity.test.ts` with a
fixture rebuilt from a live swarm run's updates (ids, paths and hashes
replaced): names, subjects, dropped internal reads, hidden finish
identity, ordinary-run titles and `_meta.mcp`.
- Red/green UI test `antigravity-thread.test.tsx` renders the real run's
stored events (settled) and the same events through the live run-log
parser. It asserts the exact rows, "retried" reads, one "Attached" row
per file, no finish rows, no raw names/paths/hashes, and live ==
settled. It fails on master (raw "Ran Swarm update …", "Read · failed",
"Registered title: …, sha256: …").
- Red/green `TaskChatThread.test.tsx`: a prepared text file shows once;
a refused send shows the server message inline until dismissed and the
Working row clears; only a server-marked comment shows "Swarm".
- `TaskChatComposer.test.tsx`: the `/swarm` hint shows only for an
Antigravity assignee with the setting on.
- Server `antigravity-swarm-request-path.test.ts` (embedded Postgres):
only the user's recorded request is marked; text, metadata, another
user's or an agent's comment are not.
- Local: paperclip-runner acpx/sidecar/provider-events suites, UI
task-chat/transcript/adapters/thread/hooks suites (1630 tests), server
swarm suite, and shared/server/ui/runner typechecks pass. `pnpm verify`
exited 2 (broad input), so CI supplies the broad coverage.
Before (live swarm run, done state):
```
Ran This swarm runs on the google account of this agent s google connection
Ran File runtime paperclip runner acpx 523076a3 3689 4b28 9910 c101bc6b64d8 97d9fb76f6aa11b6 a…
Ran File u1 txt · failed u1.txt
Ran a command · failed
Registered title: u1.txt, sha256: 7692c3ad3540bb803c020b3aee66cd8887123234ea0c6e7143c0…
```
After (same events, settled and live):
```
Swarm This swarm runs on the Google account of this agent's Google connection.
Swarm Started helper writer1: Create a file named u1.txt in the current workspace directory containing exactly "one"
Read · retried u1.txt
Read u1.txt
$ shasum -a 256 u1.txt u2.txt; wc -c u1.txt u2.txt
Attached u1.txt
Swarm Files changed in the task folder: u1.txt, u2.txt
```
## Risks
- Live tool rows for all harnesses no longer show a raw technical name
("Paperclip · search_tasks", "Bash") next to the activity. Rows with a
concrete subject now read like settled rows ("Read README.md", "$ npm
test"). This is a deliberate wording change.
- `register_deliverable` reads "Attached <file>" for all harnesses.
- Generated file receipts are hidden for any file with its own card, not
only images. Human text and agent progress with attachments stay visible
(the same marker and link checks as for images).
- Bridge-call pairing is display only and matches only a Paperclip tool
of the same name that is in flight. Claude already shares one id and is
unchanged.
- One extra indexed activity-log query per comment list or get. No
schema change.
> 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`) in Claude Code, with tool use
(shell, file edits, test runs).
## 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>
|
||
|
|
cd8bcfba16 |
fix(antigravity): swarm usage on Stop/kill, honest recovery text, clean thread text, run-record receipt (#22865)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Google Antigravity agents can run Google's native `/swarm` from a task (#22733, experimental flag) > - The first complete live run of `/swarm` found gaps: a stopped or killed swarm recorded no usage, the lost-process text asked for Retry while Paperclip recovered on its own, CLI-only text and local `file://` paths reached the task thread, and the swarm's settings receipt never reached the run record > - Usage must always be recorded, recovery must just work, and users must not see local paths or internal jargon > - This pull request fixes each gap at the module that owns it, with a red/green test for each > - The benefit is a swarm whose cost, recovery and thread text match what happened ## Linked Issues or Issue Description Refs #22733, #22731 **What happened?** In a live local run of `/swarm` (Gemini 3.8 Flash and Gemini 4 Neon, Google sign-in): - A swarm stopped after 29 s with 7 helpers recorded 0 tokens. A swarm whose CLI process was killed also recorded 0 tokens. - After the CLI process died, the failure text said "Retry starts a fresh swarm in the same task folder" and was marked not retryable, but Paperclip recovered on its own with a fresh swarm. - The thread showed "Run /swarm board (default shortcut alt+s) to open the live board", a stray "." line, links to absolute local `file:///…/<company id>/<task id>/a.txt` paths (on ordinary Antigravity replies too), and a mention of "the Paperclip swarm rules". - The structured swarm receipt (requested and confirmed model, channel, CLI version, account match) was not in the run record. **What did you expect?** Usage recorded for every swarm, text that matches automatic recovery, a thread without CLI hints or local paths, and a queryable receipt. **Steps to reproduce** Run `/swarm` on a task for an Antigravity agent, then Stop it or kill the `agy acp` process, and read the run usage and the thread. ## What Changed - **Usage on Stop and process death** (`antigravity-swarm-runtime.ts`). A stopped prompt's own answer is awaited within the grace window and its `usage` is kept. When no answer arrives (the CLI exited, or did not answer in time), the token counts the CLI streamed in `usage_update` (`_meta.usage`, read with the shared ACP converter) are kept; after an earlier answered prompt they only raise a counter (per-counter maximum), because a streamed count may be session-wide, so nothing is counted twice. The usage is one receipt per run request, so a recovery run never counts it again. What cannot be known: if the CLI exits before it streams any token counts, that prompt's usage is lost with the process. The pinned CLI 1.5.15 declares `usage_update` and a prompt-answer `usage`; whether it fills `_meta.usage` mid-prompt is not proven live. - **Lost CLI process.** The failure is retryable and says "Files the helpers already wrote stay in the task folder", with no instruction to press Retry. Automatic recovery is unchanged and is bounded by the server's existing per-request cap (three failed attempts, then a plain refusal); a new database test pins that cap for the lost-process error code across continuation, recovery and assignment wakes. - **Terminal hint split across chunks** (`antigravity-swarm-presentation.ts`). The swarm passes raw coordinator text to a streaming filter that holds text that could still become the hint, so the hint and its trailing period are dropped wherever the CLI splits them. The fake CLI now streams the hint in the recorded live pieces. - **Local file links, both Antigravity routes** (`antigravity-local-links.ts`, wired in `runtime-host.ts` for agent `antigravity` only). No existing mechanism did this: other harnesses only emit file-reference events, and an ordinary Antigravity reply showed the same links. Before a reply leaves the Runner, a link to a task-folder file becomes its folder-relative path in code (the thread opens a nested path as a task-folder file; a root-level name stays plain text beside its deliverable link, as before, since the thread never opened the `file://` target), a descriptive label keeps the path beside it, other `file://` links keep only their label, a bare task-folder prefix is removed, and the folder named on its own reads "the task folder". Sentence punctuation stays outside file names. `/api/...` and web links are unchanged. Text that could still become a link is held across chunks. - **Swarm rules** tell the coordinator that its text is shown in the task thread: name files by task-folder path, no absolute paths or `file://` links, no terminal commands, shortcuts or live board, no mention of the rules. - **Swarm receipt in the run record** (`antigravity-activity.ts`, `profile-activity.ts`). The sidecar's status sanitizer dropped `antigravitySwarmReceipt`. It now reaches the run as a `provider.notice.recorded` event (category `antigravity_swarm_receipt`) through the same post-turn hook as Cursor's native receipt. It carries requested and confirmed model, thinking level, mode, channel, CLI version and whether the CLI sign-in matches the connection. No account, path, session id or instruction text. No protocol schema change. - The link parsing reuses `localTarget` and `workspaceRelativePath`, now exported from `live/workspace-file-reference.ts`. - The public SDK input registry is resynced for a `packages/shared` change that landed on master. - **Ledger** (`doc/plans/2026-11-22-antigravity-qualification.md`): what the live swarm and Neon runs prove, and what they do not. - Not changed: the user's own `/swarm` comment has no marker in the thread. The thread has no per-message marker for Plan-mode requests either, and comments do not store `nativeCommand`, so there is no pattern to reuse. ## Verification - Red/green: the new runtime and presentation tests fail on the old source (6 failed) and pass with the fix; the receipt test fails without the `antigravity` activity registration. - `cd packages/paperclip-runner && npx vitest run src/drivers/acpx src/cli/acpx-runtime-sidecar.test.ts`: 120 files, 2239 passed. - `cd server && npx vitest run src/services/antigravity-swarm.db.test.ts`: 52 passed. - `pnpm run check:acpx-profiles`, `scripts/contracts/contract-fingerprints.test.mjs` and `node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --check` (unchanged) pass. - `pnpm verify` exits 2 (the fake CLI fixture is a broad input), so CI supplies the broad coverage. - Not run: a live swarm (no paid or live runs from this change). ## Risks - Low to medium. The link filter applies to every Antigravity reply. It holds a short tail of text that could still become a link or local path, and releases it before the next non-text event and at turn end. A tool event that arrives in the middle of a link releases the partial link unchanged. - A lost swarm process is now marked retryable. The server's recovery decision does not read this flag; automatic recovery behaves as before. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code execution in Claude Code. ## 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> |
||
|
|
627d59c5aa |
fix(inbox): group repeated provider failures and clear recovered tasks (#22846)
## Thinking Path > - Paperclip helps people manage work that agents do. > - The inbox tells a person which tasks need a decision. > - A provider usage limit can stop several attempts on one task or affect several tasks. > - Separate failure cards made it hard to tell which tasks still needed attention. > - This change groups failures using the account, reset time, or retry links that Paperclip can verify. > - A person can now see which task to retry, which tasks are waiting, and which ones recovered. ## Linked Issues or Issue Description **What existing behavior does this improve?** It improves the Coordinator inbox when a provider limits usage. **Current behavior** Repeated run failures can fill the inbox. Resolved failures can still appear beside open decisions. **Proposed behavior** Show personal actions in Needs you, automatic retries and snoozes in Waiting, and past events in History. Keep an archived retry chain hidden during automatic attempts. Return it to Needs you when a person must act. **Additional context** Related work includes #18020 on completed tasks, #9704 on archive behavior, and #21570 on usage limits in chat. ## What Changed - Group verified account and reset windows. When that evidence is missing, count linked attempts per task and show the tasks in a collapsible group. - Separate the reported reset time from each task’s retry schedule. Keep unresolved ownership recoveries visible after task closure. Use persisted native retry requests to preserve the original archive and increment the attempt count. - Keep personal archive in the card menu. Put decision receipts and run logs in History. - Align inbox filters, tabs, and history. Share empty-state artwork and placement across Inbox, Goals, Routines, and Secrets. - Index run-history pages and resumed-work lookups, and rate-limit history requests per company and viewer. Add synthetic fixtures for both grouping paths and a manual walkthrough. ## Verification - The author and a human tester completed the synthetic retry-chain walkthrough. Chromium also verified archive, repeat failure, exhaustion, and recovery. - The 64 focused server tests and the UI and server typechecks passed before rebasing. See `doc/testing/coordinator-inbox-test-drive.md` to repeat the manual checks. - The shared SDK input check and all 64 focused server tests passed after rebasing. The OpenAPI suite (59 tests), API catalog suite (2,309 tests), and both demo seed paths passed locally after the CI fixes. - The affected inbox and native-runtime suites passed locally after merging the upstream conformance test fix in #22854. The browser access-denial scenarios passed three runs each for 403 and 404. - The migration checks and 79 focused tests passed, including an index-plan regression with 5,000 unrelated runs. The migration and query plan were reverified after renumbering. [Full CI on `cf52b80161`](https://github.com/paperclipai/paperclip/actions/runs/45529834793) passed after rerunning a timed-out server shard. ## Risks The attention feed reads retry ancestry. Long chains can increase query cost. Task and company checks bound the traversal, and cycle detection stops repeated visits. Providers that omit the reset time leave the card with an unknown reset. Migration 0508 adds two indexes concurrently. Each run-history page returns at most 100 records. ## Model Used OpenAI Codex, GPT-6 family, with repository editing, local test execution, and browser verification. ## 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 --------- Co-authored-by: Scott Tong <scott@scotts-mbp-m5-max.local> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
0c3ed144cb | Label opt-in traces with the public instance hostname (#22856) | ||
|
|
12944919c6 |
feat(google): keep Google Technical Information at most 30 days and keep Google data out of training exports (#22842)
Adds a durable, sleep-aware 30-day sweep for Google Technical Information, keeps Google results out of decision training and shared feedback traces, and deletes the remaining copies of a cleaned run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3ad8f00192 |
feat(antigravity): trusted /swarm from the task composer, behind an experimental flag (#22733)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Google Antigravity agents can run Google's native `/swarm` (a coordinator, helpers and a verifier) only on the Antigravity CLI > - #22731 adds a verified CLI route to the Runner, but nothing selects it yet > - A swarm must start only when the signed-in user asks for it, only when an admin turned the experimental feature on, and never silently run as an ordinary request when it cannot run > - This pull request adds the trusted `/swarm` request in the task composer, the server checks and run selection behind an experimental flag, removes Paperclip delegation tools from a swarm turn, and adds the attended catalog cells, docs and ledger > - The benefit is that a user can start a native swarm from a task, and gets one plain message when it is not available ## Linked Issues or Issue Description Refs #22731, #22727, #22728, #22701 **Subsystem affected** Task composer (UI), issue comments API, run selection (server), Paperclip Runner tool bridge, runner-e2e catalog, docs. **Problem or motivation** A user who writes `/swarm <request>` to a Google Antigravity agent should get a real native swarm in the task folder. Today `/swarm` is neutralised text, and the task runs as an ordinary request. **Proposed solution** Read a leading `/swarm` with the shared rule from #22727 in the composer, send it as a structured request, check it on the server, and select the CLI route from #22731 for that run only. ## What Changed - **Trusted start (UI).** `parseSwarmCommand` in `composer-commands.ts` uses `parseLeadingUserCommand` (the one rule from #22727). A leading `/swarm` in the task composer sends the request text with `nativeCommand: "swarm"`; a bare `/swarm` asks for a request; `/swarm` with an assignee change is refused; `/swarm` anywhere else stays text. A resent draft keeps the structured request. - **Contract.** `addIssueCommentSchema` gains `nativeCommand: "swarm"`. `instance.experimental.enableAntigravitySwarm` (feature catalog, settings page, server defaults), off by default. No Cloud policy in Core. - **Server (`services/antigravity-swarm.ts`, comments route, runtime selection).** - The comments route accepts `nativeCommand` only from a signed-in board user. When a swarm cannot run it answers 422 with one plain message and posts nothing: flag off, not a Google Antigravity assignee, a chat, Plan mode. - An accepted request is recorded in the activity log (`issue.antigravity_swarm_requested`, server-written) and the assignee's wake carries the comment id. Comment text is never read as a command. - Run selection makes the run a swarm only when that activity record exists. It refuses a remote or cloud environment and Plan mode with a plain run failure, so a swarm is never run as an ordinary request. It logs `issue.antigravity_swarm_started` in plain language: helper actions are auto-approved, Paperclip does not sandbox the helpers and cannot see their shell commands, and usage is one total. - The native execution input sets the Antigravity provider mode `swarm` for that run only, and carries the verified request in its own field, `provider.swarmRequest` (the Runner contract accepts it only with that mode and requires it there, 1 to 16,000 characters). The Runner copies it into the model envelope as `swarmRequest`; the swarm route sends exactly `/swarm <swarmRequest>` and never reads `task.prompt`, which holds rendered wake comments, task context and text the Runner adds (handoff, attachments, queued messages). - The swarm turn contract (mode `swarm`, envelope `paperclip.native-model-envelope.v3`, `swarmRequest` of 1 to 16,000 characters) is declared as `antigravitySwarmTurn` in `protocol/provider-schemas/acpx-sidecar.schema.json` and generated into TypeScript, so the pack `contractDigest` covers it (it changes; older image packs are rebuilt rather than reused). Provider profile `commandDigest`s and versions are unchanged, so no saved session is reset. - What the swarm sees of the task: only the request. The title, the description (which other people or agents may have written) and other comments are not part of the prompt; the coordinator can read them through Paperclip's task tools as data if it needs context. - An empty `/swarm` or one over 16,000 characters is refused in the composer, by the comments route (422, nothing posted) and at run selection (plain run failure), so it never runs as ordinary work. - A swarm run never takes queued messages, and Interrupt treats it as already started: it stops the swarm and delivers the queued message as the next ordinary request, before or after the provider accepted the turn. - Retry after Stop, and past the three automatic attempts, counts only when the signed-in user asked for it (their own Retry request on the task after the last attempt). Wake reasons and copied run context are not proof: a recovery that copies the request marker, an automatic retry on the user's behalf, or an agent wake that names `task_retry` stay bounded. - **Runner.** For a swarm turn the Paperclip bridge drops delegation tools (`paperclip_create_task`, `paperclip_create_issue`, hire/assign tools); the instructions also tell the coordinator not to delegate. - **runner-e2e.** `antigravity-swarm` suite, 5 local cells (`two-helpers-and-verifier`, `stop-mid-swarm`, `process-loss-retry`, `follow-up-after-swarm`, `flag-off-refusal`), explicit-only, never in `--all` or CI matrix jobs. There is no automated executor yet: the launcher refuses the cells and points at the live recipe. Catalog counts updated (1392 cells). - **Docs.** `tests/runner-e2e/SUITES.md`, `doc/evals.md`, and the `/swarm` section, ledger row and live recipe in `doc/plans/2026-11-22-antigravity-qualification.md`. ## Verification - `pnpm --filter @paperclipai/server exec vitest run src/services/antigravity-swarm.test.ts`: 2 passed (red first: module missing; Plan mode red then green). - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/issue-comment-reopen-routes.test.ts -t swarm`: 3 passed; 2 red against the route without this change. - `pnpm --filter @paperclipai/ui exec vitest run src/components/task-chat/TaskChatComposer.test.tsx`: 164 passed, including 4 new `/swarm` tests (red first). - Runner: `vitest run src/drivers/acpx/antigravity-swarm-*.test.ts`: 69 passed (route tool filter red first). - runner-e2e: `antigravity-swarm.test.ts` (red first) plus the catalog, selector and Antigravity tests: 28 files passed. - Typecheck: server, UI (except generated Storybook files absent from a worktree) and runner: no errors. - Live, real CLI 1.5.15 with the owner's sign-in, through the driver: the receipt verified (pinned identity, task folder, `auto` read back, `gemini-3.8-flash` + `low`). Google then refused the prompt with its 429 quota text; the driver reported it as a typed "out of quota" failure, retired the CLI and nothing was written. - **Not run live yet:** the full Paperclip proof (swarm to Done, Stop, kill and Retry, follow-up, flag off). This PR is merged only after it passes. Recipe: `doc/plans/2026-11-22-antigravity-qualification.md#swarm-live-proof`. ## Risks ### Security notes: the trust boundary Helpers are auto-approved and Paperclip does not sandbox the CLI on a local computer, so the boundary is who asked and what text is sent. Every input that can influence it: **(a) Whether a run is a swarm** - `nativeCommand: "swarm"` on the comment request: accepted only from a signed-in board user; the request record (`issue.antigravity_swarm_requested`, actor = that user, `commentId`) commits in the same transaction as the comment. Paperclip-written. - `antigravitySwarmCommentId` on the wake/run context: set only by the comments route and by run selection. It is a pointer, never trusted alone: selection re-verifies comment id + task + company + human author (no agent author) + a matching record by the same user. - The pending request for marker-less wakes: the task's latest human comment, verified the same way. - Retry inheritance: the run's `retryOfRunId` chain (server-written), bounded to 8 hops on the same task. - Manual vs automatic: a request's first run, or a user's own Retry request (`task_retry` / `retry_failed_run`, requested by a user, not `initiatedBy` automation) after the last attempt. Not the wake reason string. - Instance flag `enableAntigravitySwarm` (admin), the assignee's adapter config (Google Antigravity), execution target (local only), work mode (Standard only: Plan, Ask and any other mode are refused, at comment time and at run time), chat vs task: all Paperclip-owned settings. - Prior attempts on the same request (run status rows): Paperclip-written. **(b) What text and tools the swarm gets** - The prompt: `/swarm ` + `provider.swarmRequest`, which is the recorded comment body minus a leading `/swarm`, trimmed, byte for byte (tested through the production input builder and envelope with a merged wake that contains an agent comment). The verified request. - The system prompt append: only Paperclip-authored text: Paperclip's fixed execution prompt, the run's hand-in values (the server-written completion revision and criterion IDs that `paperclip_finish`/`paperclip_block` require; never a criterion's requirement text), and the fixed swarm rules. **The swarm runs without the agent's own instructions**: the instruction bundle and connection instructions are left out, because an agent with an editable instructions folder can rewrite its instructions in an earlier ordinary run, the helpers act under auto mode, and Paperclip keeps no user-approved copy of those instructions to trust instead. - Tools: only Paperclip's own MCP bridge (any other assigned tool server refuses the swarm), with delegation, hiring, routing and generic API operations removed. Paperclip's permission handler approves a CLI permission request only when its tool name is `mcp_paperclip_<tool>` and `<tool>` is one the run's bridge admits; everything else is refused, and the CLI then ends the turn. Tool descriptions are Paperclip-authored; tool results (for example other comments) are data the coordinator reads, not the request. - Model and mode: the agent's configured model, Antigravity's `auto` mode, both read back and pinned by the receipt. - Not sent: task title, description, wake comments, continuation events, attachments, queued messages, handoff text. Known residual: a Retry or recovery run that has not yet been selected (still preparing) does not carry the request marker, so an Interrupt in that short window keeps the message for the turn boundary instead of stopping the run; the message is delivered after the run ends. - Off by default and local only. With the flag on, helpers act under Antigravity's `auto` mode. **Paperclip does not sandbox them on a local computer**, and their tool calls never reach Paperclip, so helper shell commands can write outside the task folder where the CLI's own sandbox allows (workspace plus temp directories). The settings text, the activity log and the plan doc say so. - On macOS the CLI uses its own Google sign-in from the login keychain, not Paperclip's stored connection. - Google's consumer terms have a clause about third-party tools that access the service. A legal read is pending; this PR does not claim compliance. - `/swarm` as the first word of a composer message is now a swarm request for every agent; for agents other than Google Antigravity the server refuses it with a plain message. To send the literal text, put other text first. - The new runner-e2e cells are attended only and have no automated executor. > 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`. Review round 2 (head |
||
|
|
021be2c56d |
perf(ci): split local-verify tests so release registry runs them in parallel (#22819)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Every pull request runs the "Typecheck + Release Registry" CI job.
> - In a recent PR run that ran all checks, this job was the longest
check (450s). In other recent PR runs it took 405s and 413s.
> - In those runs, the `release registry tests` task took 178–202s.
Almost all of that time was one file:
`scripts/__tests__/local-verify.test.mjs`. Its tests ran one after the
other for ~200s, because `node --test` runs the tests in one file in
sequence.
> - While that task runs, it holds one of the three slots of the
typecheck lane and adds CPU load. This makes server declarations and
test projects start later and run slower.
> - This pull request splits the file into three balanced files, so
`node --test` runs them in parallel processes.
> - The benefit is a shorter release registry task (local measurement:
179s → 65s for these tests) and a shorter Typecheck + Release Registry
job.
## Linked Issues or Issue Description
No existing GitHub issue covers this, so here is the issue, following
the enhancement template.
**What existing behavior does this improve?**
How long the CI job "Typecheck + Release Registry" takes on PRs that
select the release registry tests.
**Subsystem affected**
CI and repository scripts (`scripts/__tests__`,
`test:release-registry`).
**Current behavior**
In the PR runs that select it, the job is the longest check (405–450s).
Its `release registry tests` task takes ~200s. Almost all of that time
comes from `scripts/__tests__/local-verify.test.mjs`. `node --test` runs
the tests in one file in sequence.
**Proposed behavior**
Move the shared fixture into a helper module. Split the tests into three
files with similar run times, so `node --test` runs them in parallel
processes.
**Reason and benefit**
Faster CI feedback for many PRs. What the tests check does not change.
**Breaking changes**
None. Only test files and the `test:release-registry` file list change.
## What Changed
- Moved `fixture()` and `repository` from
`scripts/__tests__/local-verify.test.mjs` to a new helper module,
`scripts/__tests__/local-verify-fixture.mjs`. The code is the same.
- Split the tests into three files with similar run times (measured on
CI):
- `local-verify.test.mjs` (~70s): real selected execution, plus the fast
snapshot and plan tests.
- `local-verify-partitions.test.mjs` (~68s): the general-workspaces-b/c
partition tests, installed dependency invalidation, and local server
selection.
- `local-verify-reuse.test.mjs` (~61s): explicit full execution, source
mutation and interruption, stale SDK pins, and edit during
fingerprinting.
- Added the two new files to `test:release-registry` in `package.json`.
- Refreshed `tests/runner-e2e/source-sdk-public-inputs.json`, because
`package.json` is a pinned SDK public input.
- The test bodies are the same. Only the imports changed.
## Verification
- Original file alone: `node --test
scripts/__tests__/local-verify.test.mjs` → 179s wall time (4 vCPU).
- Three new files: `node --test
scripts/__tests__/local-verify*.test.mjs` → 65s wall time. Each run has
the same 15 tests.
- In this sandbox, one test ("an edit between diff discovery and
fingerprinting...") fails both before and after the change. The cause is
a local `git` launcher wrapper that refuses a recursive call. CI does
not have this wrapper. The CI `Typecheck + Release Registry` job on this
PR runs all of the tests.
- Expected CI effect: the `release registry tests` task goes from ~200s
to ~70–100s (the CI runner has more CPU load than the local test). The
task frees its lane slot ~100s earlier. For PRs that select release
registry tests, I expect the Typecheck + Release Registry job to save
~30–60s (from ~405–450s). PRs that do not select release registry tests
are not affected.
## Risks
- Low risk. This change affects only test files.
- The three files now run at the same time. Each test uses its own
temporary fixture directory, so the tests do not share state.
- More parallel processes add CPU load to the 4 vCPU typecheck runner
for a shorter time. The total CPU work is the same.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`), run as a Claude Code agent with
tool use (shell, 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
- [ ] I have run tests locally and they pass (14/15 pass locally; the
one failure is the sandbox git wrapper and also fails on master)
- [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
- [ ] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
8c04793a4a |
feat(google): delete content read from Google when access ends (#22836)
Every way a Google connection ends now starts the durable connection content deletion on its own, and Paperclip never resumes a cleaned harness session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
de4b60fc54 |
refactor(test): prune 28 completed migration, prose-grep, and Storybook fixture tests (#22832)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Over recent sprints, the test suite accumulated completed one-time SQL migration backfill tests, brittle static prose-matching guidance tests, and non-production Storybook fixture/prototype/feasibility-probe tests that add compile and CI maintenance cost without testing live behavioral invariants. > - Core database migration guards, active runtime migration services, security/safety static guards, and active adapter suites must stay intact. > - This pull request deletes 28 audited low-value test files (-1,894 LOC), preserves the one genuine schema validation assertion from `chat-communication-guidance.test.ts` inside `packages/shared/src/validators/chat-channels.test.ts`, prunes the 5 deleted server test keys from `scripts/general-server-shard-durations.json`, and refreshes `tests/runner-e2e/source-sdk-public-inputs.json`. > - The benefit is cleaner, higher-signal test coverage with zero lost invariants and synchronized SDK public source pins. ## Linked Issues or Issue Description Refs #22804 **What existing behavior does this improve?** Test suite signal-to-noise ratio and maintenance overhead across `packages/db`, `packages/shared`, `packages/skills-catalog`, `server`, `ui/storybook`, `scripts`, and `tests/speko-voice-proof`. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** 28 test files test already-shipped one-time migrations/dead backfills, static markdown/copy wording, non-production Storybook fixtures/prototypes, or a superseded voice feasibility probe. **Proposed behavior** Remove the 28 low-value test files while preserving all core migration integrity suites, active runtime migration services, security static guards, live adapter suites, and the genuine `updateChatEndpointSchema` assertion. ## What Changed - **Completed one-time migrations & dead backfills (3 files deleted, 444 LOC):** - Deleted `packages/db/src/better-auth-account-issuer-migration.test.ts`, `packages/db/src/chat-telegram-draft-ids-migration.test.ts`, and `server/src/__tests__/tool-oauth-legacy-backfill.test.ts` (zero production callers outside barrel re-export). - Retained all core DB migration guards (`check-migration-safety`, `migration-compatibility`, `migration-snapshot-drift`, `check-pr-migration-order`) and active runtime migration/legacy-recovery services. - **Brittle static prose/wording grep tests (9 files deleted, 317 LOC):** - Deleted `packages/shared/src/connection-intent-guidance.test.ts`, `packages/shared/src/telemetry/readme-contract.test.ts`, `packages/skills-catalog/src/release-content-cases-contract.test.ts`, `server/src/__tests__/secret-entry-guidance.test.ts`, `server/src/__tests__/primary-agent-guidance.test.ts`, `server/src/services/chat-communication-guidance.test.ts`, `server/src/services/onboarding-greeting.test.ts`, `ui/src/lib/agent-onboarding-prompt.test.ts`, and `ui/src/lib/grok-bot-setup-prompt.test.ts`. - Moved the one genuine schema validation assertion (`updateChatEndpointSchema` `communicationInstructions`) into `packages/shared/src/validators/chat-channels.test.ts`. - Retained `cli-invocation-safety.test.ts` and all real security/auth/prompt-injection guards. - **Non-production Storybook fixture / prototype / feasibility-probe tests (16 files deleted, 1,182 LOC):** - Deleted 10 Storybook fixture/prototype/mock-API tests, 2 unreferenced Storybook audit script tests, and 4 superseded `tests/speko-voice-proof/*.test.mjs` feasibility probe tests. - **Manifest & SDK pin hygiene:** - Pruned the 5 deleted server test keys and reconciled coverage counts in `scripts/general-server-shard-durations.json`. - Synced `tests/runner-e2e/source-sdk-public-inputs.json` via `node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --write` (0 files deleted under `tests/runner-e2e/`). ## Verification - `node scripts/check-maps.mjs` — **PASS** (35 areas, 192 capabilities aligned) - `node scripts/check-test-budget.mjs --base origin/master` — **PASS** (588 nightly suites validated) - `pnpm exec vitest run` on retained suites (`chat-channels`, `telemetry`, `skills-catalog`, `check-migration-safety`, `migration-compatibility`, `migration-snapshot-drift`, `runner-api`) — **15/15 files, 2,532/2,532 PASS** - `node tests/runner-e2e/source-sdk-public-inputs.mjs $(git rev-parse HEAD) --check` and `vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/source-sdk-public-inputs.test.mjs` — **PASS (13/13)** - `node --test scripts/typecheck-test-programs.test.mjs scripts/__tests__/ci-typecheck-lane.test.mjs scripts/__tests__/run-vitest-stable-shard.test.mjs scripts/storybook-catalog.test.mjs` — **103/103 PASS** - Typecheck (`@paperclipai/shared`, `@paperclipai/db` incl. `check:migrations`, `@paperclipai/skills-catalog`, `node scripts/ci-typecheck-lane.mjs --typecheck-ui`) — **PASS (0 errors)** ## Risks - Low risk: zero production code changed, zero core DB migration or auth/security guards removed, and zero dangling references across `maps/`, `scripts/`, `.github/`, or `tsconfig*.json`. ## Model Used - Google Gemini (Antigravity agent swarm) with extended reasoning, tool use, and local test execution (`typecheck-opt`, `verifier`, `ci-pipeline`). ## 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 |
||
|
|
6d5541b109 |
fix(e2e): observe scheduled native retries before grading tasks (#22826)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Product journeys observe native tasks until their useful result is
complete.
> - A native session can time out while the server schedules an
exact-session retry.
> - The run status is temporarily failed while its retry remains
scheduled.
> - The observer currently grades that temporary state as a final
failure.
> - This pull request keeps observing a bound scheduled retry within the
original deadline.
> - The benefit is a grade based on the completed task, with terminal
failures and work limits preserved.
## Linked Issues or Issue Description
**What happened?**
A build-and-revise task prepared its ZIP, then hit a five-minute native
session timeout. The API reported agent-owned exact-session recovery on
the same run with one of three attempts used and a retry scheduled
before the campaign deadline. The journey raised `agent_run_failed`
before that retry could occur.
**Expected behavior**
Observe a proven scheduled retry on the same run within the original
deadline. Require a later successful run and the existing independent
artifact checks. A pending retry cannot pass the journey.
**Steps to reproduce**
Run the new agent-recovery regression against the previous observer. A
realistic failed native run with a scheduled retry fails immediately.
The corrected observer sees the same run succeed and still fails
terminal, exhausted, foreign and late recovery states.
**Paperclip version or commit**
Reproduced from
|
||
|
|
3128be7cda |
fix(e2e): preserve exact spacing around handoff mentions (#22825)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Product journeys check that a person can hire and delegate through
chat.
> - The journey selects real agent and project mentions in the composer.
> - Each selection inserts a trailing space for the next typed word.
> - The helper then types the complete next source slice, including its
own whitespace.
> - This pull request removes the inserted space through normal keyboard
editing before continuing.
> - The benefit is one exact saved message with the existing strict
identity and count checks.
## Linked Issues or Issue Description
**What happened?**
The hiring journey saves two spaces after its agent mention and an
unwanted space before the comma after its project mention. Its exact
saved-body assertion fails after the delegated task completes. The
retained historical observation lacks the original message comparison.
This PR reproduces the spacing defect directly in the production
composer; it does not claim those missing historical inputs were
recovered.
**Expected behavior**
Normal mention selection must preserve the exact requested body,
including whitespace and punctuation, and save it exactly once.
**Steps to reproduce**
Run the production composer browser spec with the quoted checklist
reference. Before the repair, the saved message has an extra space after
each selected mention. After the repair, the body matches exactly.
**Paperclip version or commit**
Reproduced from source at
|
||
|
|
823e90d8b2 |
fix(e2e): follow current routine form and schedule controls (#22821)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - The scheduled-routine journey checks creation, timed execution,
saved output and pause.
> - The routine page redesign changed its form and schedule controls.
> - The journey still used the old title placeholder, Responsible picker
and trigger editor.
> - It stopped before it could measure scheduling, even after the New
routine button fix.
> - This pull request follows the current controls and adds a
production-component browser regression.
> - The benefit is a usable schedule test with the same independent
behavior checks.
## Linked Issues or Issue Description
Refs #22182 and #22205. Related open #22340 changes other routine page
details; it does not update this journey.
**What happened?**
The scheduled-routine journey opens New routine, then times out on the
removed Routine title placeholder. The current form labels that field
Title. It has a Default agent picker and a separate Project picker. The
old journey also expects the removed Schedule trigger region and Enable
trigger control.
**Expected behavior**
The journey must use the current form, resume its owned schedule,
observe one attributed scheduled run, pause it, and check the next full
schedule boundary.
**Steps to reproduce**
Run the new credential-free browser control against the previous UI
actions. It renders the production RoutineEditDialog and fails waiting
for the old Routine title placeholder. The same control passes with this
repair.
**Paperclip version or commit**
Reproduced from master at
|
||
|
|
4401962e69 |
feat(google-workspace): run the six launch services on Google's MCP servers again (#22815)
Gmail, Drive, Docs, Sheets, Slides and Calendar go back to google_mcp because of Google's Workspace AI Tools Addendum; the REST tool set stays as the fallback. The REST argument checks that need no request to Google run before each MCP call, a Calendar delete reads the event first and refuses a recurring series, and a refresh that replaces saved REST definitions holds nothing for review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1a36a8f3c0 |
fix(e2e): wait for agreeing dependency run observations (#22802)
## Thinking Path > - Paperclip lets people manage AI agents and their work. > - A blocked task must start once after its blocker is complete. > - The dependency journey checks this through task and agent run reads. > - These independent reads can see the same run at different stages of completion. > - The collector can stop while the agent read still says `running`. > - This pull request waits for both reads to agree before it saves the finished and reopened points. > - The test can then measure the completed work with the existing strict rules. ## Linked Issues or Issue Description **What happened?** The dependency journey can report `dependency_one_automatic_resume` after one correct automatic run. Its completion wait accepts the task run as `succeeded` while the agent run read still says `running`. A later read agrees, but the saved finished point remains split. **Expected behavior** Wait for matching task and agent run facts within the existing campaign deadline. Keep the two observations independent. Fail if they never agree. **Steps to reproduce** Use the flow fixture to return a completed task run and a lagging agent run detail. Run the new `agent detail still running after task detail completed` case against the old collector. It fails with `dependency_one_automatic_resume`. **Paperclip version or commit** Base: `3ca9b6d471e100fe248c650f30453db4d3bc55fb`. Related: #21732 added valid wake producers. That repair is already present and does not address this read timing error. ## What Changed - Compare task and agent run facts with the same normalized facts used by the grader. - Require agreement before the collector ends its completion wait and after it reopens the result. - Tag fixture projections explicitly, with separate agent lag counters before and after reopening. - Share the full settled predicate between both waits; agreeing stale reads cannot count as completion. - Add temporary and permanent cases for agent lag, task-only and agreeing stale run views, task status, missing document, active locks and native phase. - Document the completion wait. Keep the grader, run budget and deadline unchanged. ## Verification - Red: the new lagging-read regression fails on the base collector with `dependency_one_automatic_resume`. - Green: three focused dependency suites pass, 126 tests. This includes permanent disagreement, duplicate or unrelated runs, early execution, history and output checks. - Command: `node /tmp/pap5740-test-tools/node_modules/vitest/vitest.mjs run --config /tmp/pap5740-test-tools/vitest.config.mjs`. The temporary config selects `tests/runner-e2e/product-journeys/task-dependency-resume*.test.ts`. Tools: Vitest 5.0.3, Playwright 1.62.1 and Zod 4. - `pnpm verify` could not run: the managed Git storage guard rejects `git ls-files` with `paperclip_git_storage_limit`. CI must supply broader checks. - No new paid journey was run. Staging acceptance remains open. No reviewed harness pin was changed. - Follow-up commit: `16bb94c256769fe76b014e865259b742b35773ea`. The reopened-only regression fails on the prior commit with `dependency_one_automatic_resume`; it passes after this repair. - Second follow-up: `45d60118fb36fd1f426e088f263d04c91484cfee`. Ten of twelve new stale-state cases fail on `16bb94c`; all pass after sharing the settled predicate. - Exact finished-run binding: `24d7b2f67a9f51ac6d996211f651a92772ff2a55`. Both reopened projections must match the normalized saved finished-run facts. Two additional agreeing-but-different run-facts cases fail before this change and pass afterward. - CI and Greptile passed on `16bb94c`; reviews also cleared `45d6011`. Fresh CI and reviews are pending on `24d7b2f`. ## Risks Low risk. A mismatch now uses the remaining campaign wait rather than reaching the grader early. Permanent disagreement still fails at the deadline. This change does not start another agent run, alter production state, replace either independent read, or relax the grader. ## Model Used OpenAI GPT-6 through Codex, with reasoning and code execution. The runtime did not expose a more specific model ID. ## 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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
096060598d |
Add project pinning to the Coordinator sidebar (#22805)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Operators use projects to organize and review related tasks. > - The Coordinator sidebar provides quick access to pinned items. > - Project pins were available from Recents after a project visit. > - This PR makes each project pinnable directly from More → Projects. > - Pinned project rows expand in place so operators can open a recent task from the sidebar. ## Linked Issues or Issue Description **What existing behavior does this improve?** Project navigation in the Coordinator workspace. **Subsystem affected** The board UI, specifically the Projects list and the left sidebar. **Current behavior** Users who review work by project must visit a project before they can pin it from Recents. Project rows use a separate expand control. Hidden sidebar controls also reserve space that can truncate project and task names. **Proposed behavior** Give each Coordinator project row a pin action. Let users click the sidebar project row to open or close its recent tasks, and give labels the full available width while row controls are hidden. **Reason and benefit** Users can set up several project shortcuts from one page and reach the tasks they review regularly from the sidebar. ## What Changed - Add pin and unpin actions to Coordinator Projects rows using the existing per-user browser preference. - Make pinned and recent project rows expand and collapse their tasks. Show closed and open folder icons for the two states. - Match nested task spacing to adjacent navigation items and give nested tasks a small indent. - Reserve sidebar label space for controls when they are visible. Keep the project icon and text centered in the Projects list. - Scope project star and join or leave controls to Classic mode. ## Verification - Run `pnpm --filter @paperclipai/ui typecheck`. - Run the focused workspace preference, project query, and pinned navigation Vitest files. - Run `tests/e2e/project-pinning.spec.ts` in Chromium to verify pinning, persistence, label width, expansion, and task navigation. - In Chromium, open More → Projects and pin a project. Reload and confirm the shortcut persists. Expand it using the mouse or keyboard, open a nested task, reorder pins, and unpin from either the list or the sidebar. - Check label widths at rest and with hover, keyboard focus, and touch controls. Check that Classic mode shows the star and membership controls. - GitHub Actions passed on `e96959bffe`, including build, typecheck, and all eight browser shards. Two server shards passed on retry. [CI run](https://github.com/paperclipai/paperclip/actions/runs/45466386598) - Greptile gave the same commit 5/5 with no open review threads. [Review](https://github.com/paperclipai/paperclip/pull/22805#issuecomment-7141648518) ## Risks - Clicking a project row in the Coordinator sidebar now opens its task list in place. Users can still open the full project from the Projects page. - This UI change reuses the existing browser preference and project task query. It requires no database migration. ## Model Used OpenAI Codex with GPT-6.2-Sol. Used local code execution, Chromium, and 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 --------- Co-authored-by: Scott Tong <scott@scotts-mbp-m5-max.local> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
cffd17e78a |
perf(ci): Phase 3 PR CI under 3m — 4x Runner support, 12x E2E, incremental TS 7 cache, pure-Node postinstall, and rebalanced shards (#22804)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Pull request CI verifies every change before merge across build, typecheck, server tests, Runner tests, and Playwright E2E shards. > - After Phase 1 (#22679) and Phase 2 (#22729), full-fanout PR CI still takes 9m45s wall-clock on 4-core AWS runners because of five bottlenecks: an unsharded 7m22s `Runner support suite`, stale server/chat/Runner shard duration manifests plus newly landed SSH/soak whales, 28s of `pnpm -r run postinstall` replay on every job, cold server/UI typecheck and single-build overhead, and 3 oversized (>180s) Playwright E2E specs across 8 shards with double-start Postgres template boot. > - Docs-only prose edits under `doc/**` and `docs/**` also fanned out to 66 CI jobs because only three doc paths bypassed global dependencies. > - This pull request shards `Runner support suite` 4 ways with `pool: "threads"`, shards E2E 12 ways after splitting the 3 oversized specs and removing double-start Postgres boot, adds pure-Node workspace postinstall replay, adds read-only master-warmed incremental TS 7 and Runner dist caches, rebalances all server/chat/Runner duration manifests, demotes 48 new non-invariant soak whales to nightly, and routes audited prose docs without triggering 66-job storms. > - The benefit is driving ordinary PR CI toward under 3 minutes wall-clock while preserving every invariant check, cache boundary, and full master/nightly test coverage. ## Linked Issues or Issue Description Refs #22679 Refs #22729 **What existing behavior does this improve?** Pull request CI wall-clock latency across `.github/workflows/pr-trusted.yml`, `.github/workflows/release-verify.yml`, `.github/actions/setup-ci-dependencies/action.yml`, typecheck orchestration, Vitest/Runner lanes, and Playwright E2E shards. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** Full-fanout PR CI takes 9m45s on 4-core runners (run `45440355579`), dominated by `Runner support suite` (7m22s), `e2e shards` (5m02s–6m24s), `General tests (server/chat)` (5m37s–6m01s), `Verify Paperclip Runner (vitest package)` (6m25s on stale manifests), `Typecheck` (4m13s–6m30s), `Build` (~4m), and 28s of `pnpm -r postinstall` per job. Prose edits under `doc/**` trigger 66 jobs. **Proposed behavior** Shard `Runner support suite` (4x) and `e2e_shards` (12x), split the 3 oversized E2E specs, boot disposable E2E Postgres in a single non-durable start, replay workspace `postinstall` in pure Node (<1s), cache prebuilt Runner dist and TS 7 `.tsbuildinfo` from canonical `master` pushes (read-only in PRs), use emit-only server compile in ordinary PR `Build`, rebalance all shard duration manifests, demote 48 new non-invariant soak whales to nightly, and route audited prose docs cleanly. ## What Changed - **Pure-Node postinstall replay (`scripts/replay-workspace-postinstall.mjs`, `.github/actions/setup-ci-dependencies/action.yml`):** Replaces the 28s `pnpm -r --if-present run postinstall && pnpm run postinstall` call on every CI job with a pure-Node parallel runner (~0.84s locally) with fallback for older checkouts. - **4-way sharded `Runner support suite` + `threads` pool (`.github/ci-task-matrix.json`, `.github/workflows/pr-trusted.yml`, `tests/runner-e2e/run-unit.mjs`, `tests/runner-e2e/vitest.config.ts`):** Shards Vitest and `node:test` suites 4 ways (`--shard-index 0..3 --shard-count 4`) and switches `tests/runner-e2e` to `pool: "threads"` with CPU-aware `maxWorkers` while preserving `isolate: true`. - **12-way E2E shards, single-start E2E Postgres boot, and 3 oversized spec splits (`tests/e2e/start-e2e-server.ts`, `tests/e2e/*.spec.ts`, `tests/e2e/playwright.config.ts`, `scripts/e2e-shard.mjs`, `scripts/e2e-shard-durations.json`, `.github/ci-task-matrix.json`):** Boots cold ephemeral E2E Postgres in one `initdb --no-sync` + non-durable `postgresql.conf` start overlapped with server module import; splits `agent-chat-projects`, `chat-adapters-ui-providers`, and `chat-adapters-ui-messaging` cleanly with zero tests removed; balances all 54 specs across 12 shards (6.8s spread). - **Incremental TS 7 typecheck & Runner dist caching (`server/scripts/typecheck-layers.mjs`, `scripts/ci-typecheck-lane.mjs`, `scripts/typecheck-test-programs.mjs`, `scripts/typecheck-test-projects.mjs`, `.github/workflows/pr-trusted.yml`, `.github/workflows/release-verify.yml`):** Preserves portable `.tsbuildinfo`/`.d.ts` with `layer-map.json` invalidation and stale-declaration pruning, wires read-only `runner-dist-v1` and `typecheck-incremental-v1` restores in `pr-trusted.yml` (zero `actions/cache/save`) paired with canonical-`master`-only guarded writers in `release-verify.yml`, skips redundant Runner Rust `cargo check` on TS-only shared PRs, and uses LPT scheduling with concurrency 3 (4-core) / 4 (8-core). - **Emit-only PR `Build` & audited prose doc routing (`.github/workflows/pr-trusted.yml`, `.github/scripts/ci-inputs.mjs`):** Passes `PAPERCLIP_TSC_EMIT_ONLY=1` on ordinary PR `Build` jobs (full `pnpm build` on `full-ci` / `master`), and classifies audited prose Markdown under `doc/**` and `docs/**` as `guidance` / `historical` while keeping `docs/api/**`, JSON/TS fixtures, `maps/**`, and unknown files fail-closed. - **Rebalanced shard manifests & new soak demotions (`scripts/ci/nightly-only-suites.json`, `scripts/*-shard-durations.json`, `packages/paperclip-runner/scripts/vitest-lane-durations.json`, `packages/paperclip-runner/vitest.config.ts`, `packages/paperclip-runner/scripts/vitest-sequencer.mjs`):** Demotes 48 newly landed/grown non-invariant soak suites (including 4 real-SSH integration suites) to nightly, refreshes all 4 timing manifests from live CI measurements (0.1s–0.6s LPT skew), and scales Runner package Vitest CI `maxWorkers` to 3 on 4-core / 6 on 8-core. ## Verification - `node --test .github/scripts/tests/*.test.mjs scripts/__tests__/runner-release-crate-cache.test.mjs scripts/__tests__/public-install-closure.test.mjs scripts/__tests__/merge-queue-checks-workflow.test.mjs scripts/__tests__/e2e-shard.test.mjs scripts/__tests__/ci-typecheck-lane.test.mjs scripts/__tests__/run-vitest-stable-shard.test.mjs scripts/__tests__/run-vitest-stable-pr-mode.test.mjs scripts/__tests__/runner-vitest-package-lanes.test.mjs scripts/typecheck-test-programs.test.mjs scripts/check-test-budget.test.mjs scripts/ci/test-selection-pr-timings.test.mjs scripts/ci/test-selection-timings.test.mjs` — **973/973 PASS** - `node scripts/check-test-budget.mjs --base origin/master` — **PASS** (`609` nightly suites validated, zero protected invariants demoted) - `node scripts/check-maps.mjs` — **PASS** - `pnpm exec vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/source-sdk-public-inputs.test.mjs tests/runner-e2e/unit-launcher.test.mjs` — **PASS** - `pnpm --filter @paperclipai/paperclip-runner exec vitest run scripts/vitest-sequencer.test.mjs` — **PASS** - `cd server && node ../node_modules/vitest/vitest.mjs run scripts/typecheck-layers.test.mjs scripts/typecheck-layers-incremental.test.mjs` — **56/56 PASS** (real TS 7.0.2 incremental soundness tests) - `node scripts/run-tsc.mjs -p tests/e2e/tsconfig.json --noEmit && node scripts/run-tsc.mjs -p tests/tsconfig.playwright.json --noEmit && pnpm run test:e2e:runner:typecheck` — **0 errors** - Live Playwright smoke passed across all 6 split E2E spec files on the cold non-durable Postgres boot path (`PAPERCLIP_TEST_POSTGRES_TEMPLATE=0`). - Live sharded `tests/runner-e2e` runs passed under `pool: "threads", maxWorkers: 4` (shard `1/4` 172/172 PASS; shard `2/4` all Vitest + 65/65 `node:test` PASS). ## Risks - **Cache invalidation on incremental typecheck / Runner dist:** Mitigated by exact-key hashing (including `packages/{shared,adapter-utils,plugins/sdk}/src/**` and `packages/paperclip-runner/spec/**`) with no `restore-keys:` on `runner-dist-v1`, SHA-256 self-validation inside `prepare-runner-vendor.mjs`, `layer-map.json` invalidation + stale `.d.ts` pruning in `typecheck-layers.mjs`, and read-only PR restores (only canonical `master` pushes save caches). - **Shard rebalancing & soak demotions:** All demoted suites remain in `nightly-only-suites.json` and run on `full-ci` / `master` / nightly; `check-test-budget.mjs` enforces zero protected invariants are demoted. - **Workflow security boundaries:** `ci-routing.yml`, `pr.yml`, `CODEOWNERS`, and all `runs-on:` expressions are unchanged; `pr-trusted.yml` performs zero `actions/cache/save` calls. ## Model Used - Google Gemini (Antigravity agent swarm) with extended reasoning, tool use, and local code/test execution across 6 parallel worker roles (`ci-pipeline`, `vitest-runner`, `server-prune`, `e2e-opt`, `typecheck-opt`, `verifier`). ## 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 |
||
|
|
3ca9b6d471 |
refactor(plugin-sdk): remove archivedState from the resume result (#22443)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Native Runner sessions can run in a remote environment task that a plugin provider owns > - A provider can relaunch a parked Runner as the next run, and it reports the result to Core > - The resume result could carry `archivedState`, so Core could check that the park was a settled cut > - #22442 makes the provider the authority on the park, and Core stops reading `archivedState` > - This pull request removes the field from the SDK result schema > - The benefit is a smaller provider contract with no unused fields ## Linked Issues or Issue Description Refs #22442 **What existing behavior does this improve?** The environment task resume result contract in the plugin SDK. **Subsystem affected** `packages/plugins/sdk` (environment tasks), and the tests in `server/src/services/native-runtime` that build resume results. **Current behavior** After #22442, a resumed relaunch result can carry an optional `archivedState`. Core accepts it and does not read it. **Proposed behavior** The resume result has no `archivedState` field. The strict schema refuses it. **Reason and benefit** The field has no reader. Removing it keeps the contract to the fields that Core uses. **Breaking changes** A provider that still sends `archivedState` on a resume result fails the schema check, and the relaunch fails. Deploy this with or after the provider change that stops sending the field. **Additional context** Stacked on #22442. ## What Changed - SDK: removed `archivedState` from the `resume` result schema, and simplified the relaunch check in `parseEnvironmentTaskResult`. - SDK test: a relaunch result with `archivedState` now fails; one without it passes. - `plugin-runner-task.test.ts`: removed the field from the fixtures, and removed the test that checked Core ignores it. - `plugin-runner-release-resume.integration.test.ts`: the fixture provider no longer returns the field. - `doc/plugins/PLUGIN_ENVIRONMENT_TASKS.md`: removed the note about the field. ## Verification - `pnpm run typecheck` in `server` (builds all dependent packages): pass. - `pnpm vitest run src/services/native-runtime/plugin-runner-task.test.ts` in `server`: 116 passed. - `pnpm vitest run tests/environment-task-release-resume.test.ts` in `packages/plugins/sdk`: 48 passed. - I did not run the embedded-Postgres integration suite locally. CI runs it. ## Risks - A provider that still sends the field makes the relaunch fail. Deploy this with or after the provider change that stops sending it. It can ship in the same deploy as #22442. - Low risk otherwise: the change removes an unused optional field. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), through Claude Code with tool use (shell, file edit, code search). Extended thinking on. ## 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 - [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: Paperclip <noreply@paperclip.ing> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0b2acfb956 |
refactor(runner): let the provider decide whether a released Runner relaunches (#22442)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Native Runner sessions can run in a remote environment task that a plugin provider owns > - After a turn, the provider can park the Runner, and the next run can relaunch it from the saved state > - Core kept its own local record of each released Runner, and the provider kept its park record too > - Core lost its copy when the local session directory was not durable. Then Core restored from a checkpoint although a park existed, and the turn was slower > - This pull request makes the provider the only authority on the park. Core resumes the source from its durable checkpoint, and the provider answers "resumed" or "unavailable" > - The benefit is fewer missed relaunches, and less code in Core ## Linked Issues or Issue Description **What existing behavior does this improve?** The relaunch of a parked Runner for the next run of a native session. **Subsystem affected** Native runtime: `server/src/services/native-runtime`, the Runner control plane in `packages/paperclip-runner`, and the environment task SDK. **Current behavior** Core writes a released-Runner record (source identity, task id and scope digest) to the local session directory when a release completes. Core relaunches a parked Runner only when that record exists. Core also checks the archived Runner state on the provider's relaunch reply. When the local directory is gone (for example, after the server process restarts on a new host), Core restores from a checkpoint into a fresh task, although the provider still has the park. **Proposed behavior** Core resumes the source identity from its durable controller checkpoint on the lease's current task. The provider decides from its own park record. When no park of that source exists, the provider answers `unavailable`, and Core starts a fresh task from the saved session, as it does today for other unavailable answers. **Reason and benefit** One record for one fact. Core no longer needs local state to relaunch, so more runs relaunch. The change removes about 160 lines. **Breaking changes** A provider must answer `unavailable` when it has no park for the requested source. A provider that answers with an error instead makes the resume fail. The `archivedState` field on a resumed relaunch result becomes optional. Providers can continue to send it; Core does not read it. **Additional context** Reattach to a live Runner process in the same server is not changed. A relaunch after a restart still requires the process configuration to match, because the relaunch reuses the parked launch. A changed configuration starts a fresh task. ## What Changed - Removed the local released-Runner record: its writer, its readers, the scope digest, and the resume and retire callbacks that cleared it. - Derived the relaunch source from the durable Runner identity. Kept the check that the task is the lease's current task. - After a restart, Core takes the released source from the durable identity for every provider that releases tasks: one that relaunches the parked Runner, and one that hands it over. - Added a test that a checkpoint saved with the old released-Runner record still loads. - When a restart recovery resumes a released source and the provider answers `unavailable` with the task stopped and its state saved, Core now starts a fresh task from the saved session, as it does for a relaunch. The fallback finishes the old task's startup context before it inspects the replacement task. An executor test covers this path. - Updated the SDK source pin in `tests/runner-e2e/source-sdk-public-inputs.json`. - Stopped the check of the archived state on the relaunch reply. Removed `isSettledReleasedRunnerCut` and the resume `settled` hook. - SDK: a resumed relaunch result no longer requires `archivedState`. - Updated `doc/plugins/PLUGIN_ENVIRONMENT_TASKS.md` and the tests. ## Verification - `pnpm run typecheck` in `server` (builds all dependent packages): pass. - `pnpm vitest run src/services/native-runtime/plugin-runner-task.test.ts src/services/native-runtime/remote-warm-session-recovery.test.ts` in `server`: 147 passed. - `pnpm vitest run src/services/native-runtime/native-session-executor.test.ts -t "releases settled|accepts only the attached|released|relaunch|warm|unavailable|recover"` in `server`: 594 passed. - `runnerd-codex-transport.test.ts` in `packages/paperclip-runner`: 337 passed. - SDK release and resume tests in `packages/plugins/sdk`: 48 passed. - `runnerd-codex-transport-release-resume.test.ts -t relaunched` in `packages/paperclip-runner`: 3 passed. `pnpm run typecheck` in `packages/paperclip-runner`: pass. - `tests/runner-e2e/source-sdk-public-inputs.test.mjs`: 13 passed. - `plugin-runner-release-resume.integration.test.ts -t "completes claude runs through a retained adopted process"`: pass. I did not run the rest of the two embedded-Postgres integration suites locally. CI runs them. ## Risks - A provider that does not answer `unavailable` for a missing park makes the resume fail. Deploy the provider change first, or in the same deploy before this Core version takes traffic. This PR and #22443 are one stack and can ship in one deploy. - A server restart now relies on the existing unavailable-reuse fallback to start a fresh task. Tests cover this path. - Medium risk overall: the change is in the warm-session path. The cold path is not changed. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), through Claude Code with tool use (shell, file edit, code search). Extended thinking on. ## 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: Paperclip <noreply@paperclip.ing> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8b616b949d |
fix(connections): drop MCP wording and the MCP guide link from Google Workspace setup (#22793)
<!-- Write all pull request text in Simplified Technical English (ASD-STE100): short sentences, one instruction per sentence, simple approved vocabulary, and the active voice. --> ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents use Google Workspace through the built-in Google Workspace connection > - Since #22634, Gmail, Drive, Docs, Sheets, Slides, and Calendar run on Paperclip's own REST tools, not on Google's hosted MCP servers > - The connect screen still showed "Secure MCP sign-in" and a "Review requirements" link to Google's MCP servers guide > - This text is wrong for this connection, it is internal jargon, and Google's OAuth reviewers read this screen > - This pull request removes the MCP wording and the MCP guide link from Google Workspace setup and from its audit details > - The benefit is that users and reviewers see only true, plain text for this connection ## Linked Issues or Issue Description Refs #22634 **What happened?** On a Cloud workspace, the Google Workspace connect page showed the subtitle "Secure MCP sign-in" while the sign-in opened and after it failed to open. The setup page also showed a "Review requirements" link to `developers.google.com/workspace/guides/configure-mcp-servers`. On a self-hosted instance, the "How to set up a Google OAuth client" link went to the same MCP servers guide. Audit details for a Google REST call showed "Transport: mcp_remote" and "MCP method: tools/call". **What did you expect to happen?** The connect page says "Secure sign-in". The Paperclip-managed method on Cloud has no requirements link, because the user has no requirements to review. On a self-hosted instance, the customer-owned client method links to Google's OAuth client guide. Audit details for a Google REST call do not show MCP terms. **Steps to reproduce** 1. Turn on the Google Workspace connector in **Settings → Experimental**. 2. Open **Apps** and choose **Google Workspace**. 3. Start the sign-in, then close or block the sign-in window. 4. Before this change: the header shows "Secure MCP sign-in", and the setup step shows "Review requirements" with a link to Google's MCP servers guide. ## What Changed - `ui/src/features/connections/ConnectionSetupFlow.tsx`: `OAuthConnectStateScreen` shows "Secure sign-in" for a curated app. A server that the user pasted as an MCP server keeps "Secure MCP sign-in". This is generic: there is no Google-specific code. - `packages/shared/src/app-definitions/google-workspace.json`: remove the top-level `docsUrl` (the MCP servers guide). The Paperclip-managed method now has no "Review requirements" link. The customer-owned method's `consoleLinks.docs` is now Google's OAuth client guide (`create-credentials#oauth-client-id`). The "Review requirements" link and the self-hosted "How to set up a Google OAuth client" link both use it. Its guidance text names the Gmail, Drive, Docs, Sheets, Slides, and Calendar APIs instead of "the Google Workspace MCP APIs". This file is a reviewed definition: `scripts/ingest-app-definitions.mjs` copies it as-is, so a regeneration keeps the fix. - `server/src/services/tool-gateway.ts`: an audit record for a Google Workspace REST call no longer has `mcpMethod`. - `ui/src/pages/tools/AuditTab.tsx`: audit details show the connection type label ("Remote HTTP") as "Type" instead of the raw `mcp_remote` value. This uses the same label as the connection's "Connection details". - `doc/connections/GOOGLE-WORKSPACE.md`: the self-hosted section links Google's OAuth client guide. - `tests/runner-e2e/source-sdk-public-inputs.json`: refreshed pinned inputs. ## Verification - Red first, then green: - `packages/shared/src/google-workspace-setup-links.test.ts`: no Google Workspace method links the MCP servers guide, the managed method has no requirements link, the customer method links the OAuth client guide, and method text has no "MCP". It failed 4/4 before the fix. - `ui/src/features/connections/OAuthConnectStateScreen.google.test.tsx`: in the preparing, opening, and "couldn't open the sign-in window" states, the Google Workspace screen shows "Secure sign-in", no "MCP", and no link to `configure-mcp-servers`. A pasted server keeps "Secure MCP sign-in". It failed 3/4 before the fix. - `server/src/__tests__/google-workspace-rest-transport.test.ts`: the Gmail REST audit record has no `mcpMethod`. It failed without the server change. - `npx vitest run` for shared app definition tests (67 passed), `ui/src/pages/tools` and `ui/src/pages/apps/app-detail` (121 passed), and the server REST transport file (53 passed). - `tsc --noEmit` for `server` and `ui`: no new errors. - `pnpm verify` exits 2 because a doc under `doc/connections` is a global CI input. Required CI supplies the broad coverage. ## Risks - Low risk. Text and link changes only, plus one optional audit field. - Other curated OAuth apps now show "Secure sign-in" instead of "Secure MCP sign-in" on the sign-in state screen. The new text is true for every curated app. - Audit details for all connectors show "Type: Remote HTTP" instead of "Transport: mcp_remote". - Saved Google Workspace connections still show `https://workspacemcp.googleapis.com/mcp/v1` as the address in "Connection details". It is the stored connection identity. This pull request does not change stored data. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Claude Code agent 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> |
||
|
|
d01d3c40ad |
fix(ui): defer the Connectors announcement until a return visit (#22790)
## Thinking Path > - People use Paperclip to manage AI agents at work. > - New users now meet their agent in chat after setup. > - The Connectors card previously checked for an open onboarding task. > - Chat-first onboarding creates no such task, so the card could appear three seconds into a first visit. > - This change holds that promotion until the person returns after 30 minutes of inactivity. ## Linked Issues or Issue Description Refs: #19514, #22077 **What happened?** On master at `11cfe0910d`, a new user could see the Connectors card in their first agent chat. **Expected behavior** The card stays hidden through the first visit and can appear when the user returns after a 30-minute gap in activity. **Steps to reproduce** With the Connectors announcement active, finish chat-first onboarding in a fresh browser profile and wait for the announcement delay. ## What Changed - Track the first visible board visit per account in browser storage. Local input and visits in other tabs extend the first session. After the first qualifying return, the browser remembers eligibility and stops tracking input. - Apply this rule to the published Connectors announcement ID. The existing checks for dismissal, open dialogs, and legacy onboarding tasks still apply. - Exercise the onboarding chat, reload, idle return, account isolation, and activity in another tab. ## Verification - Before the fix, the Vitest regression displayed `2026-09-14-connectors` on the first visit. - The announcement and workspace identity Vitest suites passed locally (28 tests). The UI typecheck passed. - Chromium passed all four tests in `announcement-first-session.spec.ts` and `announcement-placement.spec.ts` against a local test server. - A second red-green regression covers dismissal in another browser while the first tab sits idle. The return triggers a fresh check and keeps the card hidden until it succeeds. - At `8fab1932fa`, GitHub reported 73 successful checks and three skipped checks. [CI run](https://github.com/paperclipai/paperclip/actions/runs/45449353624) ## Risks A new browser profile or cleared site data starts the visit history again. Storage failures keep the Connectors card hidden. Existing users start accumulating visit history when they first use this version. ## Model Used OpenAI Codex, GPT-6.2 Astra (`gpt-6.2-astra`), with shell, Vitest, and Playwright. ## 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 --------- Co-authored-by: Scott Tong <scott@scotts-mbp-m5-max.local> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
4daeab5c76 |
Add count, newest-first and lean run reads to customer-success inspection (#22781)
<!-- Write all pull request text in Simplified Technical English
(ASD-STE100): short sentences, one instruction per sentence, simple
approved vocabulary, and the active voice. -->
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Paperclip Cloud can inspect a tenant stack read-only through the
customer-success inspection API
> - That API can only list rows in id order. It has no totals, and each
run row holds large JSON columns
> - A customer-success agent must page every run of a stack to find the
latest run or the failed-run total
> - That is too slow and too large for a refresh across many stacks
> - This pull request adds a `count` operation, a creation-time `order`
for lists, and a lean `summary` view for runs
> - The benefit is one small read per metric, with the same read-only,
company-scoped rules
## Linked Issues or Issue Description
**Subsystem affected**
Server: the customer-success inspection API (`/api/customer-success/v1`)
and its shared query contract.
**Problem or motivation**
Customer-success inspection reads cannot answer summary questions. To
get the latest run, the run count or the failed-run count, a reader must
page through every run. Each run row can be hundreds of KB, because it
holds the result, usage, context snapshot and runner profile.
**Proposed solution**
Add read-only summary reads to the inspection contract: a `count` that
groups by status, a newest-first or oldest-first `order` for `list`, and
a `summary` view of runs without the large JSON columns.
**Alternatives considered**
Paging all runs with a smaller page size. That still reads every large
row. A new aggregated endpoint outside the reader catalog. That would
skip the existing catalog, permit and transaction rules.
## What Changed
- `packages/shared/src/customer-success.ts`: add the `count` operation,
`order` (`newest`/`oldest`, `list` only), `view` (`summary`, `runs`
list/get only), `InspectionCount`, and `inspectionReadPath()`. The
parser rejects these fields where they do not apply.
- `server/src/services/customer-success-inspection.ts`: `count` returns
`{total, byStatus}` (grouped by the reader's `status` column, or
`byStatus: null`). `order` sorts by `createdAt`, then id. `view:
"summary"` selects the `RUN_SUMMARY_COLUMNS` allowlist and adds
`durationMs`. All reads stay in the same read-only, repeatable-read
transaction and keep the existing run redaction.
- `server/src/routes/customer-success.ts`: serve the same handler on
`/read` and the new `/read-v2`. `/read` refuses queries that use the new
features. A tenant without `/read-v2` answers 404, so Cloud fails closed
with `tenant_inspection_version_unsupported`.
- `server/src/__tests__/customer-success.test.ts`: tests for counts,
company scope, newest-first paging, the summary allowlist and duration,
parser bounds, and the path split.
- `server/src/__tests__/customer-success-cloud.test.ts`: the registry
double now has the batch reads (`getStacks`, `getAccounts`) that the
current Cloud broker uses. The test also runs a count and a newest-first
summary read end to end.
- `server/src/__tests__/openapi-routes.test.ts`: list `/read-v2` with
the other inspection protocol routes.
- `doc/CUSTOMER-SUCCESS-INSPECTION.md`: document the summary reads and
the path split.
## Verification
- `cd server && pnpm exec vitest run
src/__tests__/customer-success.test.ts
src/__tests__/openapi-routes.test.ts
src/__tests__/customer-success-run-liveness.test.ts`: 78 tests pass.
- Red check: the new count/order/summary test fails against the previous
service (`Unsupported inspection operation`).
- Coordinated qualification with a local build of the Cloud broker
branch: `PAPERCLIP_INSPECTION_CLOUD_DIST=… pnpm exec vitest run
src/__tests__/customer-success-cloud.test.ts` passes, including the
count and newest-first summary reads over `/read-v2`.
## Risks
- Low risk. The new features are read-only and use the existing catalog,
company boundary, permit check and read-only transaction.
- The summary view is an allowlist. A new run column stays out of the
summary until someone adds it.
- Mixed versions are safe in both orders. An older Cloud never sends the
new fields. A newer Cloud sends them only to `/read-v2`, and an older
tenant answers 404 there.
- No migration.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use
(shell, file edits) and extended thinking.
## 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
- [ ] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
0731cd3afc |
perf(ci): Phase 2 PR CI under 4 minutes (dynamic workers, fast E2E boot, typecheck overlap, test-budget gate) (#22729)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Pull-request CI checks run on every commit before maintainers can merge code > - PR #22679 cut PR CI from 15–30+ minutes down toward 4.5–5.5 minutes on 4-core runners > - Remaining wall-clock bottlenecks sit in unsharded `workspaces-b`, serial typecheck preparation, E2E server/UI startup, fixed Vitest worker caps, and remaining soak and duplicated UI tests > - This pull request adds Phase 2 optimizations across server soak triage, typecheck DAG overlap, E2E fast boot and shard balance, dynamic CPU-aware workers, pure-Node workspace link preflight, UI pruning, and permanent test-budget enforcement > - The benefit is ordinary feature PRs finish in ~3.1–3.8 minutes on 4-core runners and scale automatically to ~2.0–3.0 minutes on 8-core runners while keeping core invariants and nightly coverage intact ## Linked Issues or Issue Description Refs #22679 **Problem Statement** After #22679 landed, several PR lanes still took 4.5–6 minutes on 4-core runners (`general-workspaces-b` ran unsharded, `Typecheck + Release Registry` waited on a serial server build before starting UI and test-program checks, E2E shards paid full `cli onboard` + minified UI build overhead, and Vitest worker counts did not scale with runner CPU count). **Proposed Solution** Split `general-workspaces-b` across two duration-balanced shards, overlap typecheck preparation tasks behind a shared runner-vendor node, replace E2E `onboard` with a direct template-PG boot + unminified inline UI build, scale Vitest/Playwright/Typecheck workers dynamically by CPU and RAM, replace `tsx` in workspace-link preflight with pure Node, prune redundant mocked UI tests and additional real-clock server soak suites (still run on `master`, `release-verify`, `cloud-readiness`, and `PAPERCLIP_CI_FULL=1`), and add a permanent test-budget policy check. **Expected Benefit** Brings ordinary PR CI wall-clock down to ~3.1–3.8 minutes on 4-core runners (and ~2.0–3.0 minutes on 8-core runners) with automated guardrails against future test-time regressions. ## What Changed - **Server soak triage & permanent test-budget guardrail (`scripts/ci/nightly-only-suites.json`, `rules/test-budget.mdc`, `.greptile/files.json`, `scripts/check-test-budget.mjs`, `scripts/check-test-budget.test.mjs`, `.github/workflows/pr-trusted.yml`):** Expanded the PR-excluded soak/heavy-integration manifest to 568 genuine heavy suites (preserving 100% of company isolation, authz, checkout, approval, budget, activity-log, security, telemetry, and serialized suites on every PR) and wired `node scripts/check-test-budget.mjs` into the `policy` job. - **Typecheck DAG overlap & CPU/RAM scaling (`scripts/ci-typecheck-lane.mjs`, `scripts/typecheck-test-programs.mjs`, `scripts/__tests__/ci-typecheck-lane.test.mjs`, `scripts/typecheck-test-programs.test.mjs`):** Moved `build server without type checks` and `check server runtime assets` out of serial `prepare` into parallel DAG nodes behind `prepare runner vendor`, added `computeResourceProfile` scaling across 2/4/8-core runners, and added missing UI/Runner consumer routing inputs (`packages/paperclip-runner/` for `@paperclipai/ui`, `packages/adapter-utils/` for Runner test programs). - **E2E fast boot, dynamic workers & 8-shard rebalance (`tests/e2e/start-e2e-server.ts`, `tests/e2e/playwright.config.ts`, `scripts/e2e-shard.mjs`, `scripts/e2e-shard-durations.json`, `.github/workflows/pr-trusted.yml`, `.github/workflows/release-verify.yml`):** Added direct throwaway template-PG boot (`fsync=off`), unminified inline Vite fallback build, dynamic parallel workers (`min(4, floor(cpus/2))`), empirical `1.5x` parallel speedup weighting across 8 shards, targeted trims to slowest E2E specs, and hashed workspace `package.json` manifests into the `e2e-ui-dist-v2` cache key. - **Dynamic Vitest workers, 2-shard `workspaces-b`, and pure-Node preflight (`scripts/ci/vitest-workers.mjs`, `scripts/ci/workspaces-b-shard.mjs`, `scripts/ensure-workspace-package-links.mjs`, `scripts/ci-dependency-cache.mjs`, `packages/db/src/test-embedded-postgres.ts`, `.github/ci-task-matrix.json`, `.github/actions/setup-ci-dependencies/action.yml`, `package.json`):** Scaled Vitest workers dynamically (`4→7` general, `3→5` serialized) with `max_connections=300` before PostgreSQL start, split `general-workspaces-b` into 2 duration-weighted shards (backward-compatible unsharded for release workflows), replaced `tsx` workspace-link preflight with pure Node (~29× faster), and parallelized `ci-dependency-cache.mjs` child queries. - **UI Vitest worker scaling, fake timers & E2E-duplicated suite pruning (`ui/vitest.config.ts`, 4 `maps/` files, and UI test suites):** Scaled UI `maxWorkers` dynamically, converted real-clock sleeps in kept suites to fake timers, removed 34 E2E-duplicated mocked jsdom suites, and updated corresponding `maps/` prose references. ## Verification - `node --test .github/scripts/tests/ci-plan.test.mjs .github/scripts/tests/ci-dependency-cache.test.mjs .github/scripts/tests/pr-dependency-cache.test.mjs scripts/__tests__/run-vitest-stable-shard.test.mjs scripts/__tests__/run-vitest-stable-pr-mode.test.mjs scripts/__tests__/ci-typecheck-lane.test.mjs scripts/typecheck-test-programs.test.mjs scripts/__tests__/e2e-shard.test.mjs scripts/check-test-budget.test.mjs scripts/ci/test-selection-pr-timings.test.mjs`: **160/160 PASS** - `node scripts/check-test-budget.mjs`: **PASS** (`568` nightly suites validated) - `node scripts/check-maps.mjs`: **PASS** (`35 areas, 192 capability IDs`) - `pnpm --filter @paperclipai/ui typecheck` & `pnpm --filter @paperclipai/db typecheck`: **PASS** - Live CI verification runs on the new `pr-trusted.yml@master` (from #22679) with `profile-ci` enabled to export the full job/step/file waterfall to Honeycomb `paperclip-ci`. ## Risks - Medium CI scope: touches workflow matrix partitioning, E2E startup, and test runners; does not change production app runtime behavior. - All PR-demoted soak suites continue to execute on `master`, `release-verify`, `cloud-readiness`, local `pnpm test:run`, and `PAPERCLIP_CI_FULL=1`. - All new `policy` and `setup-ci-dependencies` commands keep file-existence guards so reruns of older PR branches continue to work. ## Model Used - Google Gemini (Antigravity swarm orchestrating specialized worker agents with shell, file editing, and test execution tools) and Anthropic Claude Opus (verification and optimization sub-agents). ## 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 |
||
|
|
18aa2b353d |
feat(antigravity): /plan selects Plan mode and keeps Antigravity read-only while planning (#22727)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Plan mode lets a person ask an agent for a plan, review it as the task's Plan document, and accept it before any work starts > - People who use Google Antigravity agents type `/plan <request>`, as they do in other agent tools. Paperclip sent that text to the agent, and #22701 correctly neutralised it, so nothing happened > - An Antigravity run in Plan mode was also not read-only: the agent could still edit files and run commands while it "planned" > - This pull request makes a leading `/plan` in the composer select Plan mode, and keeps an Antigravity Plan-mode run read-only at its permission prompt > - The benefit is that `/plan` with an Antigravity agent gives the normal Paperclip plan flow (Plan document, accept, then execution on the same task), and planning cannot change the workspace ## Linked Issues or Issue Description Refs #22701 **What happened?** A person wrote `/plan add greeting.txt` to a Google Antigravity agent. The agent did not plan. In Plan mode the Antigravity agent could still edit files and run commands. **What did you expect?** `/plan <request>` starts Plan mode. The agent researches and proposes a plan in the task's Plan document. It does not change files until the person accepts the plan. **Steps to reproduce** 1. Assign a task to a Google Antigravity agent. 2. Write `/plan Add a file greeting.txt containing hello`. 3. See that the task stays in Auto mode, and that the agent creates the file. ## What Changed - Task composer: a leading `/plan` in a comment or in a new task selects Plan mode and sends the rest of the message without the command. `/plan` alone only switches the mode. The slash menu offers "Plan". A `/plan` anywhere else in the message (quoted, pasted, fenced, mid-sentence) stays ordinary text and does not change the mode. This is the typed form of the existing Plan mode control, so it works the same for every agent. - Antigravity runner (`antigravity-plan-mode.ts`, wired in `acpx-runtime-adapter.ts` and `runtime-host.ts`): when Paperclip runs an Antigravity task in Plan mode (the existing read-only task policy), the permission prompt fails closed. It allows only (a) the 1.5.2 server's built-in research tools (file read, search, directory listing, page read), named by the exact `Run <tool>?` prompt title, when the reported kind also matches that tool, and (b) the tools the runner's own Paperclip bridge registered for this run, on the runner-owned server named `paperclip`. The provider's reported kind alone never grants a read, and no other MCP server is trusted, runner-owned or not. It refuses file edits, terminal commands and everything else. Paperclip's server applies its Plan-mode rules to its own tools, and the agent writes the Plan document through them. - Composer command parsing moved to `ui/src/components/task-chat/composer-commands.ts`. `/goal` and `/plan` both use the shared rule. Both submit paths use one `/plan` decision: a bare `/plan` sends (in Plan mode) only when an attachment can be sent without text; otherwise it only selects Plan mode. A composer without Plan mode (the dashboard chat starter) keeps `/plan` as text. - Follow-up, not in this PR: the Kimi read-only gate (`kimiReadOnlyPermissionAllowed`) trusts every runner-owned MCP server by title prefix. It should get the same binding to the Paperclip bridge's registered tools. - No change to the #22701 guard. Every `/plan`, `/logout` and `/usage` that would reach the Antigravity server is still neutralised. - No change to the Antigravity admission patch, profile or closure digests. No shared contract change. ### Why not the native `/plan` of Antigravity 1.5.2 I checked the pinned 1.5.2 server and SDK sources and ran it live: - The server has no plan session mode (only `default`, `auto_edit`, `yolo`) and no plan config option. Its only route is the `/plan` text command, which it turns into an SDK slash-command object. - Live on 1.5.2 (Google sign-in, `gemini-3.8-flash-low`), a task with `Please /plan this ...` reached the model as `Please/BuiltinSlashCommandName.PLAN this ...`. The SDK sent the enum's string form instead of `plan`, so the harness did not enter planning mode. Over 61 native steps (about 5 minutes) the agent wrote no plan artifact, ran terminal commands, and searched the file system for that unknown name. I stopped the run. - A working native path needs a change inside the runtime (for example in the owned admission patch), which re-pins the closures for every platform and needs re-qualification. This PR does not do that. Paperclip's own Plan mode gives the user-visible result now, with no re-pin. ### Source of trust for slash commands (reused by `/swarm`) - `parseLeadingUserCommand(text, allowlist)` in `packages/shared/src/leading-user-command.ts` is the one rule. It returns `{ command, argument }` or `null`. - Trusted text: only what the signed-in user typed and submitted in the task composer. That is a comment body or the body of a new task. Conversations (chat) do not use it for `/plan`. - Never trusted: agent comments, chat or connector messages, API-posted text, issue text written by someone else, quoted or pasted parts, and every prompt Paperclip builds for an agent. These stay text, and the #22701 guard still neutralises any native command in them. - Inside trusted text, only a command at the very start counts: optional whitespace, `/name`, then whitespace or the end. The name is exact and lower-case and must be in the allowlist. Only `plan` is enabled. Whitespace follows the Antigravity server's Python rules (U+001C-U+001F count; U+FEFF does not). - A recognised command becomes a structured action (here: Plan mode). It never reaches an agent as command text. - Tests cover: leading whitespace and newlines, a command not at the start, quoted, fenced, forwarded and wrapped content, a neutralised command, case, `/planning`, `/plans`, paths and URLs, Python vs JavaScript whitespace, and the allowlist. ## Verification - `pnpm --filter @paperclipai/paperclip-runner exec vitest run src/drivers/acpx/antigravity-plan-mode.test.ts src/drivers/acpx/acpx-runtime-adapter.test.ts src/drivers/acpx/antigravity-native-commands.test.ts src/drivers/acpx/antigravity-admission.test.ts`: 250 passed. - `pnpm --filter @paperclipai/shared exec vitest run src/leading-user-command.test.ts`: 8 passed (red first: module missing). - `pnpm --filter @paperclipai/ui exec vitest run src/components/task-chat/TaskChatComposer.test.tsx src/components/MarkdownEditor.autocomplete.test.tsx`: all passed (TaskChatComposer 155). - Red before the fix: the adapter test showed an Antigravity Plan-mode run approved a file write and a terminal command (`allow_once`), and the four composer `/plan` tests failed. The negative test (a `/plan` inside the message stays text) passed before and after. - Runner and UI typecheck pass (`tsc --noEmit`; the UI's only errors are the existing ungenerated Storybook catalog files). - `pnpm verify` returned exit 2 (runner files outside the local test graph), so required CI supplies the broad coverage. - Live, on THIS branch: a local instance running this branch, Google sign-in, `gemini-3.8-flash-low`, driven in the browser through the task composer: 1. `/plan Create a file named plan-proof.txt containing the single line OK` in a new task: the task was created in Plan mode with the command removed. Plan run 3 min 34 s, terminal state **succeeded** (the agent handed in through `paperclip_finish`; run result accepted, waiting for plan approval). The Plan document and a Confirm / Request changes card appeared. One `ls -la` was refused by the read-only gate. No file was written. 2. Request changes ("Name the file plan-proof-2.txt instead."): revision run 28 s, succeeded. Plan document revision 2 named the new file; a new Confirm / Request changes card appeared. Still no file. 3. Confirm: execution run 55 s, succeeded; task Done; `plan-proof-2.txt` contains exactly `OK` plus a newline. 4. Normal task whose text contains a pasted `"we usually /plan things like this first"`: created in standard mode, text unchanged; run 68 s, succeeded, Done; `negative-proof.txt` = `NEG`; no refused tool call. 5. Dashboard "Start a chat" box: NOT run live. The box renders only with an experimental instance setting that is off on this instance, and I did not change instance settings. A unit test covers it (a composer without Plan mode keeps `/plan` as text). 6. Stop during a Plan-mode run: the run was cancelled about 1 s after Stop and did not revive (no new run for over 3 min); no file. Killing only the native Antigravity server process mid Plan-mode run: the run failed with a provider error, showed "Continuing automatically", and a continuation run started 36 s later and settled (succeeded, 3 min 17 s, response wake). No duplicate comments; the Plan document has one revision; no file written; the gate refused one shell command in each run. - Found live, NOT fixed here: in the recovered run of step 6 the model settled with "waiting for plan review" but did not open the Confirm card (in steps 1 and 2 it did). Paperclip creates that card automatically only from a harness's own plan proposal (Codex, Claude). For Antigravity it depends on the agent. Recommended follow-up: when a Plan-mode run settles with a new plan revision and no pending plan confirmation, the server opens the card itself. - To be clear: this is not Antigravity's native plan mode. Native plan mode on runtime 1.5.2 does not work (see above). This PR gives Paperclip's Plan mode, started by a trusted `/plan`, with the Antigravity run held read-only. ## Risks - Low to medium. Plan mode for Antigravity now refuses terminal commands, so the agent researches with its file read and search tools. A planner that relied on shell reads must use those tools instead. - Google Workspace accounts whose admin policy lets terminal commands run in a sandbox without a prompt skip the permission prompt for commands. That path cannot be blocked here. Personal Google accounts and API keys always prompt. - `/plan` as the first word of a message now selects Plan mode for every agent. To send the literal text, write `\/plan` or put other text first. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use (shell, file edit, browser automation not used), in Claude Code. ## 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> |
||
|
|
9a04538391 |
perf(ci): cut PR CI under 5 minutes (shared PG, E2E parallelism, routing, test pruning) (#22679)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Pull request CI verifies every change before merge across typecheck, build, server/DB/UI unit tests, and Playwright E2E shards. > - Today PR CI takes 15–30+ minutes wall-clock on ordinary feature and fix PRs (such as #22626) because every PR runs release/packaging/runner-support bloat, boots 800+ separate embedded Postgres clusters, runs Vitest serialized shards and E2E shards at 1 worker, builds the UI 8 separate times for E2E, emits 52 MB of React `act(...)` stderr spam in UI tests, and runs 61 real-clock soak suites plus hundreds of historical one-time SQL migration and mocked component wiring tests. > - Slow PR CI delays developer feedback, wastes runner capacity, and encourages batching changes instead of shipping small, safe PRs. > - This pull request cuts PR CI across all 6 bottlenecks (pipeline routing/Build bloat, PR-scoped parallel typecheck, shared embedded Postgres + batched/parallel Vitest runner, parallel E2E shards + prebuilt UI cache, historical/soak DB+server pruning with a checked-in nightly manifest, and UI stderr cleanup + low-value test pruning) while preserving all core control-plane invariants and full post-merge/release coverage. > - The benefit is projected PR CI wall-clock drops from 15–30+ minutes to ~3.8–4.4 minutes on ordinary PRs while keeping `master`, `release-verify`, `cloud-readiness`, local `pnpm test:run`, and `full-ci` runs at full coverage. ## Linked Issues or Issue Description Refs #22626. **What existing behavior does this improve?** Trusted pull-request CI wall-clock duration and runner efficiency across `.github/workflows/pr-trusted.yml`, `turbo.json`, `scripts/ci-typecheck-lane.mjs`, `scripts/run-vitest-stable.mjs`, `tests/e2e/`, `packages/db`, `server`, and `ui` test suites. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** Ordinary PRs take 15–30+ minutes wall-clock in PR CI: - `Build` (~7.5–8.0m) runs a 231s clean public npm Grok install verifier and a 57s embedded-Postgres boot smoke on every PR. - `Canary Dry Run` (6.2m), `Runner support suite` (7.9m), `Docker context integrity`, `General tests (chat 1–3/3)`, and `Verify Paperclip Runner (vitest package 1–3/3)` fan out on ordinary app PRs due to broad `turbo.json` inputs. - `Typecheck + Release Registry` (7.1m) runs `test:release-registry` (193s), all standalone sandbox provider installs/checks, all untouched `tests/*` projects, and `--singleThreaded` `tsc` on every PR. - `General tests` and `Verify serialized server suites` boot 800+ separate embedded Postgres clusters instead of using `packages/db/src/test-postgres-command.ts`, run 17 serial Vitest invocations in `workspaces-b`, and run `verify_serialized_server` with `--no-file-parallelism --maxWorkers=1`. - `e2e_shards` (8.6m slowest shard) rebuilds the UI 8 separate times and forces `workers: 1` across all 56 specs because 7 specs mutate instance-level flags. - `workspaces-a` (8.3m × 2 shards) emits ~52 MB of React `act(...)` / `IS_REACT_ACT_ENVIRONMENT` stderr spam and executes 992 UI test files (including hundreds of brittle mocked wiring / `renderToStaticMarkup` suites). - `packages/db` and `server` run 43 historical one-time SQL migration replay tests, 12 static prose-grep tests, and 61 real-clock soak/crash/lease-expiry suites (~108.5 CPU-min) on every PR. **Proposed behavior** Ordinary PRs complete in under 5 minutes wall-clock while preserving full control-plane invariant coverage and full `master`/`release-verify`/`cloud-readiness`/`full-ci` verification: - PR `Build` removes the 231s Grok clean-npm verifier (already covered in `release-smoke.yml` and `docker-runner-check.yml`) and gates the 53s boot smoke on `PAPERCLIP_CI_FULL=1` (keeping fast `build:runtime` on every PR). - `turbo.json` and `.github/ci-task-matrix.json` path-gate `Canary Dry Run`, `Runner support suite`, `Docker context integrity`, `general-chat`, `ci:runner-package`, `ci:workspaces-a`, and `ci:db`, and narrow `tests/**` out of `globalDependencies`. - `Typecheck + Release Registry` uses fail-closed PR-mode scoping (`CI_PLAN`, `PAPERCLIP_CI_BASE_SHA`, `PAPERCLIP_CI_FULL`), parallel `typecheck-test-programs.mjs`, and `--checkers` / `GOMAXPROCS=2` within the 15.7 GiB RAM budget. - `run-vitest-stable.mjs` automatically wraps Postgres-backed lanes with one shared embedded Postgres template server (`test-postgres-command.ts`), batches `workspaces-b` and `workspaces-a` into single multi-project Vitest invocations, parallelizes isolated `serialized` shards, and filters `scripts/ci/nightly-only-suites.json` in PR mode (respecting `PAPERCLIP_CI_FULL=1`). - `e2e_shards` restores a read-only exact-key `server/ui-dist` cache written on canonical `master` pushes (`PAPERCLIP_E2E_SKIP_UI_BUILD=1`, inline fallback on UI PRs), isolates the 7 flag-mutating specs onto 2 serial shards while running the other 6 shards at `workers: 3` + `fullyParallel: true`, prunes 5 legacy/screenshot specs, and replaces fixed 20s/30s sleeps with deterministic waits. - `ui/vitest.setup.ts` eliminates >99.9% of stderr spam (`IS_REACT_ACT_ENVIRONMENT = true`, clean localStorage/DOM stubs, targeted `act(...)`/`No queryFn` suppression) and prunes 445 low-value mocked/presentational/screenshot UI tests + slims 2 giant mocked suites (keeping all `ui/src/lib`, `api`, `hooks`, `context`, `adapters`, `features`, `plugins`, and privacy/authz tests). - `packages/db` and `server` prune 43 historical one-time SQL migration tests, 12 static prose-grep tests, and 28 redundant `it.each` cases in `chat-channels.integration.test.ts`, and classify 61 real-clock soak/restart/lease-expiry/workspace-recovery suites (6,510.2s / 108.5 CPU-min) into `scripts/ci/nightly-only-suites.json`. **Reason and benefit** Cuts ordinary PR CI wall-clock from 15–30+ minutes to a projected ~3.8–4.4 minutes and removes ~156,353 LOC of redundant/brittle test code without dropping any core Paperclip invariant (company isolation, authz, atomic checkout, single-assignee, approval gates, budget hard-stop, activity logging). **Breaking changes** None for product runtime behavior. In PR CI, 61 real-clock soak suites listed in `scripts/ci/nightly-only-suites.json` run on `master`, `release-verify`, `cloud-readiness`, local `pnpm test:run`, and PRs with the `full-ci` label (`PAPERCLIP_CI_FULL=1`) instead of every ordinary PR. ## What Changed - **Pipeline & routing (`ci-fast/pipeline`):** - `.github/workflows/pr-trusted.yml`, `.github/workflows/release-verify.yml`, `.github/ci-task-matrix.json`, `turbo.json`: removed Grok clean-npm verifier from PR `Build`, gated `server-boot-smoke.sh` on `PAPERCLIP_CI_FULL=1`, path-gated `canary_dry_run`, `verify_runner_e2e_support`, `docker_context_integrity`, `general-chat`, `ci:runner-package`, `ci:workspaces-a`, and `ci:db`, forwarded `CI_PLAN` / `PAPERCLIP_CI_BASE_SHA` / `PAPERCLIP_CI_FULL` (keeping `profile-ci` in PR mode), and added exact-key read-only `server/ui-dist` cache restore in `e2e_shards` with a master-only writer in `release-verify.yml`. - Updated `.github/scripts/tests/ci-plan.test.mjs`, `scripts/__tests__/public-install-closure.test.mjs`, and `scripts/__tests__/runner-release-crate-cache.test.mjs`. - **Typecheck lane (`ci-fast/typecheck`):** - `scripts/ci-typecheck-lane.mjs`, `scripts/typecheck-test-programs.mjs`, `scripts/typecheck-test-projects.mjs`, `server/scripts/typecheck-layers.mjs`: added fail-closed PR-mode diff scoping (skipping `test:release-registry`, standalone sandbox providers, demo plugins, and untouched test projects/workspaces on unrelated PRs), concurrent `typecheckTestProgramsAsync`, and `--checkers` / `GOMAXPROCS=2` parallelism within 15.7 GiB RAM. - Updated `scripts/__tests__/ci-typecheck-lane.test.mjs`, `scripts/typecheck-test-programs.test.mjs`, and `server/scripts/typecheck-layers.test.mjs`. - **Vitest runner (`ci-fast/vitest-runner`):** - `scripts/run-vitest-stable.mjs`, `packages/db/src/test-postgres-command.ts`, `scripts/__tests__/run-vitest-stable-shard.test.mjs`: wired automatic shared embedded Postgres template DB (`test-postgres-command.ts` with `fsync=off`), batched `workspaces-b` and `workspaces-a` into single multi-project Vitest runs, parallelized isolated `serialized` shards (`maxWorkers=3`), and added PR-mode filtering for `scripts/ci/nightly-only-suites.json` (honoring `PAPERCLIP_CI_FULL=1`). - **Playwright E2E (`ci-fast/e2e`):** - `tests/e2e/playwright.config.ts`, `scripts/e2e-shard.mjs`, `scripts/e2e-shard-durations.json`, `scripts/__tests__/e2e-shard.test.mjs`, `maps/feature-map/recovery.md`: added `PAPERCLIP_E2E_SKIP_UI_BUILD=1`, isolated the 7 instance-mutating `SERIAL_SPECS` onto dedicated serial shards while running the remaining 44 specs across 6 shards at `workers: 3` + `fullyParallel: true`, pruned 5 legacy/screenshot specs (`-743 LOC`), and replaced fixed 20s/30s sleeps in `disconnect-resilience.spec.ts` and `composer-stop.spec.ts`. - **Server & DB test pruning + nightly soak manifest (`ci-fast/server-prune`):** - Deleted 41 historical one-time SQL migration tests + 5 obsolete fixture SQLs in `packages/db/src`, 2 historical server SQL migration tests, and 12 brittle static prose-guidance tests; trimmed `packages/db/src/client.test.ts` (2,328 → 219 LOC), `packages/db/src/better-auth-account-issuer-migration.test.ts` (167 → 19 LOC), and 2 redundant `it.each` matrices in `server/src/__tests__/chat-channels.integration.test.ts`. - Added `scripts/ci/nightly-only-suites.json` classifying 61 real-clock soak/restart/lease-expiry/workspace-recovery suites (6,510.2s / 108.5 CPU-min). - **UI test log spam fix & pruning (`ci-fast/ui-prune`):** - `ui/vitest.setup.ts`, `ui/vitest.config.ts`: eliminated >99.9% stderr spam (22–52 MB → 3.6 KB) by enabling `IS_REACT_ACT_ENVIRONMENT = true`, adding clean DOM/localStorage stubs, and filtering React `act(...)` / TanStack Query `No queryFn` noise. - Pruned 445 low-value mocked/presentational/screenshot UI test files, slimmed `AgentConfigForm.render.test.tsx` and `Browse.test.tsx` to their privacy/access checks, updated 34 `maps/` files to remove dead test links, and removed the stale `ui/src/pages/NewAgent.test-support.tsx` allowlist entry in `scripts/check-query-error-rendering.mjs`. ## Verification - Combined CI contract & shard test suite (`node --test .github/scripts/tests/ci-plan.test.mjs scripts/__tests__/run-vitest-stable-shard.test.mjs scripts/__tests__/ci-typecheck-lane.test.mjs scripts/typecheck-test-programs.test.mjs scripts/__tests__/e2e-shard.test.mjs scripts/__tests__/public-install-closure.test.mjs scripts/__tests__/runner-release-crate-cache.test.mjs scripts/__tests__/merge-queue-checks-workflow.test.mjs`): **136/136 PASS** (23.13s). - Full `.github/scripts/tests/*.test.mjs` suite on `ci-fast/pipeline`: **850/850 PASS** + Turbo cached-lane check **1/1 PASS**. - `node scripts/check-query-error-rendering.mjs --enforce --summary` and `node --test scripts/check-query-error-rendering.test.mjs`: **0 findings, 7/7 PASS**. - `node scripts/check-maps.mjs`: **PASS** (`35 areas, 192 capability IDs`). - `pnpm --filter @paperclipai/db typecheck`: **PASS** (`check:migrations` + `tsc --noEmit`). - `pnpm --filter @paperclipai/ui typecheck`: **PASS** (`369 files, 3454 stories` + `run-tsc.mjs -b`). - Component-level benchmarks verified on individual branches prior to merge (`ci-typecheck-lane.mjs` 63.4s simulated PR run; real Playwright 3-worker parallel specs passing; UI suite full run reduced to 3.6 KB stderr). - Live GitHub PR CI run triggered on this draft PR to verify real runner execution and measure before/after timings. ## Risks - **Two-phase CI effect:** Because `.github/workflows/pr.yml` invokes `pr-trusted.yml@master`, the workflow-level changes (removing Grok clean-npm install from PR `Build`, path-gating `Canary Dry Run`/`Runner support suite`/`general-chat`/`ci:runner-package`, passing `CI_PLAN`/`PAPERCLIP_CI_BASE_SHA`/`PAPERCLIP_CI_FULL`, and restoring `e2e-ui-dist`) take full effect only after merging to `master` (and `e2e-ui-dist` warms on the first `master` push; until then `e2e_shards` cleanly falls back to inline UI build). Furthermore, this PR modifies global CI inputs (`turbo.json`, `scripts/**`, `.github/**`), so its own PR CI runs the full matrix. - **Nightly soak demotion:** The 61 real-clock soak suites in `scripts/ci/nightly-only-suites.json` still run on every `master` push (`release-verify.yml`), `cloud-readiness.yml`, local `pnpm test:run`, and `full-ci`-labeled PRs, so regressions are caught post-merge rather than blocking ordinary PRs. - **Duration manifest rebalance:** Post-merge, the weekly `ci-test-durations.yml` refresh will recalibrate shard weights to reflect shared-Postgres timings for optimal LPT balance. - **No product runtime or DB schema changes:** All changes are confined to CI workflows, build/test orchestration scripts, test setup, test suites, and feature-map references. ## Model Used - Google Gemini 4 Neon (`Gemini 4 Neon (High)`), Google DeepMind, with repository tools, code execution, and multi-agent swarm coordination. ## 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 |
||
|
|
d1207c31d4 |
Left-align wrapped Inbox filters with search (#22720)
## Thinking Path
> - Paperclip helps people manage agents and tasks.
> - The Inbox toolbar lets people search and filter decisions.
> - Its dropdowns wrap when the sidebar leaves too little room.
> - An automatic margin pushes the wrapped row away from Search.
> - This change distributes space between controls on the same row and
aligns wrapped controls with Search.
## Linked Issues or Issue Description
Refs #22675.
**What happened?**
At intermediate widths, Inbox filters wrapped onto a second row and left
a large blank space at its start.
**Expected behavior**
The first wrapped button lines up with Search.
**Steps to reproduce**
Open Inbox and narrow the content area until the filters wrap below
Search.
## What Changed
Use flexbox space distribution on the Inbox toolbar and clear the filter
group's automatic start margin.
## Verification
All 38 CoordinatorNeedsYou tests passed at
|
||
|
|
b908678ea3 |
fix(connections): leave no connection behind when a first sign-in is cancelled (#22714)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Agents use apps through connections. Most app connections use an OAuth sign-in. > - Paperclip saves a draft connection before it opens the provider sign-in page. > - When the user cancels or abandons that sign-in, the draft stays. The Apps list counts it as a connection that "needs attention". > - The user did not ask for that connection, and the user must not clean it up by hand. > - This pull request hides drafts that never finished their first sign-in and removes the draft when the user clicks Cancel. > - The benefit is that a cancelled sign-in leaves no visible connection, and a retry makes exactly one connection. ## Linked Issues or Issue Description Refs #22634 **What happened?** A workspace has one working "Google Workspace for the organization" connection. The user clicks "Add account", chooses services, and clicks Continue. The page shows "Opening Google Workspace…". The user clicks Cancel before finishing at Google. The Apps page then shows "2 connections · 1 needs attention". **What did you expect to happen?** A cancelled sign-in leaves no visible connection. The same applies when the user closes the page, reloads it, closes the Google tab, or refuses consent at Google. A retry after a cancel makes exactly one connection. A cancelled reconnect of a working connection does not change that connection. **Steps to reproduce** 1. Connect one Google Workspace account. 2. Open Apps, then Google Workspace, then "Add account". 3. Click "Continue to sign in", choose services, and click Continue. 4. On the "Opening Google Workspace" page, click Cancel. 5. Look at the Google Workspace card on the Apps page. ## What Changed - Root cause: `connectApp` saves an OAuth draft (`status: "draft"`) before sign-in (`server/src/services/tool-access.ts`, the connection insert in the connect path). Cancel only navigated away. The Apps list counted every draft as "needs attention" (`ui/src/pages/apps/Browse.tsx`, `connectionState` and the attention count). - New module `server/src/services/tool-access/connections/first-sign-in.ts`. It decides if an OAuth draft never held a credential. It checks for OAuth tokens on the connection and its grants, legacy inline tokens (the removal module's list), a provider consent time, an external credential, and the markers a real connection keeps when it needs a new sign-in. If any check is not clear, the connection counts as real. - The connection list endpoint sets `firstSignInPending: true` on those drafts. The shared `ToolConnection` type has the new field. - New route `POST /tool-connections/:connectionId/sign-in/cancel`. It checks company access and configure permission. It removes the draft with the normal removal teardown (grants, OAuth states, bindings) only if the draft never held a credential. For any other connection it changes nothing and returns `abandoned: false`. A removal writes the activity entry `tool_connection.sign_in_cancelled`. The route is in the OpenAPI registry. - The Apps list does not show connections with `firstSignInPending`, and it does not show an app whose only connections are such drafts. The check is one pass with `Set` lookups. - Cancel works in one transaction: it deletes the pending sign-in states, locks the connection, checks it again, and parks it as `disabled` with the marker `oauth_sign_in_cancelled`. If the connection must stay, the transaction rolls back. Then the normal removal archives the parked draft. Setup never reuses a parked draft, so a retry during the removal gets its own row. - One predicate, `connectionRemovedOrSignInCancelled`, guards authorization start, access finish and machine sign-in. The direct, Cloud and Vercel Connect callbacks and the access finish step lock the connection before they write a grant or activate it, and return 409 `oauth_sign_in_cancelled` for a parked draft. - `docs/api/tool-connections.md` documents the cancel route and the list flag. - The setup page calls the cancel route when the user clicks Cancel on the sign-in screen. It does this only for a draft that this page made. It does not do this for a resume, a reconnect, or a task-linked setup. - Design for abandoned drafts (tab closed, reload, consent refused): they are not listed, and the next attempt reuses them through the existing draft reuse in setup. No background cleanup job is added. ## Verification - `server/src/__tests__/tool-access-cancelled-first-sign-in.integration.test.ts` runs the real routes against embedded Postgres and a local OAuth provider. It covers: a draft is marked and hidden; a provider token exchange held open across Cancel ends in 409; Cancel and a retry at the same time leave exactly one active connection; a parked draft is hidden and refuses a new sign-in start; a legacy draft with an inline token is not cancelled; Cancel removes it, deletes its OAuth state, logs activity, and a late callback fails; a retry after Cancel gives exactly one live connection (organization and personal); Cancel does not change an active connection or a connection that needs a new sign-in; a draft refused at the provider stays hidden and Cancel removes it; another company cannot cancel the draft. - `ui/src/pages/apps/Browse.test.tsx`: a pending draft is not listed and does not add "needs attention". - `ui/src/pages/apps/AppsConnect.test.tsx`: Google Workspace setup, Continue, then Cancel calls the cancel route for the new draft. - Red/green: the new Browse and setup tests fail without the UI change. The server test fails on master because the route and flag do not exist. - Local runs: the new server file, `openapi-routes.test.ts`, `tool-access-oauth-protocol.integration.test.ts`, `Browse.test.tsx`, `AppsConnect.test.tsx`, `activity-format.test.ts`, and `src/features/connections` pass. Server typecheck passes. `pnpm verify` exits 2 because of the pinned inputs file, so CI supplies broad coverage. - Not done: a real browser test against Google. ## Risks - Low risk. The cancel route fails toward no change: it removes nothing that shows any sign of a credential. - Cancel and a late provider callback agree under the connection row lock. If the callback commits first, Cancel changes nothing. If Cancel commits first, the callback returns 409 and saves nothing. This covers the direct, Cloud and Vercel Connect callbacks and the access finish step. - If the removal after Cancel fails, the draft stays parked and hidden, and a second Cancel finishes it. - A connection that was removed before and is now added again keeps its old consent record. If that new sign-in is cancelled, it stays as a visible draft, as it does today. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used in Claude Code with tool use (shell, file edits, test runs). ## 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> |
||
|
|
fe2db1c32b |
feat(ui): show the Cloud Slack invitation in the workspace sidebar (#22702)
## Thinking Path > - Teams use Paperclip to manage agents and their work. > - Hosted teams can have a private Slack channel with the Paperclip team. > - A workspace member needs to know whether they can open the channel or still need the owner's invitation. > - Cloud supplies that information for the selected organization. > - This change puts a Slack button in the sidebar footer. It opens a dialog with the next action. ## Linked Issues or Issue Description **Subsystem affected** Workspace sidebar and the Cloud onboarding browser journey. **Problem or motivation** After setup, a user can lose track of the invitation to their organization's private feedback channel. **Proposed solution** Show the invitation status in a dialog. Offer a channel link when Cloud confirms the connection. **Roadmap alignment** This extends the existing hosted workspace navigation. The roadmap has no separate item for this shortcut. ## What Changed - Both sidebar variants use the existing portfolio request to show the Slack shortcut when Cloud supplies invitation details. - The icon uses grayscale at rest and brand colors on hover or keyboard focus. The button has an accessible name and a tooltip. - The Cloud onboarding journey selects Codex and confirms feedback intent when the first-account welcome appears. - Storybook covers pending and connected channels. ## Verification - The sidebar suite passed 36 tests. The Cloud onboarding journey suite passed 10 tests covering both the current and previous gateway layouts. - The Storybook catalog regenerated successfully. - In a local browser run, a fresh user completed signup, connected a test model, hired an agent, opened its chat, and opened and dismissed the Slack invitation. The test used a local Slack fixture. - The incremental verifier selected broad CI coverage for the runner journey change. All applicable checks passed on `ea9779abda`. A GitHub runner shut down during a server test shard. The shard and final verification gate passed on retry. [CI run](https://github.com/paperclipai/paperclip/actions/runs/45276376121/attempts/2) · [Greptile review (5/5)](https://github.com/paperclipai/paperclip/pull/22702#issuecomment-7115303606) ## Risks An older Cloud service can omit the optional feedback field. In that case, the sidebar keeps the existing layout. Cloud controls the channel destination and the invitation state. ## Model Used OpenAI GPT-6 in Codex, with repository tools and browser verification. ## 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 --------- Co-authored-by: Scott Tong <1504818+scotttong@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
298026eadc |
fix(ai-connections): reconnect typed auth failures and stop quota retry countdowns (#22692)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Runs preserve typed provider failures so recovery can select the right next action. > - Authentication repair still recognized only older run error codes. Native typed authentication failures could miss the reconnect request. > - A typed exhausted quota with no reset also produced an estimated one-hour admission hold. Waiting cannot repair that account. > - This pull request uses the existing reconnect and validated adoption flow for authentication. It asks for billing and usage repair for typed quota exhaustion without a reset. > - Rate limits and provider-reported resets keep their existing automatic waits. Account authority, saved-work checks, pauses, and approvals keep their existing gates. ## Linked Issues or Issue Description Refs #15110. That open PR classifies the legacy Claude monthly-spend message. This change does not duplicate its adapter parsing or change older untyped quota recovery. Refs #21351. That open PR changes legacy Claude edge-error classification and repeated-failure latching. This change consumes the typed provider category and retains the existing credential-generation checks. **What happened?** A failed run with `providerFailure.category: authentication` and a generic native error code did not create its reconnect request. A typed `quota_exhausted` failure without a reset produced an estimated provider cooldown, although the account needed attention. Recovery's narrow PostgreSQL result projection also omitted typed native provider failures. **Expected behavior** Ask the responsible person to repair the selected account or explicitly adopt a compatible managed connection. Ask for billing and usage repair when an exhausted allowance has no reported reset. Continue to wait automatically for transient rate limits and reported allowance resets. **Steps to reproduce** Use a failed native run with a typed OpenAI authentication error and a generic native error code. The existing reconnect controller should create one card. Use typed `quota_exhausted` evidence with no reset. The task should offer account review and manual Retry, with no invented reset or automatic provider retry. ## What Changed - Recognize typed authentication failures and the reported `provider_invalid_credentials` run code. Reuse the existing controller-only reconnect request, account freshness checks, durable continuation, and explicit legacy adoption. - Retain typed provider failures in the bounded PostgreSQL recovery projection. - Refresh the reviewed SDK public-source pin for the changed shared interruption type with the repository generator. - Keep typed quota exhaustion without a reset out of provider cooldown, bounded retry, and periodic quota-recovery paths. A newer billing refusal supersedes older reset evidence. Classify a startup billing refusal before the remote exit-confirmed retry branch, and prevent the startup planner from falling back to plain backoff. - Add the derived `provider_billing` task action, an account-review link, and a matching Inbox label. Preserve saved-work recovery and current user gates. - Update the connection documentation for these recovery decisions. ## Verification - Red: five server regressions failed on current master for typed authentication, the invalid-credential code, a false quota cooldown, and the missing billing action. The new task notice regression also failed before the repair. - Green: the first focused set passed 241 tests. The final quota/retry/UI set passed 281 tests. The database-backed reconnect set passed seven selected cases for Claude, OpenAI, method switching, and explicit legacy adoption. Sets overlap; these counts are not additive. - Database tests check current account attribution, refreshed credential generations, bounded result projection, and preservation of reported resets. A quota without a reset must not schedule a successor. Two additional startup regressions failed before the startup repair. The repaired startup suites pass all 45 integration cases and 11 focused classification cases. They check a blocked task, billing presentation, no retry deadline, no resumable claim, and preserved retries for rate limits and reported resets. - `pnpm check:token-gates` and `git diff --check` passed. - The earlier [Runner support failure](https://github.com/paperclipai/paperclip/actions/runs/45263306284/job/138003893674) came from a stale reviewed SDK source pin. The same three SDK evidence files failed locally on `cacdb81`. Regenerating the pin from that committed tree made all 59 tests in those files pass. Only the shared `execution-projection.ts` source hash changed; lock and runtime pins remain unchanged. - `pnpm build` and repository-wide `pnpm -r typecheck` passed for the initial change. The authentication/recovery policy set also passed 99 tests. Server typecheck and build also passed for the startup repair at `cacdb81c26988394e11f934d05531bcbb121c7a2`. The full local `pnpm test:run` stopped in chat shard 4/6 with 15 failures: fourteen file/database-open failures during `ENFILE` file-table exhaustion and one retry polling timeout. The failed run also reported an unhandled `ENFILE` error. All 40 selected chat cases, including those 15 failures, passed in a fresh process on `06c14a8`. This does not qualify the full local suite. The complete CI workflow passed on the final head, as recorded below. - Local environment: isolated macOS arm64 checkout and disposable PostgreSQL fixtures. The branch was replayed onto master at `32375d302fbc3a233531674aedefa273adee2d97`; that base change touches an unrelated migration test. - Live provider account repair and the original reported credential failure remain unverified. A read-only operational trace confirmed retained runner checkpoint versions, but the reported runtime string was absent from retained onboarding and run logs as well as current Core and available Cloud source refs. Its producer remains unidentified. - [Trusted PR CI, attempt 2](https://github.com/paperclipai/paperclip/actions/runs/45265943006/attempts/2) completed successfully on `06c14a8cbcf2480eb9d2841bebda3337d4248bd6`, including typecheck, build, Runner, serialized server, general test, and browser suites. The previously cancelled serialized suite passed on that attempt. All 59 commit checks are terminal: 56 succeeded and three conditional checks were skipped. The Snyk commit status also passed. - Greptile completed on `06c14a8cbcf2480eb9d2841bebda3337d4248bd6` with 5/5 and no new findings. Both earlier review threads are resolved. ## Risks - A typed exhausted allowance without a reported reset now requires account repair. Older untyped quota errors retain their existing recovery policy; #15110 remains separate. - Authentication repair must follow the recorded account rather than infer an account from a proxy driver's upstream name. Existing generation checks must still protect newer credentials. - No schema migration or provider replay authority is added. Existing stored runs keep their data. The new task action is derived at read time. - Live recovery of the originally reported incident remains unverified; the operational trace did not locate the reported runtime code. ## Model Used OpenAI `gpt-6.1-sol`, through the Codex harness in T3 Code, with xhigh reasoning effort, tool use, code editing, and test execution. The harness does not expose the context-window size. ## 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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
8c6e5cbbb8 |
fix(connections): offer Paperclip's Google sign-in on Paperclip Cloud only (#22699)
<!-- Write all pull request text in Simplified Technical English
(ASD-STE100): short sentences, one instruction per sentence, simple
approved vocabulary, and the active voice. -->
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents use Google Workspace through a connection. A connection can
use Paperclip's own Google sign-in ("Connect with Paperclip") or the
customer's own Google OAuth client
> - Paperclip's own Google sign-in goes through the Paperclip Cloud
broker with Paperclip's verified Google client
> - Google's restricted-scope verification and security assessment cover
only the servers that Paperclip operates
> - The owner decided on 2026-11-23: Paperclip's own Google sign-in is
for Paperclip Cloud workspaces only. Self-hosted instances use their own
Google OAuth client
> - This pull request hides and refuses Paperclip's own Google sign-in
on self-hosted instances, keeps saved connections working, and gives
clear guidance
> - The benefit is that restricted-scope Google tokens stay on servers
that Paperclip operates, and self-hosted users always see a path that
works
## Linked Issues or Issue Description
Refs #22635
**What happened?**
A self-hosted Paperclip instance offered "Connect with Paperclip" for
Google Workspace and other Google apps. That sign-in uses Paperclip's
verified Google client. It sends restricted-scope Google tokens to a
server that Paperclip does not operate. A self-hosted instance also
offered Paperclip Cloud enrollment only to use that sign-in.
**What did you expect to happen?**
Paperclip's own Google sign-in is available only on Paperclip Cloud
workspaces. A self-hosted instance shows only "Use your own Google OAuth
app", with a short reason and a link to a setup guide. Saved Google
connections on a self-hosted instance keep working until a sunset date
that the owner sets on the Paperclip Cloud broker. After that date, the
connection tells the user to reconnect with their own Google client.
Paperclip Cloud workspaces do not change.
**Steps to reproduce**
1. Run Paperclip without Paperclip Cloud markers (self-hosted).
2. Turn on the Google Workspace connector in **Settings →
Experimental**.
3. Open **Apps** and choose **Google Workspace** or **Gmail**.
4. Before this change: setup offers "Connect with Paperclip" or asks to
connect the instance to Paperclip Cloud first.
## What Changed
- `packages/shared/src/google-sign-in-deployment.ts`: new
`appDefinitionForDeployment` and `isCloudOnlyConnectionMethod`. On a
self-hosted instance they remove every Paperclip-managed Google method.
Other providers do not change. New shared message
`GOOGLE_SIGN_IN_CLOUD_ONLY_MESSAGE`.
- `server/src/services/google-sign-in-availability.ts`:
`paperclipGoogleSignInAvailable()` returns `isCloudManagedInstance()`.
This is the existing single Cloud check. No new environment variable.
- `appWithPaperclipCloudConnectorAvailability` (gallery and setup
validation) uses that check. A self-hosted gallery and setup do not show
managed Google methods.
- `authorization-start.ts`: a self-hosted instance refuses to start a
managed Google authorization before it calls Paperclip Cloud (`422`,
code `google_sign_in_cloud_only`). A broker refusal with
`PROVIDER_CLOUD_ONLY` maps to the same message, also on a Cloud
instance.
- `paperclip-cloud-connector.ts`: `PROVIDER_CLOUD_ONLY` is a known
broker reason.
- `grant-refresh.ts`: when the broker refuses a refresh with
`PROVIDER_CLOUD_ONLY` (after the sunset), the grant is marked for
reconnection. The error keeps code `oauth_reauthorization_required`,
adds reason `google_sign_in_cloud_only`, and tells the user to reconnect
with their own Google OAuth client.
- `ConnectionSetupFlow.tsx`: on a self-hosted instance (no `cloud` block
in health), Google setup uses the filtered definition. It never shows
Cloud enrollment for Google. The customer-owned Google client step shows
this note and a link to Google's client guide.
- Docs: `doc/connections/GOOGLE-WORKSPACE.md` ("Who can use Paperclip's
Google sign-in", "Self-hosted instances: use your own Google client")
and a dated decision row in `doc/memory/google-connector-memory.md`.
- `tests/runner-e2e/source-sdk-public-inputs.json`: pins the new shared
files (generated).
## Verification
- Red first, then green:
- `packages/shared/src/google-sign-in-deployment.test.ts` fails without
the new module and passes with it (4 tests).
- With the source files from `origin/master`, these new tests fail: 2 in
`server/src/__tests__/tool-access-service.test.ts` (self-hosted refusal,
refresh guidance and saved-connection refresh; broker refusal mapping),
3 in `server/src/services/paperclip-cloud-connector.test.ts`, and the
self-hosted test in `ui/src/pages/apps/AppsConnect.test.tsx`. With the
change they pass.
- Cloud path proof: "never shows the self-hosted Google notice on
Paperclip Cloud" (UI), "leaves every app unchanged on Paperclip Cloud"
(shared, identity check on every definition), "decides Cloud or
self-hosted from the instance's Cloud markers" (server). All existing
managed Google service tests (515) pass in a Cloud context.
- `npx vitest run src/__tests__/tool-access-service.test.ts` (server):
517 passed.
- `npx vitest run src/services/paperclip-cloud-connector.test.ts`
(server): 71 passed.
- `npx vitest run src/pages/apps/AppsConnect.test.tsx
src/features/connections` (ui): all passed.
- `npx vitest run` for `agent-connection-catalog.integration`,
`tool-gateway-service`, `google-access-removal`,
`connection-management.integration`, `generic-mcp-connection`,
`remote-mcp-connectors` and `plugin-connectors-circleback-parity`
(server): 446 passed, 1 skipped.
- `npx vitest run` in `packages/shared`: 1383 passed.
- `pnpm verify` exits 2 because `doc/connections/GOOGLE-WORKSPACE.md` is
a global CI input. Required CI supplies the broad coverage.
- Not run: no requests to staging, production, or Google. The reconnect
of a saved managed Google connection on a self-hosted instance after the
sunset was not run end to end in a browser.
## Risks
- Behavior change for self-hosted instances: new Paperclip-managed
Google connections stop. Saved ones keep refreshing until the broker
sunset (not set yet).
- The decision uses `isCloudManagedInstance()`. If a Cloud workspace
does not have its Cloud markers, it shows the self-hosted path. Cloud
stacks always have the tenant token, so the risk is low.
- Works with old and new brokers. An old broker does not refuse. The app
check still hides and refuses the method. A new broker refuses
self-hosted instances, and the app maps the refusal to the same
guidance.
- Deploy order: the broker change (paperclip-cloud) and this change can
deploy in any order.
> 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`) in Claude Code, with tool use
(shell, file edits, test runs).
## 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>
|
||
|
|
a00e31967b |
feat(connections): live setup progress from the person's own agent (#22626)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Several setup screens offer "Set it up with your agent": a prompt the person pastes into their own agent (Claude Code, Codex) to do the setup on their computer. AWS role setup is the newest > - Once the prompt is copied, the setup page goes quiet: the person cannot see what their agent is doing or when it is done, and has to switch windows to find out > - The agent already runs commands, so it can report its progress back if we give it a safe place to send it > - This pull request adds a live checklist the agent fills in: the page creates it, the prompt gives the agent curl commands with a token, and the page shows every update as it happens > - The benefit is a setup that shows its own progress, and a reusable piece any "Set it up with your agent" screen can use ## Linked Issues or Issue Description Refs #22233 (the AWS setup screen this extends). **Subsystem affected** Connections (agent-guided setup), live updates, a new public agent API, UI. **Problem or motivation** After a person copies a setup prompt into their own agent, Paperclip shows nothing until they come back and paste a result. There is no way for the agent to say what it is doing. **Proposed solution** A setup checklist a person's own agent writes to, shown live on the setup page. The agent's requests need no Paperclip sign-in, so they carry a narrow, expiring bearer token. Paperclip Cloud needs no front-door change: it already forwards `/api` requests that carry an `Authorization` header to the workspace without Cloud identity (its machine-request lane), and these always do. **Alternatives considered** - Polling the page instead of live events: slower and adds load to every open setup page. The page uses the existing live-event channel, with a 20-second backup refresh while the agent works. - Putting the token in the URL: URLs end up in logs. The token goes in the `Authorization` header. - Letting the agent set the role ARN itself: the person still pastes it (as decided for #22233). The agent's finish summary shows the ARN to copy. ## What Changed - `packages/db`: new `agent_setup_progress` table (company-scoped, purpose and subject, token hash, items, status, summary, update count, expiry). Migration `0501` is idempotent. - `packages/shared`: `agent-setup-progress` types, limits and validators; new live event type `agent_setup_progress.updated`. - `server`: - `agentSetupProgressService`: create (random `pcsp_` token, only its SHA-256 kept), read, and the agent's set-checklist, update-item and finish. Tokens are compared in constant time; a write is refused after expiry (6 hours) or 300 updates, and concurrent writes are guarded by the update counter. Finishing `done` ticks off open steps. - Routes: board-only `POST /api/companies/{companyId}/agent-setup-progress` and `GET /api/agent-setup-progress/{id}`; agent routes `PUT …/checklist`, `POST …/items/{key}` and `POST …/finish` mounted with the other public routes. Activity entries for created, started and finished. - Each agent write publishes `agent_setup_progress.updated`; the live-events socket forwards it with only the checklist ID. - OpenAPI entries for all five routes. - `ui`: - Reusable `ui/src/components/AgentSetupProgress.tsx`: `useAgentSetupProgress` (creates one checklist per setup and follows it), `agentSetupProgressInstructions` (the prompt section with the agent's curl commands) and `AgentSetupProgressPanel` (waiting, working, done and failed states, using the task status glyphs). - `LiveUpdatesProvider` refreshes the checklist on its live event. - AWS role step: one step (no numbering) with the prompt, the live checklist and the Role ARN field. The prompt starts with the progress instructions and asks the agent to put the role ARN in its finish summary. - Docs: `docs/api/agent-setup-progress.md` (API and how to add it to another page) and the AWS setup section. - Storybook: AWS step in waiting, working, done and failed states, and the panel on its own. ## Verification - `server/src/__tests__/agent-setup-progress.test.ts` (real routes, embedded Postgres): set, update and finish with the prompt's token; only the hash is stored; four live events carry the checklist ID; activity entries. Refusals: missing token, wrong token, another checklist's token (401), bad key (400), unknown item (404), update limit (429), expired (410). Company boundary: another company's member gets 403 on read and create. - `live-events-toast.test.ts`: the socket delivers the event with only `{ progressId }`. It failed before the socket fix (red/green), which an end-to-end run found. - `AgentSetupProgress.test.tsx`: the prompt section's exact commands; the hook creates one checklist and the panel follows waiting → working → done on live refreshes. - `AwsRoleSetup.test.tsx`: the step creates the checklist for its connection, waits for the agent, and the prompt leads with progress reporting. - Totals: shared 1362, server (new, OpenAPI, live events, AWS) 101, UI (components, connections, apps, live updates) 1469. Typecheck clean for db, shared, server and UI (except Storybook's generated catalog, not built in this worktree). - End to end on a local instance: Playwright opened the real AWS setup step, read the prompt, sent the agent's requests with its token, and the page showed each update within 1.5 seconds (inside the 20-second backup refresh, so from live events) through "Your agent set up AWS" with the role ARN summary. No page errors. - Not run yet: Paperclip Cloud staging (after deploy) and an agent running the prompt on its own. ## Risks - New anonymous routes. The token is the only credential: 32 random bytes, stored as a hash, scoped to one checklist, six hours, 300 updates. Text from the agent is shown as plain text (no links or markup), so the worst a leaked token can do is change one checklist's wording until it expires. - One new table and migration (idempotent). - Live delivery is per server process, like every other live event; the 20-second refresh covers a missed event. > 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`) in Claude Code, with tool use (shell, file edits, Storybook and Playwright screenshots, the in-app browser against a local dev server). ## 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> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
4e1d49067c |
Align Inbox, Tasks and Audit toolbar controls (#22675)
## Thinking Path
> - Paperclip helps people manage agents and tasks.
> - Operators switch between Tasks, Inbox, and Audit to review work.
> - Inconsistent menus and shifting controls make those pages harder to
use.
> - Shared dropdown components keep the controls familiar.
> - This change aligns the menus and keeps room for both Audit
descriptions.
## Linked Issues or Issue Description
**What happened?**
Inbox used native dropdowns. Menus could touch the edge of a phone
screen. The Audit scope control moved when its description wrapped.
**Expected behavior**
Menus keep at least 8px of clearance. Switching Audit scope preserves
the control position.
**Steps to reproduce**
Open each Inbox filter and the Tasks view and filter menus at 320px and
390px. Switch between Activity and Agent Actions on Audit.
## What Changed
- Use Tasks-style menus and shorter filter labels in Inbox.
- Give Inbox and Tasks menus 8px of collision padding.
- Align Audit segments and reserve space for the taller scope
description.
## Verification
- All 129 tests across the Inbox, Audit feed, Tasks page and filter
suites passed after rebase at
|
||
|
|
0aaf946227 |
fix(connections): keep retrying when Google does not confirm a revoked grant (#22669)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Paperclip Cloud can manage the Google sign-in for a Google Workspace connection. The app keeps the refresh token. Cloud keeps no token. > - When a user removes the connection, the app asks Cloud to end the access at Google (#22065). > - Before this change, the app deleted the token after that call, whatever Cloud answered. If Google or Cloud could not be reached, the access stayed open at Google, and no retry was possible. > - The owner decided on 2026-11-23: the app keeps the token in a pending record and retries until Google answers. Cloud still never stores a provider token. > - This pull request adds that pending record and a background retry. It also covers company deletion and a Cloud-removed instance. > - The benefit is that a removed Google connection does not keep access at Google because of a short outage, and the user does not need to do anything. ## Linked Issues or Issue Description Refs #22065 **What happened?** A managed Google connection was removed while Paperclip Cloud or Google was unavailable. The removal result was `not_ended`, and the refresh token was deleted. Paperclip could not try again, so Google access stayed open. **What did you expect?** Paperclip keeps the token only for the retry, and retries automatically until Google confirms or gives a final answer. The user sees that Paperclip keeps trying, and does not need to act. **Steps to reproduce** 1. Connect Gmail through Paperclip Cloud. 2. Make the broker revoke fail (Cloud unavailable, or Google 5xx). 3. Remove the connection. The token is deleted and nothing retries. ## What Changed - New table `google_pending_revocations` (migration `0502`, additive, `CREATE TABLE` only). It has `company_id` with no foreign key, so a row outlives a deleted company. It stores the token as the same `local_encrypted` material as the connection secret version. It never stores plaintext. It is not a company secret: it is not listed, an agent cannot bind it, and no route reads it. - `google-access-removal.ts`: before the broker call, the app copies the sent token version into a pending row (lease 2 minutes, so a restart during the call resumes). A final outcome deletes the row. A retryable outcome (`provider_revocation_failed`, `revocation_in_progress`, `broker_unavailable`, `broker_error`, `unexpected_error`) keeps it, and the result is the new `retrying`. If the connection secret is still live after the conditional delete (for example, the user signed in again during the call), the row is deleted. - New worker on the `google-pending-revocation` delivery queue (`registerDeadlineWork`; it registers the real next deadline and has no deadline when the table is empty). Each attempt takes a lease on the row and calls the broker with a 15-second timeout. Backoff is 1, 2, 4 ... minutes, up to 6 hours. The hard stop is 30 days. The worker stops without a call if a live company secret holds the same token. - When a retry ends, the worker writes a `connection.google_access_retry` audit event and a `tool_connection.google_access_ended` or `tool_connection.google_access_not_ended` activity entry (labels added to the activity feed). For a deleted company, it writes only a log line. - Company deletion queues every managed Google token of the company inside the delete transaction, before the secrets are deleted (`reason = company_deleted`). - When the Cloud connection status check finds the instance `removed`, the app queues every managed Google token (`reason = instance_removed`), then deletes each connection secret. - `ManagedGoogleAccessRemoval.result` gets `retrying` (shared type and OpenAPI schema). The removal message for `retrying`: "Google didn't confirm that Paperclip's access has ended yet. Paperclip will keep trying automatically." It has no link and asks for no action. - Docs: `doc/connections/GOOGLE-WORKSPACE.md` ("Pending revocation"), `docs/api/tool-connections.md`, the help page `docs/guides/board-operator/deleting-connection-data.md`, and a dated decision row in `doc/memory/google-connector-memory.md`. - `tests/runner-e2e/source-sdk-public-inputs.json` refreshed for the changed shared type, as `pnpm verify` asks. ## Verification - `npx vitest run src/__tests__/google-managed-connection-removal.test.ts` (embedded Postgres): 46 pass. Without the fix, 15 fail (red), with the fix all pass (green). New cases: - an unconfirmed token is kept only in the pending row, encrypted, not in the secrets list; the worker retries and deletes the row when Google confirms; audit and activity are written; - the row exists during the broker call, so a fresh worker after a restart revokes it; - `binding_not_known`, `other_connections_remain` and `provider_revocation_disabled` stop the retry; - backoff 1 minute to 6 hours, and give-up at 30 days with a final audit and activity entry; - a live secret with the same token stops the retry without a call; - an older broker's `403 INSTANCE_SUSPENDED` is retried; - company deletion queues the token and the worker revokes it after the company is gone; - a removed instance queues every token, drops the secrets, does not queue again, and the worker revokes. - `npx vitest run src/__tests__/paperclip-cloud-connector-status.test.ts`: the removed-instance hook runs only for `removed`, and a failure does not change the status. - `ui`: `npx vitest run src/features/connections/googleAccessRemoval.test.ts` (7 pass, the new `retrying` case is red without the change). - Also passed: `tool-connection-content-deletion`, its canary, `delivery-work-coordinator`, `idle-local-work`, `packages/db` tests; `server` `tsc --noEmit`. - `pnpm verify` exits 2 (global doc input changed), so required CI supplies the broad coverage. - Not verified: any call to a real broker or to Google. No request was sent to staging, production or Google. ## Risks - Migration is additive (`CREATE TABLE` and indexes on the new table): `online_compatible`. - Paperclip now holds an encrypted token for at most 30 days after removal when Google did not confirm. The token is never usable for tool calls: no grant or connection refers to the row. - Instance removal deletes the managed Google connection secrets. Those connections then need a reconnect after a new enrollment. They could not refresh anyway, because Cloud refuses a removed instance. - Deploy order: either order is safe. With the current production broker, a removed instance's revoke gets `403` and the app retries until the hard stop. The Cloud broker change that accepts it is a separate PR in the private Cloud repository. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) through Claude Code, with tool use (shell, file edits, embedded Postgres tests), standard 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> |
||
|
|
7906db1ac9 |
fix(apps): title the Google AI connector "Google Antigravity and Gemini" (#22673)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The Connectors page lists the services and model providers that a
company can connect
> - The Google model-provider connector has the title "Google"
> - That title does not tell people that this connector is for Google
Antigravity sign-in and Gemini API keys. It is easy to confuse with the
Google Workspace connectors
> - This pull request changes the connector title to "Google Antigravity
and Gemini"
> - The benefit is that people can find the correct connector for their
Google AI accounts
## Linked Issues or Issue Description
**What existing behavior does this improve?**
The title of the Google model-provider connector on the Connectors page.
**Subsystem affected**
UI: the Connectors page (`/<company>/apps`) and the shared app
definition for `google`.
**Current behavior**
The connector title is "Google". The title does not name the products
that it connects, and people can confuse it with the Google Workspace
connectors.
**Proposed behavior**
The connector title is "Google Antigravity and Gemini".
**Reason and benefit**
People can find the correct connector for Google Antigravity sign-in and
Gemini API keys.
**Breaking changes**
None. The provider id, the app slug, and all stored values stay the
same.
## What Changed
- Change the `name` of the `google` app definition
(`packages/shared/src/app-definitions/google.json`).
- Before: `Google`
- After: `Google Antigravity and Gemini`
- These texts read the name, so they also change:
- Card heading: `Google` -> `Google Antigravity and Gemini`
- Card button accessible name: `Connect Google` -> `Connect Google
Antigravity and Gemini`. The visible button text stays `Connect`.
- Setup screen heading: `Connect Google` -> `Connect Google Antigravity
and Gemini`
- The service name that new connection requests show to agents and in
chat cards.
- Add a Connectors page test that checks the new card title,
description, and button name.
- Resync `tests/runner-e2e/source-sdk-public-inputs.json`, because the
app definition is a pinned input.
Not changed, on purpose:
- The provider id `google`, the app slug `google`, and all stored
values. Existing application rows are found by their
`app-gallery:google` key, not by name.
- The short provider name `Google` in
`ui/src/components/ai-connections/model.ts` and
`packages/shared/src/ai-connections.ts`. Sentences such as "Your Google
default" and default account names such as "My Google API account" use
this name. Account names are stored when people create them, and the
long title makes these sentences awkward.
- The `Google` choice in the model provider picker, next to `OpenAI`,
`Anthropic`, and `xAI`. Its description already says "Antigravity
sign-in or Gemini API key".
- The Google Workspace and Search Console connectors.
## Verification
- Red/green: `cd ui && npx vitest run src/pages/apps/Browse.test.tsx -t
"Antigravity and Gemini"` fails with the old name and passes with the
new name.
- `cd ui && npx vitest run src/pages/apps/Browse.test.tsx` passes (119
tests).
- `cd ui && npx vitest run src/components/ai-connections
src/pages/apps/AppsConnect.test.tsx` passes (362 tests).
- `cd packages/shared && npx vitest run src/app-definitions` passes (50
tests).
- `pnpm verify` exits 2 because the pinned-input registry changed.
Required CI supplies the broad coverage.
## Risks
- Low risk. This is a display text change.
- Old chat cards keep the service name that they stored when they were
created ("Google"). This is only display text.
- The Connectors page matches aggregator apps by slug and name. The slug
`google` does not change, so the match does not change.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use
(shell, file edits, test runs).
## 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>
|
||
|
|
7f343549db |
fix(ai-connections): tell people why an API key could not be verified (#22666)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - During onboarding, a person can connect a model with a provider API
key. Paperclip checks the key with one request to the provider before it
stores it
> - `validateAiApiKey` returns "The provider rejected this API key."
only for 401 and 403. Every other answer, and every network error,
returns "The provider could not verify this account. Try again."
> - The server does not log the upstream status, so nobody can tell
later what the provider said
> - A person whose key is valid but whose account has no credit, is
rate-limited, or hits a provider outage cannot know what to fix
> - This pull request gives each case its own code and message, and logs
the status and the provider's error type without the key
> - The benefit is that people can fix the real problem, and support can
see the provider's answer in the logs
## Linked Issues or Issue Description
**What happened?**
During onboarding, a person entered a Claude API key and saw "Could not
store the API key: The provider could not verify this account. Try
again." They then switched to a Claude subscription. The server log did
not show which status the provider returned.
**Expected behavior**
The person learns whether the key is wrong, the account has no credit,
the provider is limiting requests, or the provider is down. The server
logs the upstream status.
**Steps to reproduce**
1. Call `validateAiApiKey("anthropic", key, request)` with a `request`
stub that returns 400, 402, 429 or 500.
2. Observe that all four throw `ai_connection_verification_failed` with
the same message.
**Paperclip version or commit**
`master` at `5f5ac154368`.
**Deployment mode**
Hosted onboarding. Self-hosted installs use the same check.
Refs #12675 (related: server-owned user-secret definitions for
onboarding API keys).
## What Changed
- `ai-api-key-failures.ts` (new): one code and message for each result.
The codes are `ai_connection_api_key_rejected` (unchanged),
`ai_connection_billing_required`, `ai_connection_rate_limited`,
`ai_connection_provider_unavailable`,
`ai_connection_verification_timeout`,
`ai_connection_provider_unreachable`, and
`ai_connection_verification_failed` (unchanged, for all other answers).
- `ai-api-key-test.ts`: map 401/403 to rejected (unchanged); 402, or the
error type `billing_error`, `insufficient_quota` or
`insufficient_credits`, to billing; 429 to rate limited; 5xx (including
Anthropic's 529) to provider unavailable. A `TimeoutError` maps to
timeout, and other network errors map to unreachable.
- Log the provider, the HTTP status, the provider's error type and the
result code. The error type comes from `error.type`, `error.code` or
`error.status` in at most 8 KiB of the error body. It is used and logged
only when it is on a closed list of documented provider error types
(Anthropic, OpenAI and xAI, Google, OpenRouter). Any other value is
ignored. The key and the response text are never logged. 401/403 bodies
are not read.
- `adapters/registry.ts` and `agent-environment-test.ts`: keep the
specific code in the environment check instead of collapsing it to
rejected or failed.
- The billing check looks at `error.type`, `error.code` and
`error.status` together, so a 429 with `type: invalid_request_error` and
`code: insufficient_quota` is a billing problem, not a rate limit.
- `tests/runner-e2e`: the connection harness keeps every new code in
`creationFailure` instead of saving it as `connection_request_rejected`.
One shared list feeds `connection-flow.ts`, `connection-evidence.ts` and
`result-validation.ts`, and a test keeps it equal to the server's codes.
- Tests: `ai-api-key-test.test.ts` (17 tests) and
`connection-support.test.ts`.
**The user-facing text needs a person's review.** The new messages are a
first draft. They read after the onboarding prefix "Could not store the
API key:":
| Code | Message |
|---|---|
| `ai_connection_billing_required` | The provider account for this API
key has no credit or billing set up. Add credit with the provider, then
try again. |
| `ai_connection_rate_limited` | The provider is limiting requests for
this account right now. Wait a minute, then try again. |
| `ai_connection_provider_unavailable` | The provider is having problems
right now. Try again in a few minutes. |
| `ai_connection_verification_timeout` | The provider did not answer in
time. Try again. |
| `ai_connection_provider_unreachable` | Paperclip could not reach the
provider. Check this server's network connection, then try again. |
## Verification
- `pnpm exec vitest run server/src/services/ai-api-key-test.test.ts`: 17
passed. On `master`, 11 of the original 15 fail.
- Callers: `ai-connections.test.ts`, `adapters/registry.test.ts`,
`agent-environment-test-status.test.ts` and
`agent-test-environment-routes.test.ts` with the new file: 5 files, 331
tests passed.
- `pnpm --filter @paperclipai/server typecheck` passes.
- Not run: a live check against each provider. The billing mapping uses
the documented error types (`billing_error` for Anthropic,
`insufficient_quota` for OpenAI, 402 for OpenRouter). The models
endpoint may not report a billing problem for every provider.
## Risks
- Low risk. The HTTP status of the store request stays 422, and 401/403
behavior does not change.
- An answer that does not match a known case still returns
`ai_connection_verification_failed`, as before.
- A code that consumers compare by value can now be one of five new
values. No UI code compares these codes, and the server callers now pass
them through.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with shell, file
edit, and code execution tools.
## 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
|
||
|
|
d28becf0f5 |
fix(server): run person-opened gateway sessions as their opener for personal connection grants (#22643)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The tool gateway lets an agent run call connected apps through a short-lived session > - A person on the board can also open a gateway session for a running agent > - Such a session resolved credentials for the run's responsible person, not for the person who opened it > - A member could therefore use another member's personal connection grant through that member's running agent > - This pull request limits personal grants in a person-opened session to the grant owner and requires permission to act on the agent > - The benefit is that a personal connection is used only by its owner or by the owner's own agent runs ## Linked Issues or Issue Description Refs #22635 **What happened?** `POST /api/tool-gateway/sessions` let any non-viewer member open a session for any running agent in the company. Tool calls in that session used the personal grant of the run's responsible person. **What did you expect to happen?** A person who opens a session can use a personal (user-owned) grant only when they own it. The person needs permission to act on the agent. Company-shared connections and agent-opened sessions work as before. **Steps to reproduce** Two members are in one company. Member A has a personal grant on a connection that agent X uses. While a run of X is active, member B opens a gateway session for that run and calls a tool on that connection. The new route test covers this case. **Impact** Access-control hardening for personal connection grants. ## What Changed - Add the nullable column `tool_gateway_sessions.created_by_user_id` (migration `0502`, which also adds `tool_mcp_tasks.created_by_user_id`). The route sets it when a person (not a local implicit board) opens a session. - Grant resolution for such a session acts as the person who opened it. That person's own personal grant is used, or a connect card is addressed to that person. Another member's personal grant is never selected, and that member gets no card. - The opener is recorded on the tool invocation (server-written `policyExplanation.sessionOpenedByUserId`) and restored when an approved action runs. An approved call from that session therefore uses the same person's grant. - A guard after grant resolution refuses a user-owned grant of another person with `403` and `reasonCode: personal_grant_owner_required`, as defense in depth. - Saved-call replay is scoped to the opener: idempotency keys get an opener suffix for such sessions, and approval replay matches only invocations recorded with the same opener. The lookup of keys saved before this change still runs: a saved call that can be attributed to the same person replays, one attributed to another person does not, and one that cannot be attributed returns the existing `legacy_tool_idempotency_unverifiable` conflict instead of running the write again. - Long-running provider tasks (`tool_mcp_tasks`) record the opener in a new `created_by_user_id` column (same migration) and restore it on each background poll, so the task keeps the opener's grant and is attributed to the opener. - Managed GitHub identity selection uses the opener, in the first and the fallback selection. - A call attaches to an existing long-running provider task only when the task uses the same grant the call resolves to. On a personal grant it must also be the same person (an agent session matches only tasks with no opener; the grant owner may also collect a legacy task with no opener). On a shared grant any person may collect. The wake for a finished task now carries the task id, so the agent's continuation resolves the opener's grant and collects the result instead of calling the provider again. - `POST /api/tool-gateway/sessions` checks the existing `agent:wake` permission for a board caller, the same check as invoking the agent. - Agent-opened sessions do not set the column, so agent runs and the recovery of interrupted runs do not change. - Document the rule in `doc/MCP-ACCESS-GOVERNANCE.md`. - I checked the sibling routes. Named gateway tokens minted by a person need `tools:admin` and carry no responsible person. Board test calls and MCP app view calls already run as the caller. Stored MCP task continuations stay pinned to the grant they started with. ## Verification - New route tests in `server/src/__tests__/tool-gateway.test.ts`: - Three members, two with personal grants, on a run that belongs to the first. A session opened by the second member uses only that member's credential. The run owner's session and an agent-opened session use the run owner's credential. A member with no grant gets `409 user_authorization_required`, the card is addressed to that member, and the remote server gets no request. A reviewed call from the second member's session, once approved, runs with that member's credential. The same write from two people's sessions runs once for each person, and only the same person's retry replays. - A pre-upgrade saved write retried by the same person replays (or conflicts when it cannot be attributed) and never reaches the provider twice; another person's identical write runs. - `mcp-tasks.test.ts`: a person-started task keeps the opener's grant through a background poll; an agent retry never receives that task's result and keeps its own task; the continuation after a wake collects once with no new provider call; on a shared grant another person collects the task, including a task started before openers were recorded. - `tool-gateway-service.test.ts`: an opener with their own managed GitHub grant uses it; an opener without one is refused and the run owner's grant is never used. - A viewer cannot open a session for the agent. - Before the fix, the second member's session used the run owner's credential, and the viewer got `201`. Both tests pass now. - `npx vitest run src/__tests__/tool-gateway.test.ts src/__tests__/connection-management.integration.test.ts src/__tests__/mcp-tasks.test.ts`: with `tool-access-service.test.ts` and the policy tests, 833 tests pass. - `tsc --noEmit` for `server` passes. - `pnpm verify` exits 2 because a global CI input (a doc) changed. Required CI gives the broad coverage. ## Risks - A person who opened a session for another member's run used that member's personal grants before. Now the session uses the opener's own grants. This was not an intended flow. Shared connections and agent runs do not change. - A person-opened session that repeats exactly the same side-effecting call an agent session already made in the same run gets a `409` conflict instead of a second write, because that earlier call has no recorded opener. Use a new explicit idempotency key for an intentional repeat. - The migration only adds nullable columns. Sessions and review requests created before this change have no opener record and keep the previous behavior until they expire (15 to 60 minutes). - Follow-up, out of scope: in the experimental MCP Tasks path, a call with a new explicit idempotency key and the same arguments still attaches to the same person's open task under the same grant. That is the existing de-duplication for every caller and does not depend on the opener rule. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, 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> |
||
|
|
b865dd112b |
feat(google-workspace): run Gmail, Drive, Docs, Sheets, Slides and Calendar on Paperclip's REST tools (#22634)
## 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, Docs, Sheets, Slides and Calendar actions through one connection > - Google's hosted Workspace MCP servers are a Developer Preview, so Paperclip cannot offer them to the public > - Paperclip has its own REST tool set for all 36 allowlisted actions, but every service still sent its calls to Google's MCP servers > - The owner decided on 2026-11-23 to launch all six services on REST now and to live-test on the staging tester after deploy > - This pull request switches the six services to `paperclip_rest` and fixes what the switch breaks > - The benefit is that the connector no longer depends on Developer Preview servers, and agents get all 36 actions, including the two Gmail actions Google's live server did not offer ## Linked Issues or Issue Description Refs #22016 (the transport switch), #22000, #22014, #22017, #22027, #22028, #22029 (the REST tool set). **Subsystem affected** Built-in Google Workspace connector (`google-workspace`, `workspace.all`): transport setting, catalog publication, tests and docs. **Problem or motivation** All six launch services used Google's hosted MCP servers. These servers are a Developer Preview and are not available to the public. Google's live Gmail MCP server also did not offer `gmail__list_threads` and `gmail__search_messages`. **Proposed solution** Set Gmail, Drive, Docs, Sheets, Slides and Calendar to `paperclip_rest` in `GOOGLE_WORKSPACE_TOOL_TRANSPORT`. Keep Chat, People and Search on `google_mcp`. Fix the catalog refresh so that an existing connection keeps its actions active after the switch. **Alternatives considered** Switch one service at a time after a live test (the Nov 17 rule). The owner replaced this rule on Nov 23: switch all six now and fix forward. **Roadmap alignment** This is the planned launch step for the Google Workspace connector. It does not overlap other core work. ## What Changed - `packages/shared/src/google-workspace-connectors.ts`: set `gmail`, `drive`, `docs`, `sheets`, `slides` and `calendar` to `paperclip_rest`. `chat`, `people` and `search` stay `google_mcp`. - Connections saved before the switch keep Google's MCP definitions in their catalog. Two changes make them work with no user action: - New resolver `paperclipDefinedTool(connection, toolName)` in `server/src/services/connectors/paperclip-defined-tools.ts` (typed result). It is the one place that says which tools are Paperclip-defined; for a `google-workspace` connection it calls `googleWorkspaceRestToolDefinition` in the dispatch adapter, which returns the REST definition when the service is on `paperclip_rest`. - `server/src/services/tool-gateway.ts`: when the gateway lists a connection's tools, it takes the input schema, output schema, description and annotations of a Paperclip-defined tool from the resolver, not from the saved row. Routing and the advertised definition read the same transport setting in the same process. This is an in-memory lookup, so it adds no request to the turn start. Example: an agent gets the REST `docs__update_doc` schema, where `writeControl.requiredRevisionId` is required, not Google's schema, where it is optional. - `server/src/services/tool-access/catalog/publication.ts`: catalog publication asks the same resolver. It never holds a Paperclip-defined action for review, and it clears the review hold (`quarantined`, `pending_review`) of an action held only because a remote definition changed. Clearing the hold does not count the action as new, so it is never added to the profile: Off stays Off and Ask first stays, also for a held action. Only actions the connection never had (Gmail `list_threads` and `search_messages`) get the default for new actions. Before this fix, a refresh after the switch put every action of an existing managed connection into `pending_review` (10 of 10 in the regression test). - `server/src/__tests__/google-workspace-rest-transport.test.ts`: the fake Google now answers the Docs, Sheets and Slides REST hosts and the Drive and Calendar paths. New tests: - The transport map has exactly the six launch services on `paperclip_rest`. - A full read and write grant lists exactly the 36 allowlisted actions (with `gmail__list_threads` and `gmail__search_messages`) and sends no MCP request. A read-only grant lists the 23 read actions. Gmail, Drive and Calendar group grants list exactly their actions. - One read and one write per service run through the real `executeTool` path on REST with the default policy (no approval request). Each call records the invocation and the `call_completed` event with the connection ID (the "Delete data" bookkeeping keys), and audits the protocol `Google Workspace REST` with the service endpoint. - Injected instructions in Docs, Sheets, Slides, Drive and Calendar REST results are blocked. - An existing connection discovered over MCP keeps its actions active after the switch and can call the new Gmail actions. - Migration without refresh: a connection saved with Google's MCP schemas (`update_doc` with `writeControl` optional) advertises the REST schemas after the switch with no refresh, and `read_doc` then `update_doc` with the revision succeed over REST. - The first refresh after the switch releases an action held for `pending_review`, keeps an Off action unlisted and keeps Ask first (`approval_required`). - An action that is both Off and held stays Off, and one that is both Ask first and held stays Ask first, after the switch and after two refreshes. - The MCP-path test pins Gmail and Docs to `google_mcp` explicitly. - `server/src/__tests__/helpers/google-workspace-transport.ts`: new helper `useGoogleMcpTransport()`. Tests whose fixtures act as Google's MCP servers use it (`tool-access-service`, `tool-gateway-service`) or pin the transport in `beforeAll` (`google-workspace-injection-screening`). These tests still cover the MCP path, which stays available for Chat, People, Search and a switch back. - `packages/shared/src/google-workspace-connectors.test.ts`: assert the new transport map. - Docs: `doc/connections/GOOGLE-WORKSPACE.md` and the REST folder `README.md` say that the six services run on REST. `doc/memory/google-connector-memory.md` has three dated Nov 23 decisions (all six switched to REST, writes default to Allowed, image-by-URL inserts allowed), and the two items are removed from "Still open". ## Verification - Red: after the flip, 50 tests failed in four files because their fixtures act as Google's MCP servers. These are fixture assumptions, not product bugs. - Red: without the gateway change, the migration test gets Google's saved schema; without the publication change, the held action stays `quarantined`; without excluding released rows from the new-action default, the Off and held action comes back. All green with the fixes. - Red: the new test "keeps an existing connection's actions usable when its services move from Google's MCP servers to REST" failed before the `publication.ts` fix: 10 catalog entries were `quarantined` with `pending_review`. Green after the fix. - `cd server && npx vitest run src/__tests__/google-workspace-rest-transport.test.ts src/__tests__/google-workspace-injection-screening.test.ts src/__tests__/tool-gateway-service.test.ts src/__tests__/tool-access-service.test.ts src/services/google-workspace-rest-dispatch.test.ts src/google-workspace-rest-tools`: with `connection-management.integration.test.ts` added: 60 files, 2232 tests pass. `google-workspace-rest-transport.test.ts`: 52 tests pass. - `cd packages/shared && npx vitest run src/google-workspace-connectors.test.ts`: 14 tests pass. - `npx tsc -p server/tsconfig.json --noEmit`: no errors. - Trace of a read (`gmail__get_message`) and a write (`gmail__create_draft`) through `executeTool` in `server/src/services/tool-gateway.ts`: policy decision and invocation record (13723, 13731), approval gate (13820), `call_allowed` audit (13885), dispatch to `executeRemoteHttpTool` (13915), prompt-injection screening of the result (13964), `call_completed` event and audit (14022, 14044), failure audit (14187). In `executeRemoteHttpTool` the grant scope check (8172) runs before the REST branch (8276), which rechecks the current grant and returns before any MCP session, MCP Task or elicitation code. The REST adapter (`google-workspace-rest-dispatch.ts`) calls `google-http.ts` only through the gateway's guarded fetch. - Not verified: calls against real Google. The live test on the staging tester runs after deploy. ## Risks - Real Google answers can differ from the fixtures. The REST tools are not yet run against real Google. The live test on the staging tester runs after this deploys, and problems are fixed forward. - The OAuth client on the staging tester is marked for AI agents and was only used through MCP. If Google refuses REST calls from that client, all six services fail on the tester until the client changes. - Existing connections keep their stored MCP schemas until a catalog refresh, but agents receive the REST definitions at once. The stored risk level of the four update actions stays `write` until that refresh, then becomes `destructive`. The two new Gmail actions appear after a refresh. - Input differences between Google's MCP schemas and the REST tools are listed in the REST folder `README.md` ("Input differences an agent meets after a switch"). Agents receive the REST schemas, so these differences are visible to them. No `tools/list` from Google's servers is recorded, so the check uses Google's published references. - Accepted risk (owner decision, 2026-11-23): Docs and Slides edits may insert an image from any public web address. Google, not Paperclip, fetches the address, and Paperclip's own requests still go only to the allowed Google hosts. The residual risk is that an agent could put data in the address it chooses. Links to Drive or Docs files stay refused. - Update actions (`update_doc`, `update_presentation`, `update_spreadsheet`, `update_event`) are labelled destructive on REST, as decided on Nov 17. This does not add an approval step: write actions stay Allowed by default. - A switch back to `google_mcp` stays possible with a one-line change. The MCP path tests still run. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, file edits, test runs). ## 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> |
||
|
|
ba1b0585bc |
fix(server): send deployment OAuth client secrets only to the token endpoint they are configured for (#22649)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - App connections sign in with OAuth, and an operator can set a deployment-wide OAuth client with `PAPERCLIP_TOOL_OAUTH_*` variables > - The server picked that client by a provider name, and a connection's own settings could set both the provider name and the token URL > - So a deployment client secret could go to a token URL that the deployment did not choose > - A deployment secret must go only to the endpoint of the app it was set up for > - This pull request pins each deployment client to the token endpoint that its app definition fixes, and fails closed for any other endpoint > - The benefit is that member-entered or custom endpoints get only a member-entered client ## Linked Issues or Issue Description Refs #22635 **What happened?** `configuredOAuthClientForConnection` returned the deployment client for any connection whose provider name matched, or the unsuffixed client for any connection. The token exchange then sent that client secret to the connection's token URL. **What did you expect to happen?** A deployment client goes only to the token endpoint that its app definition fixes. A custom endpoint needs a client that the member adds. **Steps to reproduce** Set a provider-specific deployment client. Create a custom connection that names that provider and a different token URL, and start sign-in. The new unit tests cover this case. **Impact** Secret-handling hardening for deployment OAuth clients. ## What Changed - `configuredOAuthClientForConnection` now takes the token URL that the caller will post to. It returns a deployment client only when the connection comes from a real app definition, the provider is that app, the method lists `customer` ownership, and the token URL equals the method's `defaults.tokenEndpoint` (or, when the method fixes no token endpoint, is on the exact host of its fixed server, discovery, metadata or authorization URL). - A pasted (custom) server never gets a deployment client, including the unsuffixed one. It needs a client of its own, or CIMD or dynamic registration. - The token URL is required at every call site: start, callback, connection refresh and grant refresh. - When a deployment client exists but the endpoint does not match, and the connection has no client of its own, sign-in fails with `oauth_instance_client_endpoint_mismatch` and a clear message. - Pin `defaults.tokenEndpoint` in the Asana and Railway definitions, whose token endpoints are on another host than their MCP servers. - Update `doc/connections/GENERIC-REMOTE-MCP.md` and `doc/connections/CONNECTOR-PLAYBOOK.md`. ## Verification - New `server/src/services/tool-access/oauth/client-settings.test.ts` (16 tests): other hosts, a path that resolves elsewhere, plain HTTP, vendor subdomains, another port, a missing URL, empty or padded gallery markers, colliding host names, a custom connection that names a provider, the unsuffixed client on a custom connection, and a connection that names another app's provider all get no deployment client. Slack's fixed endpoint, Notion's server host and the pinned Asana and Railway endpoints still get it. These cases failed before the fix and pass now. - `server/src/__tests__/generic-mcp-connection.test.ts` and the machine-to-machine test in `tool-access-service.test.ts` now check that a pasted server never receives the deployment client or secret. Both failed before the fix. Two other pasted-server tests now use a client of their own. - A positive test sends the Slack deployment client to Slack's pinned token endpoint, with its secret, and nowhere else. - The connect route keeps the draft and returns `manualClientRequired` with a plain reason when a deployment client cannot be used (route and UI tests). - `npx vitest run` on the OAuth service and connection tests: 686 tests pass. Shared app-definition tests pass. `tsc --noEmit` for `server` passes. - `pnpm verify` exits 2 because a global CI input (a doc) changed. Required CI gives the broad coverage. ## Risks - A self-hosted deployment that used `PAPERCLIP_TOOL_OAUTH_*` for a pasted server must add a client to that connection. Sign-in shows a clear error instead of sending the secret. - A gallery app with `customer` ownership whose token endpoint is on another host than its fixed URLs needs `defaults.tokenEndpoint` to keep using a deployment client. Asana and Railway are pinned here. Box, Notion, PostHog, Sentry and Xero rely on the same-host rule: if their discovery returns a token endpoint on another host, a deployment-wide client is refused until the endpoint is pinned, and a client added to the connection always works. A test lists these apps by name, so a new app must choose. Gallery apps with a fixed token endpoint (Slack, Linear, Google) do not change. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, 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> |
||
|
|
6efa3eb2d2 |
chore(lockfile): refresh pnpm lockfiles (#22678)
## Thinking Path > - Paperclip uses a dependency lock for reproducible builds. > - Dependency changes on master need matching lock entries. > - Paid eval reports also pin a reviewed offline correction. > - Reports must install before paid model work starts. > - This automated PR keeps the lock and report proof together. ## Linked Issues or Issue Description **What happened?** Dependency manifests on master changed after the last committed lock refresh. **Expected behavior** Frozen installs must match those manifests. Eval reports must retain matching offline lock proof. **Steps to reproduce** Run a frozen install before and after this lock refresh. ## What Changed - Refresh the dependency lock from the manifests on master. - Refresh the sandbox provider lockfiles from their manifests on master. - Include the matching offline report correction and hashes. - Resync the SDK public source proof's lock pins from the refreshed lock. ## Verification - Pinned pnpm resolution completed with lifecycle scripts disabled. - The report proof refresh accepted the reviewed committed baseline. - The workflow rejected changes outside the lock and report proof files. ## Risks The lockfile bot merges this PR without CI or review when it verifies every added version on npm and all versions outside the harness allowlist are at least 3 days old. Otherwise the PR waits for a maintainer, and the daily refresh tries again. The bot merges only the exact commit this workflow generated from manifests already reviewed on master. Unknown report lock baselines remain blocked. This update changes no permissions or paid enable gates. ## Model Used None — generated by pnpm and the deterministic report-lock updater. ## Checklist - [x] Thinking path and problem description included - [x] Generated lock and matching report proof included - [x] Release-age gate decides between bot merge and maintainer review Co-authored-by: lockfile-bot <lockfile-bot@users.noreply.github.com> |
||
|
|
27af8e5c0c |
feat(telemetry): report custom connector domains and aggregator app requests (#22665)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents use tools through connectors: catalog connectors, custom MCP
servers, and aggregator gateways (Composio, Arcade, Executor) that reach
many apps
> - Connector telemetry sends every custom MCP connector as
`connector_key: "custom"`, and it sends nothing about apps behind an
aggregator
> - The team cannot see which services people add as custom servers, or
which aggregator apps people try to connect and which ones they finish
> - This pull request adds a reduced `server_domain` to the connection
events for custom connectors, and two aggregator app events
> - The benefit is a privacy-safe view of connector demand: no URL, no
subdomain, and no provider-controlled string leaves the installation
## Linked Issues or Issue Description
No issue exists. This follows the feature request template
(`.github/ISSUE_TEMPLATE/feature_request.yml`).
**Subsystem affected**
Server connector telemetry
(`server/src/services/connector-telemetry.ts`), the aggregator app sync
and setup paths
(`server/src/services/tool-access/catalog/aggregator-accounts.ts`), the
tool gateway, and the shared telemetry contract
(`packages/shared/src/telemetry`).
**Problem or motivation**
Connector telemetry sends every connector outside the first-party
catalog as `connector_key: "custom"`, and every app behind Composio as
the `composio` connector. Arcade and Executor apps are hidden the same
way. This hides which servers and apps people actually connect to. It
also hides what they try to connect and fail to connect. The team cannot
use telemetry to decide which connectors to add to the catalog or where
setup fails.
**Proposed solution**
For custom connectors only, send the registrable domain of the server
(`server_domain`), with IP, private, and local hosts reduced to
`private` and stdio servers to `stdio`. Send `connection.app_requested`
when a person or agent asks an aggregator to add an app, with the
result, and `connection.app_linked` when that app becomes connected. The
app is a slug from the checked-in aggregator catalog, or `other`. No
user-controlled string leaves the process.
**Alternatives considered**
Sending the full host was rejected: subdomains can name a customer or
tenant. Hashing the host was rejected: it cannot be read in an insight,
and short domains are easy to reverse. Sending the provider's toolkit
name was rejected: Executor and custom integrations use names that
people choose.
## What Changed
- Sync the generated telemetry contract. The telemetry backend registers
`server_domain` and the two new events first, so nothing is dropped as
unregistered.
- `server/src/services/connector-telemetry.ts`:
- `serverDomainForUrl()` reduces a configured address to its registrable
domain (ICANN public suffix plus one label, from `tldts`).
`mcp.smithery.ai/sse?token=…` becomes `smithery.ai`. IPs, loopback,
single-label hosts, non-ICANN or special-use suffixes (`.local`,
`.internal`, `.home.arpa`, `.onion`), non-HTTP schemes, and unparsable
values become `private`. A final pattern check makes sure nothing
URL-shaped can pass.
- `server_domain` goes on `connection.created`, `connection.updated`,
and `connection.invoked` only when `connector_key` is `custom`. Local
stdio servers send `stdio`. A remote connection with no address yet
omits it.
- `aggregatorAppTelemetrySlug()` returns a slug from the shared
aggregator catalog, or `other`. This is the same rule as
`connector_key`.
- `newlyLinkedToolkits()`, `emitAggregatorAppsLinked()`,
`emitAggregatorAppsRequested()`, and
`emitAggregatorAppRequestsFromToolCall()`. All are best-effort and never
throw.
- `aggregator-accounts.ts`: the Composio list check and the
Arcade/Executor inventory sync read the previous snapshot status before
the write. They send `connection.app_linked` only for a change to
`connected`. The Composio check sends it right after each saved row, so
a later app that fails in the same check does not lose it, and it
updates the stored status after each write, so an app named twice in one
check sends one event. The Composio upsert now returns its row, so a
write that loses to a newer observation sends nothing. App setup `start`
and account `add` send `connection.app_requested` (`origin: user`) with
`succeeded`, `needs_auth`, or `failed`.
- `tool-gateway.ts`: one call after the remote MCP response is parsed.
An agent's `COMPOSIO_MANAGE_CONNECTIONS` call with `add` sends one
`connection.app_requested` (`origin: agent`) per app.
`composioAddOutcomes()` parses the response once and reads each app's
own result node: connected is `succeeded`, its own sign-in link is
`needs_auth`, an error or no node is `failed`. A sibling's link never
counts; the response-wide link counts only when one app was added. An
Arcade tool call that answers with an authorization step sends
`needs_auth`.
- `connection-methods.ts`: `remoteEndpointValue()` shares the `url` →
`endpoint` → `remoteUrl` order with `remoteEndpoint()`.
- `server/package.json`: add `tldts` 7.4.10 as a direct dependency. It
is already in the lockfile through `tough-cookie`. The lockfile is left
to CI.
- Shared telemetry: typed helpers `trackConnectionAppLinked` and
`trackConnectionAppRequested`, `server_domain` on the three connection
helpers, retention class `operational_enum_count` for the new events,
and a "Connector Events" section in the telemetry README.
## New Dependency
`tldts` 7.4.10 (MIT) is added to `server/package.json`.
- Why: `server_domain` must be the registrable domain (eTLD+1), so
`mcp.example.co.uk` gives `example.co.uk` and not `co.uk`. That needs
the Public Suffix List. No runtime dependency in the repo parses it.
`new URL()` and `node:net` give only the hostname and IP detection.
Splitting on the last two labels is wrong for multi-part suffixes such
as `co.uk` and would leak or merge domains.
- Already in the tree: `tldts` 7.4.10 is in `pnpm-lock.yaml` through
`jsdom` → `tough-cookie`, a dev-only path. This PR makes it a direct
server dependency at the same version, so no new package is downloaded.
- Size: about 125 KB minified (`dist/index.cjs.min.js`), with one
dependency, `tldts-core` (same author). It bundles the suffix list, so
it does no network or file reads at run time.
- Maintenance: actively maintained (latest release this month), widely
used (it is the suffix parser in `tough-cookie`), with typed exports.
## Verification
- `pnpm exec vitest run src/services/connector-telemetry.test.ts`
(server): 65 pass, including a sibling's link, a top-level link with
several apps, and the one-app fallback. New cases cover domain reduction
(paths with tokens, userinfo, ports, uppercase, trailing dot, IDN,
`github.io` and `vercel.app` subdomains dropped), `private` for IPv4,
IPv6, loopback, `.local`, `.internal`, `.home.arpa`, `.onion`,
single-label, unknown suffix, `ftp:`, and non-strings, a payload check
that no part of a secret-bearing URL appears in any of the three events,
catalog-or-`other` for every provider, a check that every catalog slug
matches the registered `app` pattern, and the transition rule.
- `pnpm exec vitest run src/__tests__/composio-app-setup.test.ts
src/__tests__/aggregator-app-sync.test.ts` (embedded Postgres): 36 pass,
including an app named twice in one check (fails without the fix).
Composio: setup `start` sends one `needs_auth` request; refreshes while
the account is only initiated send nothing; activation sends exactly one
`app_linked` over three refreshes and a `complete`; an app saved before
a later app fails in the same check keeps its `app_linked`; an
unconfirmed `add` sends `failed`. Executor: two syncs send one
`app_linked`; a disconnect sends nothing. Agent requests: mixed per-app
results give `succeeded`, `needs_auth`, and `failed` separately.
- Red check: with the previous-status check or the domain reduction
removed, 13 of these tests fail.
- `pnpm exec vitest run src/telemetry` (shared): 46 pass, including the
real client sending `server_domain` and both new events.
- Related suites still pass: connector telemetry for tool access and the
gateway, Circleback parity, aggregator fallback, connection intents, MCP
protocol versions, MCP tasks, remote MCP connectors, remote MCP pending
(265 tests).
- `tsc --noEmit` reports no errors in the changed files.
- `tests/runner-e2e/source-sdk-public-inputs.json` is regenerated with
`node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --write`,
because it pins the shared telemetry files. `--check` and
`source-sdk-public-inputs.test.mjs` (13) pass.
- CI note: on
|
||
|
|
70d4b6524c |
fix(antigravity): offer the cloud candidate in the agent picker for linux-x64 environments (#22655)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Google Antigravity is a native Runner harness (#22591). Its profile is still pending, so only a company with an operator grant can see or run it > - A grant can name the cloud target (linux-x64), and save, Test and execution already accept it for a cloud environment > - The agent picker computed the candidate only for the local target, so a company with a valid cloud grant never saw the harness for a cloud environment > - This pull request binds the picker to the selected environment's target, in the Antigravity-owned module > - The benefit is that a granted company can pick Antigravity for the linux-x64 cloud environments that can run it, and still sees nothing anywhere else ## Linked Issues or Issue Description Refs #22591 **What happened?** `GET /api/adapters?companyId=…&environmentId=…` returned `candidateHarnesses` only when the environment target was `local`. A company with a valid linux-x64 Antigravity grant got no candidate for a Core sandbox or SSH environment. **What did you expect?** The picker offers the candidate for a linux-x64 cloud environment when the company holds a grant for that target, the same way save, Test and the executor admit it. **Steps to reproduce** 1. Set a candidate grant that names linux-x64 for a company and exact model. 2. Request the adapter list for that company with a linux-x64 sandbox environment. 3. `paperclip_runner` has no `candidateHarnesses`. ## What Changed - `antigravityCandidateForRunnerTarget` (in `antigravity-release.ts`) decides the picker candidate per environment target: - local: unchanged. - Core sandbox or SSH that is linux-x64, or the managed cloud image: only a grant that names linux-x64 and its patched closure. - plugin Runner-task environment, unknown or other platform, unavailable Computer: none. - released profile: none. - `GET /api/adapters` uses it for every resolved target. Expired or mismatched grants stay quiet; malformed grants still log one warning. - The qualification plan notes the picker rule and records, as an open decision, why plugin Runner-task environments cannot run Antigravity yet. ### Not in this PR: plugin Runner-task environments Paperclip Cloud's warm Agent Computer runs agents only as plugin Runner tasks. Antigravity cannot run there yet, and the fix is outside Core alone: - The plugin task credential contract (`environmentTaskCredentialSchema`) has no Gemini API key type. - The plugin prepares the provider launch from `launch-requirements.v1`, which carries no candidate grant. The ACPX sidecar refuses a pending profile without one. - The Cloud plugin's harness table lists only Codex, Claude and OpenCode. Kimi, Copilot and Pi do not run there either. - Antigravity Test refuses the Runner-task path. The picker therefore offers nothing for those environments until that work lands. ## Verification - Red, then green: `server/src/__tests__/adapter-routes.test.ts` "offers a cloud environment the candidate only for the company's linux-x64 grant" failed before the fix and passes after it. - New unit tests in `antigravity-release.test.ts` run the real grant resolver: cloud grant offered, other company / arm64 / Runner-task / expired / host grant refused, released profile offers none. - `npx vitest run src/__tests__/adapter-routes.test.ts src/services/native-runtime/antigravity-release.test.ts src/services/native-runtime/acpx-qualification.test.ts src/services/native-runtime/antigravity-candidate-admission.test.ts`: 98 passed. - Server `tsc --noEmit`: clean. `pnpm verify`: see the CI checks for the final revision. - Not run live: no Antigravity prompt has completed in any environment yet, and the only available Gemini key is free tier. No paid runner E2E workflow was dispatched. ## Risks - Low risk. The change is read-only catalog output. Save, Test and execution keep their strict admission checks. - A company that holds a linux-x64 grant now sees Antigravity for linux-x64 sandbox and SSH environments. Those paths already accept that grant. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use (shell, file edits) in Claude Code. ## 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 - [ ] 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> |
||
|
|
9a6e61cf36 |
fix(connectors): show Anthropic as "Anthropic (Claude)" so a Claude search finds it (#22631)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The Connectors catalog shows each provider as a card with a name and
a short description.
> - The Anthropic card shows the name "Anthropic". People who search for
"Claude" do not find it.
> - The card description says "Use Anthropic APIs with a restricted
key." This text describes an obsolete REST setup. The connector now
offers only a Claude subscription or a Claude API key.
> - This pull request changes the card name to "Anthropic (Claude)" and
the description to "Connect to Claude with Anthropic."
> - The benefit is that a search for "Claude" finds the connector, and
the description matches what the connector does.
## Linked Issues or Issue Description
No public issue exists. This is an enhancement.
**What existing behavior does this improve?**
The Anthropic card in the Connectors catalog. The card name and the card
description change.
**Subsystem affected**
UI: the Connectors catalog (Apps). Shared: the Anthropic app definition.
**Current behavior**
The Connectors catalog shows the Anthropic connector as "Anthropic" with
the description "Use Anthropic APIs with a restricted key." A search for
"claude" in the Connectors search box does not show the Anthropic card.
**Proposed behavior**
The card shows the name "Anthropic (Claude)" and the description
"Connect to Claude with Anthropic." The slug stays `anthropic`.
**Reason and benefit**
Most people know the product as Claude. They search for "Claude" and do
not find the connector. The old description refers to a "restricted
key", which the connector does not use. After this change, a search for
"Claude" finds the connector, and the description is correct.
**Breaking changes**
None. The slug, the setup links, the saved connections, and the AI
provider bindings do not change.
## What Changed
- `packages/shared/src/app-definitions/anthropic.json`: Change `name` to
"Anthropic (Claude)". Change `description` to "Connect to Claude with
Anthropic."
- `scripts/ingest-app-definitions.mjs`: Make the same change in the
generator source. A regeneration now gives the same `anthropic.json`.
- `ui/src/pages/apps/Browse.test.tsx`: Add a test. The test searches the
Connectors catalog for "claude". It checks that the Anthropic card shows
the new name and description, and that the "Connect Anthropic (Claude)"
button is present.
- `tests/ai-connections-app/app.spec.ts`: Update the opt-in browser test
to find the "Connect Anthropic (Claude)" button. The test now escapes
the provider name for the regular expression.
- `tests/runner-e2e/source-sdk-public-inputs.json`: Refresh the pinned
hash of `anthropic.json` with `node
tests/runner-e2e/source-sdk-public-inputs.mjs <sha> --write`.
## Verification
- `cd ui && npx vitest run src/pages/apps/Browse.test.tsx`: 118 passed.
The new test fails on the old definition and passes on the new
definition.
- `cd ui && npx vitest run src/pages/apps/AppsConnect.test.tsx
src/pages/apps/AppDetail.test.tsx
src/pages/apps/app-connect-policy.test.ts
src/pages/apps/app-detail/AdvancedPanel.render.test.tsx`: 369 passed.
- `npx vitest run packages/shared/src/app-definitions.test.ts
packages/shared/src/connection-instructions.test.ts
packages/shared/src/app-definitions-url.test.ts`: 59 passed.
- `node --test scripts/app-definition-overrides.test.mjs`: 3 passed.
- `cd server && npx vitest run
src/__tests__/connection-intents-service.test.ts -t "obsolete Anthropic
tool requests"`: 1 passed. Agent connection search for "Anthropic" still
finds the connector through the `anthropic` slug.
- `node scripts/ingest-app-definitions.mjs --definitions-only` in a
temporary copy: the generated `anthropic.json` is the same as the
committed file.
- `pnpm verify` asks for broad CI coverage because
`scripts/ingest-app-definitions.mjs` is a global CI input. CI supplies
that coverage.
## Risks
- Low risk. The change is display text only.
- The slug stays `anthropic`. Saved connections, setup links, and AI
provider bindings do not change.
- Connection request cards and setup headers that use the connector name
now show "Anthropic (Claude)". This is the intended result.
- The AI method labels ("Claude subscription", "Claude API key") do not
change.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude
Code with tool use (shell, file edit, test 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
- [ ] 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>
|
||
|
|
98fd412851 |
fix(apps): show readable Google Workspace action names on Review and Permissions (#22630)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Connectors let agents use outside apps. The Google Workspace
connector gives agents Gmail, Calendar, Drive, Docs, Sheets and Slides
actions.
> - Each connection has a Review tab and a Permissions tab. People
approve actions and turn actions on or off there.
> - Google Workspace actions had no human title. These tabs showed the
internal tool name, for example `gmail__get_message` and
`calendar__list_events`.
> - Users must not see internal names. Google's app reviewers will also
look at these screens.
> - This pull request gives every Google Workspace action a readable
name, such as "Gmail: Read a message", for both tool transports.
> - The benefit is that people and reviewers see what each action does,
in plain words.
## Linked Issues or Issue Description
**What happened?**
On the Review tab and the Permissions tab of a Google Workspace
connection, action rows showed internal tool names. Examples:
`gmail__get_message` in the "Review new actions" list and the action
list, and "Calendar Create Event" in the "Waiting for your OK" list.
**Expected behavior**
Each row shows a readable action name, for example "Gmail: Read a
message" or "Calendar: List events". No row shows a `service__tool` name
or a raw ID.
**Steps to reproduce**
1. Connect Google Workspace.
2. Open Connectors, then the connection, then Permissions. Look at the
action list.
3. Open Review. Look at "Review new actions" and "Waiting for your OK".
**Paperclip version or commit**
master at
|