mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 10:07:24 +01:00
e18fe61c8feb54509fb3a7e0102a14ca5bf3f213
2699
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
702368ffaf |
feat(github): graduate GitHub review bots out of experimental (#22996)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - GitHub Code Review Bot connects an agent to a dedicated GitHub App so it reviews pull requests and responds to GitHub mentions > - The feature was gated behind the default-off `enableGitHubReviewBots` experimental instance setting, hiding the catalog card, setup routes, identity links, and channel creation > - People had to find and flip an instance-level experimental switch before they could connect a GitHub review agent > - This pull request graduates GitHub review bots to a normal always-on feature, keeping `enableGitHubReviewBots` only as a deprecated compatibility key that always resolves to `true` > - The benefit is that every Paperclip instance exposes GitHub Code Review Bot setup, discovery, and management by default without requiring feature flags ## Linked Issues or Issue Description **What existing behavior does this improve?** GitHub Code Review Bot discovery, catalog visibility, setup/management routes, identity-link endpoints, and Agent Channels visibility (`enableGitHubReviewBots`). **Subsystem affected** Cross-cutting (`packages/shared`, `server/`, `ui/`, Storybook, E2E specs, docs). **Current behavior** GitHub Code Review Bot is hidden from Connectors, `connections_search`, chat-endpoint creation, identity-link confirmation, and UI setup/settings routes until an instance admin turns on **Settings → Experimental → GitHub review bots** (`enableGitHubReviewBots`). **Proposed behavior** GitHub Code Review Bot is always available as a standard feature on every instance (self-hosted and Cloud), matching AgentMail and graduated features such as Assistant connections (`enablePublicMcp`) and the AWS connector (`enableAwsConnector`). `enableGitHubReviewBots` stays in schemas and the feature catalog only as a deprecated compatibility key that always normalizes to `true`, ignores stored or Cloud-managed `false` values, and does not reject legacy `false` patches. Experimental chat providers (Slack, Discord, Microsoft Teams, Telegram, iMessage Photon, Speko) remain gated by `enableChatConnectors`. **Reason and benefit** Users can connect and manage GitHub review agents directly from Connectors without an admin enabling an experimental flag first, and Cloud stacks no longer require managed feature-flag overrides to expose GitHub review bots. **Breaking changes** No schema migration or breaking API change. Existing rows, API patches, and Cloud managed configs that still carry `enableGitHubReviewBots` continue to parse cleanly, while the effective value is always `true`. Instances that previously kept `enableGitHubReviewBots` off now display GitHub Code Review Bot in Connectors and allow authorized managers (`tools:manage_connections`) to create GitHub review bot endpoints. ## What Changed - `packages/shared`: marked `enableGitHubReviewBots` as a deprecated compatibility key in types, Zod defaults (`true`), and `INSTANCE_FEATURE_CATALOG` (`cloudDefault: true`, `selfHostedDefault: true`); updated `channelMethodEnabled` in `connector-availability.ts` so `github` is always enabled alongside `agentmail`. - `server` instance settings and Cloud staging: `normalizeExperimentalSettings` always returns `enableGitHubReviewBots: true`; `applyManagedExperimentalOverlay` and `updateExperimental` ignore retired `enableGitHubReviewBots` entries so Cloud managed configs cannot turn it off and legacy `false` patches are not rejected; removed `enableGitHubReviewBots` from `CLOUD_STAGING_EXPERIMENTAL_KEYS`. - `server` chat channels, discovery, and OpenAPI: allowed `github` in `assertChatProviderEnabledForCreate`, `assertIdentityProviderEnabled`, `assertIdentityLinkAccess`, and `connection-intents` discovery without experimental flags while keeping `enableChatConnectors` enforcement for experimental chat providers; updated the OpenAPI endpoint description. - `ui` and Storybook: removed the **GitHub review bots** Experimental settings toggle card; simplified `useChatConnectorsEnabled` and `chatProviderVisible` so `github` and `github-code-review-bot` are always visible; bypassed experimental loading wait for `provider=github` in `ChatConnectorsExperimentalGate`; made the classic Agent Detail Channels tab and `AgentChannelsPanel` empty-state copy always reflect available agent identities; updated `canEnterAppsConnect`, `Browse`, `ConnectionSetupFlow`, and `github-connections.stories.tsx`. - Tests, E2E, runner-e2e, docs, and maps: updated unit, integration, managed-overlay, runner-e2e, and Playwright E2E specs; refreshed `tests/runner-e2e/source-sdk-public-inputs.json`; updated `doc/connections/GITHUB.md`, `doc/connections/GITHUB-REVIEW-BOT.md`, and `maps/feature-map/chat-channels.md`. ## Verification - `pnpm --filter @paperclipai/shared build && pnpm --filter @paperclipai/shared typecheck && pnpm --filter @paperclipai/server typecheck && pnpm --filter @paperclipai/ui typecheck` — passed. - `node scripts/check-maps.mjs && node scripts/storybook-catalog.mjs` — passed. - `pnpm vitest run packages/shared/src/validators/instance.test.ts packages/shared/src/connector-availability.test.ts packages/shared/src/feature-catalog.test.ts server/src/__tests__/instance-settings-service.test.ts server/src/__tests__/instance-settings-managed-overlay.test.ts server/src/__tests__/instance-settings-cloud-defaults.test.ts server/src/routes/chat-channels.identity.test.ts server/src/__tests__/connection-intents-service.test.ts server/src/__tests__/chat-channels/slack-ingress-and-threads.integration.test.ts server/src/__tests__/chat-channels/github-setup-and-access.integration.test.ts` — all passed. - `pnpm vitest run ui/src/pages/apps/app-connect-policy.test.ts ui/src/components/chat/ExternallyConnectedTaskBanner.test.tsx ui/src/features/connections/ConnectionSetupFlow.slack-oauth.test.tsx` — 3 files, 62 tests passed. - `pnpm --dir tests/runner-e2e vitest run github-review-journey.test.ts` — 56 tests passed. - `pnpm verify --explain` — confirmed `tests/runner-e2e/source-sdk-public-inputs.json` is current; exited 2 for broad CI coverage (handled by required GitHub CI gates on this PR). ## Risks - Behavioral shift: instances that had `enableGitHubReviewBots` off now show GitHub Code Review Bot in Connectors and allow authorized users with `tools:manage_connections` to configure GitHub review bots. Existing permission boundaries (`tools:manage_connections`, company scoping, GitHub App OAuth/installation consent) are unchanged. - `useIssueChatBinding` now queries `/api/issues/:issueId/chat-binding` for normal tasks even when `enableChatConnectors` is off so GitHub-bound task banners remain visible; experimental chat bindings remain filtered out by `chatProviderVisible` while `enableChatConnectors` is off. - No database migration is required; stored `enableGitHubReviewBots` JSON values become inert. > 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 - Google Gemini (high reasoning) in Antigravity, with tool use (shell, file edits, 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 - [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 |
||
|
|
73369c5d46 |
feat(connections): AWS connector out of experimental; role ARN comes back from the agent (#22994)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The AWS connector lets agents work in an AWS account through AWS's hosted MCP server, with a per-connection role and short-lived credentials (#22083, #22195, #22233, #22626) > - It has been behind the `enableAwsConnector` experimental setting. It is now proven on paperclip.staging: a connection was set up end to end, and the daily QA routine's agent uses it to read private test evidence from S3 > - On the role step, the person still had to paste the role ARN back, even when their own agent created the role and reported the ARN in its live checklist > - This pull request takes the connector out of experimental and has the page pick up the role ARN from the agent, keeping the field for people who set the role up by hand > - The benefit is AWS available to everyone, with a setup that is "paste a prompt, press Test connection" ## Linked Issues or Issue Description Refs #22233 (role setup), #22626 (live agent checklist). **Subsystem affected** Connections (AWS app definition, role setup UI), instance experimental settings. **Problem or motivation** - The AWS connector works, but is hidden unless an operator turns on an experimental flag. - The setup page always showed a Role ARN field, and the person had to copy the ARN from the agent's summary into it. **Proposed solution** - Remove `experimentalFeatureKey` from the AWS app definition. `enableAwsConnector` becomes a compatibility key: stored and Cloud-managed values are ignored, and old clients' writes are accepted (same pattern as `enableMcpAggregators` and `enablePublicMcp`). - Move the Role ARN field into "Or do it by hand". When the agent finishes, take the ARN from its finish summary, accepting only an IAM role ARN for this connection's own role name (`paperclip-<connectionId>`), so a summary cannot point the connection at another role. "Test connection" then works with nothing to paste. The by-hand section opens on its own when a test fails or the agent finished without a usable ARN. **Alternatives considered** - Letting the agent save the ARN through the checklist API: more surface on a token-only route. Reading it from the finish summary needs no new API, and the test still proves the role trusts only this connection. - Removing the field entirely: people who use CloudFormation or IAM by hand still need it. ## What Changed - `packages/shared/src/app-definitions/aws.json`, `scripts/app-definition-overrides/aws.json`: no `experimentalFeatureKey`. - `packages/shared/src/feature-catalog.ts`, `validators/instance.ts`: `enableAwsConnector` is "(compatibility)", default on. - `server/src/services/instance-settings.ts`: always on; Cloud-managed values skipped; old clients' writes accepted. - `ui/src/pages/InstanceExperimentalSettings.tsx`: the AWS toggle is removed. - `ui/src/features/connections/aws-role-arn.ts` (new): the role ARN rule and `roleArnFromAgentSummary`. - `ui/src/features/connections/AwsRoleSetup.tsx`: Role ARN under "Or do it by hand", auto-filled from the agent's summary, with copy updated ("hands back the role when it finishes", "the Role ARN field below"). - `doc/connections/AWS.md`: no longer described as experimental. ## Verification - Server: `aws-mcp-connector.test.ts` (connects even with a stored `enableAwsConnector: false`), `instance-settings-managed-overlay.test.ts` (stays on with stored and Cloud-managed false; an old client's false write is accepted), `instance-settings-service.test.ts`: 68 passed. The 4 new flag tests fail against master's source (red/green). - Shared: `app-definitions.test.ts` 43 passed; `scripts/app-definition-overrides.test.mjs` 3 passed. - UI: `aws-role-arn.test.ts` 3 passed (this connection's ARN from a summary, including role paths and a trailing period; another role, a longer name, a short account and no ARN are rejected). UI typecheck clean. - Storybook (headless Playwright, current branch): the default view has no Role ARN field; "agent done" shows "Your agent's role is ready. Test the connection to finish." with Test connection enabled; "test failed" opens "Or do it by hand" with the field at its end. No page errors. - Live: the connector was set up end to end on paperclip.staging (Test connection passed) and is in daily use by the QA routine. To re-check after deploy without the flag. ## Risks - Every instance now shows the AWS connector. It was already proven on staging; access is per connection and read-only connections are capped by AWS's `ReadOnlyAccess`. - The ARN auto-fill trusts only an ARN naming this connection's own role, and Test connection still verifies AWS accepts it, so a wrong or foreign ARN cannot be saved silently. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use (shell, file edits, Storybook with headless Playwright, the live staging instance). ## 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> |
||
|
|
87fadcb108 |
feat(annotations): one-tap reactions on artifact comments (#22989)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - People review agent artifacts (plans, documents, routine descriptions, and case documents) with inline annotation comments > - Today a person must type a full reply to say "done", "checked", "looks good", or "I have a question" > - This slows down quick review feedback, and a question inside a reply does not automatically bring the assignee back > - This pull request adds four one-tap reactions to each annotation comment: Done, Check, Thumbs up, and Question > - A person's first Question reaction on an open task saves a durable wake receipt and wakes the task's assignee in a dedicated follow-up run to reply in that comment's thread (respecting chat ownership and wake rate limits) > - The benefit is fast review feedback without extra typing, while agents can read and set the same reactions through the API ## Linked Issues or Issue Description Refs #21637 (supersedes on current `master` with renumbered Drizzle migration, OpenAPI/experimental route contracts, durable wake receipts, chat ownership and rate-limit hardening, and current UI test suite) Refs #9336 (agent wake notifications for document annotation threads) Refs #9674 (agents cannot read inline document review comments) **What problem does this solve?** A reviewer cannot quickly acknowledge or question an annotation comment on an artifact. A short answer requires a typed reply, and nothing tells the agent that a person has a question about a comment. **Proposed solution** Add four fixed reactions per annotation comment: `done`, `check`, `thumbs_up`, and `question`. One tap adds a reaction and a second tap removes it. Each person or agent can add each reaction once per comment. A person's first `question` reaction on an open task commits a durable wake receipt in the same transaction and wakes the assignee once in a dedicated follow-up turn, with the comment included in the wake context. **Alternatives considered** Free-form emoji reactions. Fixed named reactions keep the API contract stable for agents and avoid storing arbitrary emoji strings on the server. ## What Changed - `packages/db`: Added `document_annotation_comment_reactions` table (`company_id`, `comment_id`, `reaction`, `actor_type`, `actor_id`, `created_at`, `removed_at`) with check constraints, cascade delete on comment deletion, and unique `(comment_id, reaction, actor_type, actor_id)` index. Generated online-compatible migration `0510_clear_speedball.sql`, refreshed Drizzle snapshot `0510_snapshot.json`, and pruned `0505_snapshot.json`. - `packages/shared`: Added `DOCUMENT_ANNOTATION_COMMENT_REACTIONS`, `DocumentAnnotationCommentReactionName`, `DocumentAnnotationCommentReactionActor`, `DocumentAnnotationCommentReactionSummary`, optional `reactions` on `DocumentAnnotationComment`, and `documentAnnotationCommentReactionSchema`. - `server`: Added `setCommentReaction` in `document-annotations.ts` using soft-delete (`removed_at`) and upsert revival (`(xmax = 0)` for `firstAdd`), and attached reaction summaries (`count`, `actors`, `reactedByMe`) to thread/comment reads. - `server` routes & contracts: Added `PUT` and `DELETE .../annotations/:threadId/comments/:commentId/reactions/:reaction` for issues, routines, and cases, registered them in `openapi.ts`, `experimental-api-metadata.ts`, and `experimental-api-paths.ts`, and logged activity (`*.document_annotation_comment_reaction_added` / `_removed`) only when a row changes. - `server` durable wake, chat ownership, rate limits & `packages/adapter-utils`: - A person's first `question` reaction on an open assigned issue inserts a recoverable `deferred_issue_execution` receipt in `agent_wakeup_requests` in the same DB transaction (`annotation-question-reaction:<id>`), passes `executionWaitRequestId` to `heartbeat.wakeup` (`reason: "issue_commented"`, `allowRunCoalescing: false`), resumes via `resumeDeferredExecutionReceipts` if immediate wake fails, and defers behind busy turns without duplicating receipts. - Recognized human annotation question reactions (`isHumanAnnotationQuestionWake`) as an independent wake cause for idle waiting agent chats while strictly enforcing chat ownership (`!conversationAgentId || conversationUserId === actorId`) across service, route, wake preflight, locked admission, and recovery queries. - Bounded distinct-comment question wakes under `issues ... FOR UPDATE` to at most 1 pending/in-flight wake per `(companyId, issueId, agentId)` and at most 3 original question receipts (`idempotency_key LIKE 'annotation-question-reaction:%'`) per `(companyId, issueId, user)` in a rolling 10-minute window. - `renderPaperclipWakePrompt` instructs the agent to answer the question in the annotation thread. - `ui`: Added four one-tap reaction buttons (`✅`, `✔️`, `👍`, `❓`) under each non-optimistic annotation comment in `DocumentAnnotationPanel` / `DocumentAnnotationPopover`, with counts, `aria-pressed`, hover tooltips naming actors, optimistic updates, client-scoped write serialization across panel/popover remounts (`WeakMap<QueryClient, Map<string, TargetReactionState>>`), live-update refetch overlay preservation, deferred invalidation while writes are pending, and updated Storybook fixture. - `docs/api` & `tests/runner-e2e`: Documented the reaction endpoints and wake bounds in `docs/api/issues.md` and `docs/api/routines.md`, and refreshed `tests/runner-e2e/source-sdk-public-inputs.json`. ## Verification - `pnpm --filter @paperclipai/db run check:migrations` and `migration-compatibility.ts`: `0510_clear_speedball.sql` classified `online_compatible`. - `pnpm --filter @paperclipai/db exec vitest run src/migration-snapshot-drift.test.ts src/migration-compatibility.test.ts`: passed (117/117). - `pnpm --filter @paperclipai/adapter-utils exec vitest run src/server-utils.test.ts -t "question reaction"`: passed. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/document-annotations-service.test.ts` (20/20, embedded Postgres — covering durable wake recovery, idle waiting-chat wake, busy-turn deferral, non-owner chat wake denial, and rolling-window + pending-backlog wake bounds across full queue admission), `src/__tests__/document-annotation-routes.test.ts` (20/20), `src/__tests__/routine-document-annotation-routes.test.ts`, `src/modules/wake-queue/application/issue-wake-admission.test.ts` (15/15), and `src/modules/wake-queue/domain/policy.test.ts`: all passed. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/openapi-routes.test.ts`: passed (59/59). - `pnpm --filter @paperclipai/ui exec vitest run src/hooks/useDocumentAnnotationMutations.test.tsx`: passed (9/9, covering optimistic updates, serialized writes across remounts, live-update refetch preservation, deferred invalidation across comments, and rendered `ThreadCard` DOM buttons/toggles). - Package typechecks (`@paperclipai/shared`, `@paperclipai/db`, `@paperclipai/adapter-utils`, `@paperclipai/server` all 7 layers, `@paperclipai/ui` + Storybook catalog): all passed. - `pnpm check:token-gates`, `node scripts/check-module-boundaries.mjs`, and `node scripts/check-test-budget.mjs`: all passed. - `node tests/runner-e2e/source-sdk-public-inputs.mjs $(git rev-parse HEAD) --check`: in sync (`inputs: 579, changed: false`). - Full-stack Playwright verification against a throwaway local server + embedded PostgreSQL: created a task, `plan` document, and annotation thread; verified invalid reaction returns `400`; clicked `thumbs_up` and `question` in the real document viewer; reloaded to prove PostgreSQL persistence; toggled `thumbs_up` off and reloaded to verify removal persisted. - PR CI on `4d892c8067`: 83/83 executed checks passing (including `ci / verify`, `ci / e2e` + all 16 E2E shards, all General/Serialized server shards, `Build`, `Typecheck + Release Registry`, `Verify Paperclip Runner`, `Superagent Security Scan`, and `Greptile Review` 5/5 with 0 unresolved threads). ## Risks - Low risk. Migration `0510_clear_speedball.sql` only creates a new table and its indexes (`online_compatible`), so running releases are unaffected. - `reactions` is optional on `DocumentAnnotationComment`, preserving backward compatibility for existing clients. - Question wakes are bounded by soft-delete revival (`firstAdd`), chat ownership enforcement, single pending/in-flight wake per `(companyId, issueId, agentId)`, and at most 3 original question wakes per `(companyId, issueId, user)` per 10-minute window. > 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 - Google Gemini (`gemini-3-pro` / Antigravity agentic coding environment with shell execution, file editing, embedded PostgreSQL, and Playwright verification), rebasing and extending prior work originally authored with Claude Opus 5.5 in #21637. ## 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: lucktastic <13757243+lucktastic@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
0f52d90993 |
fix(github): detect writes outside GitHub App installations and stop advising Refresh access (#22978)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Agents use managed GitHub App connections through the tool gateway
to open issues, post comments, and perform approved writes on GitHub
repositories.
> - A GitHub App user-to-server token can write only to repositories
inside accounts where the Paperclip GitHub App is installed; even on a
public third-party repository, GitHub rejects writes with `403 Resource
not accessible by integration`.
> - Previously, Paperclip did not check the App's installed accounts
before posting an approval card, mapped every `403 Resource not
accessible by integration` to `github_access_denied`, and told both the
user ("Manage GitHub access") and the agent ("select Refresh access") to
repair access through a flow that cannot reach third-party
organizations.
> - This wastes human approvals on doomed writes and sends operators
into a dead-end permission refresh loop.
> - This pull request adds a pre-check before posting approval cards for
managed GitHub App writes outside installed accounts, distinguishes
`github_repo_outside_app_installations` and
`github_app_installation_suspended` from `github_access_denied` across
server classification, MCP routes, and continuation delivery, and
renders accurate UI guidance without a misleading "Manage GitHub access"
link for external repositories.
> - The benefit is that unreachable external-org writes fail immediately
with actionable alternatives (post directly on GitHub, use a PAT
connection, or have an org admin install the App and refresh access),
suspended installations get explicit unsuspend guidance, and missing
repository grants on installed organizations keep the existing "Manage
GitHub access" and "Refresh access" repair flow.
## Linked Issues or Issue Description
No public issue exists. Refs #19315, #19655, #20141.
**What happened?**
When an agent requested an approval-gated GitHub write targeting a
public repository owned by an external organization where the Paperclip
GitHub App was not installed, Paperclip posted a normal approval card.
After the user approved it, GitHub returned `403 Resource not accessible
by integration`, and both the failed approval card and agent
continuation instructions advised clicking "Manage GitHub access" and
"Refresh access", which cannot grant write access to a third-party
organization.
**Expected behavior**
Paperclip should check managed GitHub App write targets against the
grant's installed accounts before posting an approval card, fail
unreachable external-organization writes cleanly without wasting an
approval, preserve suspended installations separately with unsuspend
guidance, keep incomplete webhook-invalidated snapshots on
`github_access_denied` until refreshed, and present accurate
alternatives in both the UI card and agent continuation instructions.
**Steps to reproduce**
1. Connect GitHub via the managed GitHub App installed on one
organization (for example `acme`), with an approval policy on GitHub
writes.
2. Ask an agent to run `create_issue` or `add_issue_comment` targeting a
repository in an external organization where the App is not installed
(for example `external-org/public-repo`).
3. Previously, Paperclip posted an approval card, executed it upon
approval, received `403 Resource not accessible by integration`, and
showed "GitHub access needed" / "Manage GitHub access" plus "Refresh
access" instructions.
**Paperclip version or commit**
`2d065677959b` (`master`, merged cleanly with `331e1a9fd3`)
**Deployment mode**
Local / Paperclip Cloud managed GitHub App connection
## What Changed
- `server/src/services/tool-access/github-access-discovery.ts`,
`packages/db/src/schema/tool_access.ts`,
`packages/shared/src/types/tool-access.ts`,
`packages/shared/src/validators/tool-access.ts`: Preserved suspended
installation owner logins separately in optional
`suspendedInstallationOwnerLogins` so active `installationOwnerLogins`
stays unchanged while suspended orgs are distinguishable from
uninstalled orgs. Added `github_repo_outside_app_installations` to
`ToolAccessReasonCode` and updated
`tests/runner-e2e/source-sdk-public-inputs.json`.
- `server/src/services/tool-access/github-access-errors.ts`: Added
`github_repo_outside_app_installations`,
`github_app_installation_suspended`, `isGitHubAccessErrorCode`,
`extractGitHubTarget` (`owner`+`repo`, `repository: "owner/repo"`,
`organization`/`org`, `fork_repository` destination-only handling, and
GitHub API URL fallback), `suspendedManagedGitHubOwner`,
`findUnreachableManagedGitHubTarget`,
`githubOutsideAppInstallationsInstructions`,
`githubSuspendedInstallationInstructions`, and
`githubAccessErrorInstructions`. Webhook-invalidated/incomplete
snapshots (`bindingSync` set or `installationIds` ahead of
`installationOwnerLogins` with `repositories` cleared) skip pre-check
blocking and stay on `github_access_denied` on runtime `403` until
access is refreshed.
- `server/src/services/tool-access-policy.ts` and
`server/src/services/tool-gateway.ts`: Reused the already-resolved
remote tool context from `resolveGovernedToolCall` (avoiding redundant
connection/grant lookups for non-GitHub providers), routed unreachable
approval-requiring managed GitHub writes through the canonical policy
denial path with `{ claimIdempotencyKey: false }` (inserting
`idempotencyKey: null` atomically in the single `INSERT` so retries
after installing the App are never falsely replayed), and propagated
`github_repo_outside_app_installations` /
`github_app_installation_suspended` (HTTP 403) without echoing raw
provider text into trusted instructions.
- `server/src/routes/tool-gateway.ts`,
`server/src/services/tool-action-delivery.ts`,
`server/src/services/continuation-cause.ts`,
`server/src/services/agent-task-run-telemetry.ts`: Treated all GitHub
access error codes as MCP `tools/call` `isError: true` results, routed
continuation wakes through `githubAccessErrorInstructions`, and
registered `github_repo_outside_app_installations` and
`github_app_installation_suspended` as person-owned `missing_access`
failure codes.
- `ui/src/components/IssueThreadInteractionCard.tsx` and
`ui/storybook/stories/questions-and-approvals/connection-reviews.stories.tsx`:
Added dedicated alert states for `github_repo_outside_app_installations`
("Repository outside GitHub App access", omitting dead-end "Manage
GitHub access") and `github_app_installation_suspended` ("GitHub App
installation suspended", with unsuspend guidance and "Manage GitHub
access"), using existing design tokens only, while keeping "GitHub
access needed" for `github_access_denied`.
- `doc/connections/GITHUB.md`: Documented pre-check, suspended
installation, incomplete webhook snapshot, and error classification
behavior.
- Added unit, UI component, and embedded-Postgres integration tests in
`server/src/services/tool-access/github-access-errors.test.ts`,
`server/src/__tests__/github-grant-metadata.test.ts`,
`server/src/__tests__/tool-gateway.test.ts`,
`server/src/__tests__/tool-gateway-action-approvals.test.ts`, and
`ui/src/components/IssueThreadInteractionCard.test.tsx`.
## Verification
- `pnpm vitest run
server/src/services/tool-access/github-access-errors.test.ts
server/src/services/tool-access/github-default-owner.test.ts
server/src/__tests__/github-grant-metadata.test.ts
ui/src/components/IssueThreadInteractionCard.test.tsx`: 4 files, 140/140
passed.
- `pnpm vitest run server/src/__tests__/tool-gateway.test.ts -t
"GitHub"`: 13/13 passed (covers pre-check blocking with atomic
`idempotencyKey: null`, installed-org missing-repo
`github_access_denied`, direct + MCP HTTP route `isError: true`,
approved-card runtime 403 URL classification, post-install retry,
suspended installation `github_app_installation_suspended`, and
webhook-invalidated `bindingSync` snapshot pass-through).
- `pnpm vitest run
server/src/__tests__/tool-gateway-action-approvals.test.ts -t "tells the
agent how to recover from"`: 9/9 passed (including
`github_repo_outside_app_installations` and
`github_app_installation_suspended` continuation wakes).
- `pnpm --filter @paperclipai/shared typecheck && pnpm --filter
@paperclipai/db typecheck && pnpm --filter @paperclipai/server typecheck
&& pnpm --filter @paperclipai/ui typecheck`: passed (0 errors across all
7 server layers, shared, db migration safety/compatibility, and UI +
Storybook catalog).
- `pnpm check:token-gates`: all 4 gates clean.
- `node tests/runner-e2e/source-sdk-public-inputs.mjs
|
||
|
|
38e3a71669 |
fix(connections): use Slack MCP user OAuth flow and surface OAuth errors in setup UI (#22976)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Apps and Connections let operators connect external providers
through remote MCP servers and OAuth.
> - Slack's curated `mcp-oauth` method pins Slack's bot install
endpoints (`oauth/v2/authorize` and `oauth.v2.access`) while sending
user-only scopes (`search:read.public`, `search:read.private`, etc.) in
`scope`, so Slack rejects sign-in with `"Invalid permissions
requested"`.
> - In addition, when OAuth fails or returns an error for a
customer-owned OAuth app like Slack, `ConnectionSetupFlow`'s `KeyStep`
drops `oauthError` completely, hiding the failure banner, and
`OAuthClientFields` hides the method's `guidanceMd` prerequisites.
> - This pull request switches Slack's `mcp-oauth` method to Slack's
documented MCP user OAuth endpoints (`oauth/v2_user/authorize` and
`oauth.v2.user.access`), propagates allowlisted RFC OAuth
`providerError` codes without reflecting untrusted provider prose,
displays OAuth errors and popup fallback links on `KeyStep`, and renders
setup prerequisites (`guidanceMd`) beside customer OAuth fields.
> - The benefit is that customer-owned Slack MCP sign-in succeeds
(including when resuming pre-fix drafts) and any OAuth error or Slack
MCP prerequisite is clearly shown to the user.
## Linked Issues or Issue Description
Fixes: #13935
Refs #17258
Refs #14037
Builds on #17258 (`fix/slack-mcp-user-oauth-flow`) and adds the missing
customer-OAuth error surface and setup guidance in
`ConnectionSetupFlow`.
## What Changed
- Updated `packages/shared/src/app-definitions/slack.json` and
`scripts/ingest-app-definitions.mjs` so Slack's `mcp-oauth` method uses
`https://slack.com/oauth/v2_user/authorize` and
`https://slack.com/api/oauth.v2.user.access`, and added Slack MCP
prerequisites (`User Token Scopes`, callback URL, and `Model Context
Protocol`) to `guidanceMd`.
- Updated `server/src/routes/tool-access.ts` to propagate allowlisted
RFC `providerError` codes (`normalizeOAuthProviderError`, excluding
`unrecognized`) via `provider_error` on OAuth recovery redirects and
connection-intent postMessages, while continuing to never read or
reflect untrusted `error_description` or `error_uri`.
- Updated `ui/src/features/connections/ConnectionSetupFlow.tsx` and
`ui/src/lib/oauthWindowOutcome.ts` so:
- `KeyStep` renders `oauthError` (not only `connectMutation.error`) and
the `"Open sign-in in a new tab"` fallback link when popups are blocked.
- `oauthCallbackErrorMessage` and `oauthFailureMessage` map allowlisted
`providerError` values (such as `invalid_scope`, `invalid_redirect_uri`,
`invalid_client`) and Paperclip failure codes (including
`slack_mcp_access_disabled`) to actionable Paperclip-authored copy.
- Opener popup polling reads same-origin failure `code` and
`provider_error` details from the returned callback URL.
- `OAuthClientFields` renders `method.guidanceMd` for required
customer-owned OAuth apps whose client secret is optional.
- Updated `tests/runner-e2e/source-sdk-public-inputs.json` for the
changed `@paperclipai/shared` sources.
- Updated Slack OAuth test fixtures in
`server/src/__tests__/tool-access-service.test.ts` and
`server/src/services/tool-access/oauth/client-settings.test.ts`, and
added regressions in `packages/shared/src/app-definitions.test.ts`,
`server/src/__tests__/tool-access-service.test.ts`,
`ui/src/features/connections/ConnectionSetupFlow.oauth.test.ts`, and
`ui/src/features/connections/ConnectionSetupFlow.slack-oauth.test.tsx`.
## Verification
- Shared, UI, and OAuth client-settings unit + DOM tests (95/95 passed):
- `pnpm exec vitest run packages/shared/src/app-definitions.test.ts
ui/src/features/connections/ConnectionSetupFlow.oauth.test.ts
ui/src/features/connections/ConnectionSetupFlow.slack-oauth.test.tsx
ui/src/features/connections/ConnectionSetupFlow.architecture.test.ts
server/src/services/tool-access/oauth/client-settings.test.ts`
- Embedded-Postgres server OAuth start + legacy-draft upgrade + callback
error redirect + redaction tests:
- `pnpm exec vitest run server/src/__tests__/tool-access-service.test.ts
-t "uses Slack user OAuth endpoints even for legacy drafts|starts OAuth
from|refreshes|personal|slack"` (33 passed)
- `pnpm exec vitest run
server/src/__tests__/generic-mcp-connection.test.ts -t "returns browser
denials|denied and cancelled callbacks|redacts"` (9 passed)
- Typechecks & guardrails:
- `pnpm --filter @paperclipai/shared typecheck && pnpm --filter
@paperclipai/server typecheck && pnpm --filter @paperclipai/ui
typecheck` (all passed)
- `node scripts/check-test-budget.mjs --files
packages/shared/src/app-definitions.test.ts
server/src/__tests__/tool-access-service.test.ts
server/src/services/tool-access/oauth/client-settings.test.ts
ui/src/features/connections/ConnectionSetupFlow.oauth.test.ts
ui/src/features/connections/ConnectionSetupFlow.slack-oauth.test.tsx`
(PASS)
- `pnpm verify --base
|
||
|
|
f9ee58c214 |
feat(ui): filter the Tasks list by when tasks were updated (#22965)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The Tasks page lists tasks and provides a Filters panel for status,
assignee, project, and other fields
> - The panel has no time filter, so users cannot limit the list to
tasks updated in a recent time window or date range
> - Users need a quick way to find recent work (such as the last 3 days)
or inspect a custom date range across both desktop and mobile views
> - This pull request supersedes #21822 on current `master` and adds an
"Updated" section to all Tasks filter panels (Any time, Last 24 hours,
Last 3 days, Last 7 days, Last 30 days, and Custom range), keeps the
filter in the URL, aligns "Last updated" display and sort with the
filter timestamp, and adds an optional `updatedBefore` server list bound
> - The benefit is that users can filter tasks by update time window and
share filtered links cleanly across all Tasks views
## Linked Issues or Issue Description
Refs #21822 (rebased onto current `master` with merge conflicts and
post-pruning test updates resolved).
**What existing behavior does this improve?**
The Tasks list filters (`CoordinatorTasks`, Classic `IssuesList`, and
`LegacyIssuesList`) and the company issue list API (`GET
/api/companies/:companyId/issues`). The Filters panel had status,
responsible, project, creator, and label filters, but no time filter.
**Subsystem affected**
UI (Tasks list filters, sorting, and URL sync) and Server (`GET
/api/companies/:companyId/issues`).
**Current behavior**
Users cannot limit the Tasks list to tasks updated within a recent time
window or custom date range. They must scan rows manually to find recent
activity.
**Proposed behavior**
Add an "Updated" section to the Tasks filter panels with options: Any
time (default), Last 24 hours, Last 3 days, Last 7 days, Last 30 days,
and Custom range (start and end local calendar day). Filter on the same
timestamp shown on each row (`lastActivityAt ?? lastExternalCommentAt ??
updatedAt`), count it as 1 active filter, reset it on Clear, persist it
in the page URL (`updated`, `updatedFrom`, `updatedTo`), and send an
optional `updatedBefore` upper bound to the server for custom ranges.
**Reason and benefit**
Users can narrow large task lists to recent work or a specific date
window in one click, including on phones, and share filtered URLs that
open with the same filter applied.
**Breaking changes**
None. The filter defaults to Any time, and `updatedBefore` is an
optional query parameter.
## What Changed
- `server/src/routes/issues.ts`, `server/src/services/issues.ts`,
`docs/api/issues.md`: add the optional `updatedBefore` query parameter
(`issues.updatedAt < updatedBefore`) with `400` validation matching
`updatedSince`, apply both `updatedSince` and `updatedBefore` in
`blockedInboxIssueConditions` so `attention=blocked` enforces the same
bounds, and document both parameters.
- `ui/src/api/issues.ts`: add optional `updatedBefore` to
`IssueListFilters` and `issueListSearchParams`.
- `ui/src/lib/issue-filters.ts`,
`ui/src/hooks/useIssueUpdatedFilterNow.ts`: add `updatedWithin`,
`updatedFrom`, and `updatedTo` to `IssueFilterState`, plus
`issueUpdatedWithinOptions`, `issueUpdatedWithinPatch`,
`issueUpdatedTime`, `issueUpdatedTimeRange`,
`nextIssueUpdatedFilterExpiryMs`, `issueUpdatedServerBefore`,
`readIssueUpdatedParams`, and `writeIssueUpdatedParams`. Reject
impossible calendar dates (such as `2026-02-31`), swap reversed custom
ranges, count Updated as 1 active filter, filter in `applyIssueFilters`
on the row time, and schedule a single deadline timer when a relative
window (`24h`/`3d`/`7d`/`30d`) is active so tasks age out automatically
across task and inbox lists.
- `ui/src/components/IssueUpdatedRangeInputs.tsx`,
`ui/src/components/IssueFilterPanel.tsx`,
`ui/src/components/IssueFiltersPopover.tsx`: add the "Updated" section
and native date inputs (`text-base md:text-xs` to prevent mobile Safari
focus zoom) across refreshed, streamlined, and legacy filter panels.
- `ui/src/components/IssueColumns.tsx`,
`ui/src/components/TaskList.tsx`, `ui/src/lib/issue-sort.ts`,
`DESIGN.md`: align `TaskList` "Last updated" display and sort with
`issueUpdatedTime`, compute each task's sort key once before sorting
(`O(N)` context reads), and update `DESIGN.md` to document the shared
timestamp rule.
- `ui/src/components/IssuesList.tsx`,
`ui/src/components/LegacyIssuesList.tsx`, `ui/src/pages/Issues.tsx`,
`ui/src/pages/CoordinatorTasks.tsx`: sync `updated`, `updatedFrom`, and
`updatedTo` with the page URL, queue multiple URL filter writes in the
same event so Clear resets filters together, pass `updatedBefore` for
custom ranges while preserving `archiveQueryScope` as the final
`issuesQuery.queryKey` segment for `placeholderData`, and forward
`updatedBefore` to `CoordinatorTasks` and `Issues` `searchFilters`.
- `server/src/__tests__/issue-list-updatedsince-filter-routes.test.ts`,
`ui/src/lib/issue-filters.test.ts`, `ui/src/lib/issue-sort.test.ts`,
`ui/src/lib/inbox.test.ts`,
`ui/src/components/IssueFiltersPopover.updated.test.tsx`: add
embedded-Postgres route tests for `updatedBefore` (strict bound,
combined range, `400` validation), unit tests for time windows/custom
ranges/local time zone/invalid dates/URL params/sort key caching, and
component tests across `legacy`, `streamlined`, and `refreshed` panels.
## Verification
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/issue-list-updatedsince-filter-routes.test.ts`: **1 file,
6/6 tests pass** (embedded Postgres, including `attention=blocked` with
`updatedBefore` and `updatedSince`).
- `pnpm --filter @paperclipai/server typecheck`: **pass** (0 errors
across all server layers).
- `pnpm --filter @paperclipai/ui exec vitest run
src/lib/issue-filters.test.ts src/lib/issue-sort.test.ts
src/lib/inbox.test.ts
src/components/IssueFiltersPopover.updated.test.tsx
src/pages/Issues.test.tsx`: **5 files, 94/94 tests pass** (including
fake-timer relative window expiration and a 500-task bounded
timestamp-read render-cost test).
- `pnpm --filter @paperclipai/ui typecheck`: **pass** (0 errors,
Storybook catalog clean).
- `node scripts/check-token-gates.mjs`: **pass** (all 4 token gates
clean).
- `node scripts/check-test-budget.mjs --files
server/src/__tests__/issue-list-updatedsince-filter-routes.test.ts
ui/src/lib/issue-filters.test.ts ui/src/lib/issue-sort.test.ts
ui/src/lib/inbox.test.ts
ui/src/components/IssueFiltersPopover.updated.test.tsx`: **pass** (110
nightly suites validated, 5 test files checked).
- `pnpm verify --base
|
||
|
|
fa6086facb |
fix(chat): let agents message each other in a person's chats (#22961)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Agent Chat gives each person one standing chat with each agent.
> - Agents work for the same person, so one agent often must tell
another agent something in that person's chats.
> - The shared comment boundary refused every agent message in a chat
unless the chat's own agent wrote it, and `resume`/`reopen` flags turned
chat posts into 409 conflicts.
> - So one agent could not pass a person's decision to another agent in
that person's chat. The person had to relay it by hand.
> - This pull request rebases #21232 onto current `master` and lets an
agent post in another agent's chat while it acts for the chat's person,
preserving source-task privacy, credential binding, and company
boundaries.
> - The benefit is that agents can talk with each other in the person's
chats, the chat's agent wakes and answers there, and the person sees the
exchange where it happens.
## Linked Issues or Issue Description
**Subsystem affected**
Server (comment-write boundary, comment route, chat directive,
fresh-session handoff), UI (chat transcript adapter), and documentation.
**Problem or motivation**
A person asked one agent to pass a decision to another agent. The first
agent posted the decision in the person's chat with the second agent.
Paperclip refused the post with `"Only this conversation's agent can
post agent messages"`, or returned HTTP 409 when `resume` or `reopen`
was set. The person then had to carry the message by hand.
**Proposed solution**
Rebase and supersede #21232 (whose fork branch is conflicting with
`master` and could not be pushed directly due to fork repository
permissions). Let another agent post in a chat through the ordinary
comment route when it posts from its own running, unrevoked, task-bound
run in the same company, while both the run's responsible person and the
authenticated credential's responsible person match the chat's person,
and the source task passes the company-visible privacy check. Keep every
other guard. Wake the chat's agent through the normal comment wake. Tell
the chat's agent that another agent's message is colleague input, not
the person's authority.
**Alternatives considered**
A destination parameter on `send_chat_message` would add a second
delivery path and new routing authority. The ordinary comment route
already carries attribution, comment permissions, per-run cross-task
limits, and the comment wake, so this change reuses it.
**Roadmap alignment**
This extends the shipped Agent Chat capability in `ROADMAP.md`.
Supersedes #21232 (rebased cleanly onto current `master` with expanded
isolation and handoff tests). Refs #18374, which added the comment
boundary for proactive chat messages. Refs #14143, which asks for
broader group discussions between agents and people; this change does
not add group chats.
## What Changed
- `server/src/services/issues.ts` (+20 net lines; edits remain in the
existing >1,000-line owning `addComment` write boundary rather than
splitting a shared transaction guard): allow a peer agent to post in
another agent's chat only from its own running, unrevoked, task-bound
run in the same company, when both `run.responsibleUserId` and
`actor.onBehalfOfUserId` (when set) match `current.conversationUserId`,
and when the source task passes `canActorReadIssuePrivacy(dbOrTx, {
type: "none" }, source)`. Keep proactive chat delivery and the session
fence restricted to the chat's own agent.
- `server/src/routes/issues.ts` (+0 net lines; edits remain in the
existing >1,000-line owning comment route): ignore `reopen` and `resume`
flags on conversations (`!isConversation(issue)`) because ordinary
comment wakes always reach the chat's agent.
- `server/src/services/agent-conversations.ts`: update
`AGENT_CHAT_DIRECTIVE` to state that another agent's comment is
colleague input (never the person's approval, decision, or instruction
authority) and document how to find and write to another agent's chat
for the same person.
- `server/src/services/native-runtime/native-session-handoff.ts`: label
comments authored by another agent as `other_agent` in fresh-session
history so a fresh session distinguishes them from the chat agent's own
`agent` replies.
- `ui/src/components/task-chat/transcript-adapter.ts` (+5 net lines;
edits remain in the existing >1,000-line owning transcript adapter): add
`sameTurnAgent` so `coalesceSettledTurns` and `attachSettledTurns` match
settled turns to agent bubbles by `agent.id` when both IDs are known,
falling back to display name.
- Tests:
- `server/src/__tests__/agent-chat-peer-messages.test.ts`: real
embedded-Postgres + Express route/service suite covering task-search
chat discovery, comment delivery + wake admission with `resume: true`,
run/agent/status/cancellation/proactive/credential checks, restricted
source tasks (private task, private project, private ancestor, unscoped
run), session fence + both `canReceiveCommentsFromAgents` and
`canCommentOnOtherTasks` permissions, cross-company isolation +
credential `onBehalfOfUserId` mismatch through the HTTP route, and
`buildNativeSessionHandoff` `other_agent` labeling.
- `server/src/__tests__/agent-conversations.test.ts`: verifies the new
peer-chat directive text.
- `server/src/__tests__/agent-chat-messages.test.ts`: updates the
expected denial message for an agent acting for a different person.
- `server/src/services/native-runtime/native-session-handoff.test.ts`:
preserves the fast unit suite on `master` and verifies
`renderNativeSessionHandoff` retains `author: "other_agent"` and
`authorAgentId`.
- `ui/src/components/task-chat/transcript-adapter.test.ts`: covers
ID-based turn coalescing and attachment when runs carry no display name.
- Docs and maps: updated `doc/PRODUCT.md`,
`doc/plans/2026-09-10-agent-chat.md`,
`docs/guides/agent-developer/comments-and-communication.md`, and
`maps/agent-access-map/agent-chat.md`.
## Verification
RED before fix on base `2d065677959b585065ff3fec8718156a4cf6f41d`:
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/agent-chat-peer-messages.test.ts`: **3 failed | 2 passed
(5)**:
- `delivers the message to the chat's agent as the sending agent's
message` failed with HTTP `409` (`"Issue is not resumable through
comment follow-up intent"`).
- `requires the sending agent's own running run, acting for the chat's
person` failed with `"Only this conversation's agent can post agent
messages"`.
- `refuses content from a restricted or missing source task` failed with
`"Only this conversation's agent can post agent messages"`.
GREEN after rebase and fix on head
`64ee873ad760ab0b53e2eaa161c5e83e7b1e9ad9`:
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/agent-chat-peer-messages.test.ts`: **7 passed (7)** (real
embedded Postgres + real Express `issueRoutes` + real `issueService` +
real `agentWakeupRequests` + real `buildNativeSessionHandoff`).
- `pnpm --filter @paperclipai/server exec vitest run
--no-file-parallelism src/__tests__/agent-chat-peer-messages.test.ts
src/__tests__/agent-conversations.test.ts`:
`agent-conversations.test.ts` **73 passed (73)**.
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/agent-chat-messages.test.ts
src/services/native-runtime/native-session-handoff.test.ts`: both files
**passed** (`native-session-handoff.test.ts`: **4 passed (4)**;
`agent-chat-messages.test.ts`: all tests passed).
- `pnpm --filter @paperclipai/ui exec vitest run
src/components/task-chat/transcript-adapter.test.ts`: **119 passed
(119)**.
- `pnpm --filter @paperclipai/server typecheck`: **passed**.
- `pnpm --filter @paperclipai/ui typecheck`: **passed**.
- `node scripts/check-maps.mjs`: **passed** (35 areas, 192 capability
IDs; references and contract fields valid).
- `node scripts/check-test-budget.mjs --files
server/src/__tests__/agent-chat-peer-messages.test.ts
server/src/__tests__/agent-chat-messages.test.ts
server/src/__tests__/agent-conversations.test.ts
server/src/services/native-runtime/native-session-handoff.test.ts
ui/src/components/task-chat/transcript-adapter.test.ts`: **PASS** (110
nightly suites validated, 5 test files checked).
- `pnpm verify --base
|
||
|
|
4ff7fb8dc4 |
fix(dot): renew 24h event subscriptions, request offline_access, and stop retry loops (#22975)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - OpenAI Dot connects to Paperclip through a dedicated agent OAuth
grant and a signed MCP Events subscription
(`paperclip.dot.mailbox_updated`).
> - Three compounding bugs broke paired Dot connections: (1) event
subscriptions expire after 24 hours with no renewal instructions and an
unclear "required" UI state that pushed operators to re-pair; (2) the
`/mcp/runner` 401 challenge and omitted-scope OAuth defaults requested
only `paperclip:agent` without `offline_access`, so clients received no
refresh token and broke after 15 minutes while the pairing preview still
promised ongoing access; and (3) expired or unpaired Dot runs failed as
generic `adapter_failed`, triggering an endless 15-minute automatic
recovery retry loop.
> - Operators should not have to re-pair a Dot every day, lose OAuth
access after 15 minutes, or watch failed runs loop every 15 minutes on a
missing or expired connection.
> - This pull request adds 24-hour subscription renewal instructions and
expired-subscription status/guidance, includes `offline_access` in the
Dot OAuth 401 challenge and default scopes with an accurate pairing
preview, and classifies missing or expired Dot connections as
non-retryable `configuration_incomplete` with clear operator
instructions.
> - The benefit is durable Dot OAuth and event-subscription renewal
without needless re-pairing, honest pairing previews, and clean
blocked-task guidance instead of infinite retry loops.
## Linked Issues or Issue Description
**What happened?**
1. `paperclip.dot.mailbox_updated` event subscriptions expire after 24
hours (`lifetime` in `server/src/services/public-mcp/events.ts`), but
neither the Dot setup prompt nor pairing `eventInstructions` told Dot to
resubscribe before `refreshBefore`. After 24 hours, new runs failed with
`"Dot must be paired with a verified event subscription and a completed
event test."` and `DotRunnerConnection` displayed `"Event subscription:
required"`, pushing operators to re-pair needlessly.
2. The `/mcp/runner` 401 `WWW-Authenticate` challenge
(`server/src/routes/public-mcp.ts`) and omitted-scope OAuth defaults
(`server/src/services/public-mcp/oauth.ts`) requested only
`paperclip:agent` instead of `paperclip:agent offline_access`. Clients
following the challenge or omitting `scope` received no refresh token
and failed after 15 minutes even though the pairing preview promised
`"Ongoing until revoked"`.
3. When a Dot binding was unpaired or its event subscription expired,
runs failed with generic `adapter_failed` (before `nativeExecutionInput`
was persisted), so automatic recovery (`issue_recovery_action_restored`
/ `issue_continuation_needed`) kept retrying every 15 minutes
indefinitely.
**Expected behavior**
1. Dot receives explicit instructions to renew
`paperclip.dot.mailbox_updated` before `refreshBefore` and on expiry;
when expired, Paperclip names the expiry and shows `"Event subscription:
expired"` with resubscribe guidance (no new pairing needed).
2. Dot OAuth challenges and default scopes include `offline_access` so
paired clients receive rotating refresh tokens; an explicit agent-only
request without `offline_access` displays an accurate 15-minute
non-renewable access preview.
3. Missing or expired Dot connections fail as non-retryable
`configuration_incomplete` with dedicated operator recovery notices,
moving the task to `blocked` and stopping automatic recovery loops.
**Steps to reproduce**
1. Pair an OpenAI Dot agent and omit `scope` (or follow the
`/mcp/runner` 401 `WWW-Authenticate` challenge); inspect the issued
OAuth tokens (no `refresh_token`) and the pairing preview for an
explicit `paperclip:agent` request.
2. Expire the agent's `mcp_event_subscriptions` row past 24 hours or
revoke the binding, then assign a task to the Dot agent.
3. Observe the run failing as `adapter_failed` and automatic recovery
repeatedly queuing continuation runs every 15 minutes.
**Paperclip version or commit**
Base commit `2d065677959b585065ff3fec8718156a4cf6f41d` on `master`.
## What Changed
- **24-hour event subscription renewal & expired UX**:
- Updated `pair()` `eventInstructions` in
`server/src/modules/external-agents/dot.ts` and `buildDotSetupPrompt` in
`ui/src/lib/dot-setup-prompt.ts` to instruct Dot to renew
`paperclip.dot.mailbox_updated` before `refreshBefore` and whenever
Paperclip reports expiry.
- Added `subscriptionExpired` to `bindingForAgent()`, surfaced an
explicit expired-subscription error in `snapshot()` and the Dot
environment check (`server/src/routes/agents.ts`), added
`subscriptionExpired` to the OpenAPI schema
(`server/src/routes/openapi.ts`), and updated
`ui/src/components/DotRunnerConnection.tsx` to display `"Event
subscription: expired"` with resubscribe guidance without re-pairing.
- **OAuth `offline_access` challenge, default scopes, and honest
preview**:
- Updated the `/mcp/runner` 401 `WWW-Authenticate` challenge
(`server/src/routes/public-mcp.ts`) and Dot `defaultScope` for both
`authorize` and `deviceAuthorize`
(`server/src/services/public-mcp/oauth.ts`) to use
`DOT_RUNNER_MCP_SCOPES` (`paperclip:agent offline_access`).
- Updated `describeDotPairing()`
(`server/src/services/public-mcp/oauth.ts`) to show a 15-minute
non-renewable duration when a client explicitly requests
`paperclip:agent` without `offline_access`.
- **Non-retryable recovery on expired or unpaired Dot**:
- Tagged unavailable Dot binding errors in
`server/src/modules/external-agents/dot.ts` with typed
`DotBindingUnavailableReason` (`dot_subscription_expired` /
`dot_pairing_required`) on `McpOAuthError`, mapped them to
`ConfigurationIncompleteFailure` in
`server/src/services/heartbeat/runtime-selection.ts`, and mapped
`paperclip_runner_dot_config_invalid` / `paperclip_runner_dot_disabled`
to `ConfigurationIncompleteFailure` in
`server/src/services/heartbeat/run-completion.ts`.
- Added `dot_subscription_expired` and `dot_pairing_required` notices in
`server/src/services/recovery/stranded-notice.ts`, added
`configuration_incomplete` to `NON_RETRYABLE_CONTINUATION_ERROR_CODES`,
and extended `CONFIGURATION_INCOMPLETE_ERROR_RE` in
`server/src/services/recovery/service.ts` so pre-existing legacy
`adapter_failed` Dot runs also stop looping immediately.
- Note on file size: `runtime-selection.ts`, `run-completion.ts`,
`recovery/service.ts`, `agents.ts`, and `openapi.ts` already exceeded
1,000 lines on `master`; this PR adds only narrow, owning-module changes
(2 to 31 lines each) without introducing new modules.
- **Tests**:
- Extended `server/src/__tests__/dot-runner.test.ts` with
embedded-Postgres tests covering 24h subscription expiry + resubscribe
recovery without re-pairing, OAuth 401 `offline_access` challenge +
omitted-scope refresh token rotation, and full heartbeat +
`assignedWorkSweep` + recovery classification proof that expired and
unpaired Dot runs fail as non-retryable `configuration_incomplete`
without looping.
- Extended `server/src/__tests__/dot-oauth-onboarding.test.ts` for
omitted-scope device authorization (`offlineAccess: true`) and honest
15-minute pairing preview on explicit agent-only scope.
- Added focused UI regression tests in
`ui/src/components/DotRunnerConnection.test.tsx`.
## Verification
- `pnpm exec vitest run server/src/__tests__/dot-runner.test.ts
server/src/__tests__/dot-oauth-onboarding.test.ts
server/src/__tests__/grok-bot-routine.test.ts
server/src/services/public-mcp/discovery.test.ts`: **4 files, 124 passed
(124)** (`dot-runner`: 59, `dot-oauth-onboarding`: 18,
`grok-bot-routine`: 45, `discovery`: 2).
- `pnpm exec vitest run server/src/__tests__/public-mcp.test.ts
server/src/services/antigravity-swarm.test.ts
server/src/__tests__/disposition-repair.test.ts`: **3 files, 90 passed
(90)**.
- `pnpm --filter @paperclipai/ui exec vitest run
src/components/DotRunnerConnection.test.tsx`: **1 file, 2 passed (2)**.
- `pnpm --filter @paperclipai/ui typecheck` && `pnpm --filter
@paperclipai/server typecheck` (all 7 layers): **PASS**.
- `pnpm check:token-gates`: **All 4 gates CLEAN, cliplab character in
sync**.
- `node scripts/check-test-budget.mjs --files
server/src/__tests__/dot-runner.test.ts
server/src/__tests__/dot-oauth-onboarding.test.ts
ui/src/components/DotRunnerConnection.test.tsx`: **PASS (110 nightly
suites validated, 3 test file(s) checked)**.
- `pnpm verify --base
|
||
|
|
0774cb90cd |
feat(ui): open Needs You on All assignees and keep its filters between visits (#22964)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Coordinator Inbox (Needs You, `/decisions`) shows the decisions and problems that wait for a person > - Its toolbar has agent, project, and assignee filters, plus a grouping control > - Today the page always opens on "Assigned to you", so a board member who reviews work for the whole company must select "All assignees" again on every visit > - The page also forgets the agent, project, and grouping choices after a reload or on a new visit > - This pull request opens the page on "All assignees" for a person who can see everyone's cards, and saves the toolbar choices in local storage per company and person > - The benefit is that Inbox opens on the company-wide queue by default for board members and keeps each person's filters across visits with no repeated clicks ## Linked Issues or Issue Description Supersedes #21255 (rebased onto current `master` after InboxFilter dropdown menus and Waiting/History Inbox folders landed). Related: Refs #20959, Refs #22675, Refs #22846. **What existing behavior does this improve?** The Coordinator Inbox / Needs You page (`/decisions`) and the filters in its toolbar. **Current behavior** - The page always opens on "Assigned to you". To see everyone's cards, a board member must select "All assignees" on every visit. - The agent, project, and grouping choices stay in memory only. A reload or return visit resets them. **Proposed behavior** - A person who can see everyone's cards (a board member) opens Needs You on "All assignees". A viewer still opens on "Assigned to you". - The page saves the assignee, agent, project, and grouping choices for each company and person in local storage, and restores them on reload or return visits. - A link that names a view (for example `?view=company`) still opens that view without overwriting the saved choice. - Switching to Waiting or visiting `?folder=waiting` directly loads the Waiting feed immediately without waiting for board access and keeps Waiting filters isolated from Needs You's saved filters. **Reason and benefit** Operators who review work across the whole company open Inbox many times each day. Opening on "All assignees" by default and keeping filter choices eliminates repeated clicks on every visit. **Breaking changes** None for the API or stored server data. The initial default view on Needs You changes from "Assigned to you" to "All assignees" for board members. See Risks. ## What Changed - `ui/src/lib/coordinator-attention.ts`: Add `openingCoordinatorAssignee`, `coordinatorAssigneeNeedsEveryone`, `needsYouToolbarStorageKey`, `loadNeedsYouToolbar`, `saveNeedsYouToolbar`, `DEFAULT_NEEDS_YOU_TOOLBAR`, and toolbar types. Unreadable local storage fields fall back to their defaults one field at a time. - `ui/src/hooks/useAttentionViews.ts`: Add `useAttentionEveryoneAccess` returning `{ everyone, settled }`, with `useAttentionEveryoneView` delegating to it. - `ui/src/components/InboxFilter.tsx`: Add optional `disabled` prop and forward it to the trigger button so the assignee filter stays disabled while board access is settling. - `ui/src/components/coordinator/CoordinatorNeedsYou.tsx`: - Open Needs You on the saved assignee when no `view` query parameter is present, defaulting to "All assignees" for board members and "Assigned to you" for viewers. - Always write the selected assignee's view to the URL (including `?view=mine`), and clear the `view` param on "Back to Needs You" from Archived so the saved assignee applies again. - Persist agent, project, assignee, and grouping changes by merging only the changed field onto stored preferences. A `?decisionId=` link clears filters only for that visit without erasing stored filters, and clears a kept agent even before the agent list loads. - Apply a kept agent filter only when the loaded agent list includes that agent, and keep a saved project visible in the project menu even when it has no open cards (preserving `inboxProjectOptions` for folded provider-limit obligations). - Delay the initial feed request until board access settles when the opening view requires Everyone access, avoiding a flash of "Assigned to you". Direct `?folder=waiting` visits bypass that wait and keep Waiting's agent/project filters isolated from Needs You's saved filters. - Read `viewCounts` from the active feed instead of calling `useAttentionBadge` a second time. - `ui/src/components/coordinator/CoordinatorNeedsYou.toolbar.test.tsx` and `ui/src/lib/coordinator-attention.test.ts`: Add unit and jsdom integration regression tests covering default opening views, sticky filters, viewer fallback, board-access loading gate, missing/failed agent list, empty saved project, decision links, Archived return, and Waiting folder isolation. - `tests/e2e/coordinator-inbox-views.spec.ts`: Update the local-board desktop Inbox check to assert "All assignees" on open, verify assignee and grouping persistence across navigation and reload, and confirm wrapped toolbar alignment at 1024x720. - `doc/PRODUCT.md`: Document the new default opening view and per-person/per-company saved toolbar choices. ## Verification - RED before fix (on base `2d065677959b585065ff3fec8718156a4cf6f41d`): `cd ui && npx vitest run src/components/coordinator/CoordinatorNeedsYou.toolbar.test.tsx` failed (`11 failed | 1 passed (12)`), proving Needs You opened on `me` instead of `all` and did not persist filters. - GREEN after fix: `cd ui && npx vitest run src/components/coordinator/CoordinatorNeedsYou.toolbar.test.tsx src/lib/coordinator-attention.test.ts src/hooks/useAttentionViews.test.tsx src/lib/attention-views.test.ts src/lib/attention-obligations.test.ts src/components/coordinator/InboxProviderLimit.test.tsx` -> **6 passed (6), 49 passed (49)**. - `pnpm --filter @paperclipai/ui typecheck` -> **PASS**. - `pnpm check:token-gates` -> **All 4 gates CLEAN**. - `node scripts/check-test-budget.mjs --files ui/src/components/coordinator/CoordinatorNeedsYou.toolbar.test.tsx ui/src/lib/coordinator-attention.test.ts` -> **PASS**. - `pnpm verify --base 2d065677959b585065ff3fec8718156a4cf6f41d` -> exit 2 (broad input `tests/e2e/coordinator-inbox-views.spec.ts`); PR CI supplies full coverage. - Playwright E2E (`PAPERCLIP_E2E_PORT=3255 npx playwright test --config tests/e2e/playwright.config.ts tests/e2e/coordinator-inbox-views.spec.ts`) against freshly built production UI in `local_trusted` mode -> **2 passed (desktop + mobile)**, proving Needs You opens on "All assignees", persists assignee and grouping across navigation and reload, and preserves 1024x720 wrapped toolbar alignment. ## Risks - Behavioral shift: a board member's Needs You page now opens on "All assignees" instead of "Assigned to you". The sidebar badge still counts personal ("For you") items. - Toolbar preferences are stored in browser local storage (`paperclip:needs-you-toolbar:v1:<companyId>:<userId>`), so a different browser or device starts from the default. - While board access is still loading on an Everyone-requiring opening view, the feed waits for board access before fetching and the assignee menu stays disabled; if board access fails to load, the page falls back safely to "Assigned to you". - The classic (non-Coordinator) Decisions page is unchanged. > 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 - Rebase, conflict resolution, InboxFilter/Waiting-folder integration, E2E expansion, and verification: Gemini 3.1 Pro by Google DeepMind (in Antigravity, with tool use, shell execution, Vitest, and Playwright). - Original implementation in #21255: Claude Opus 5.5 (`claude-opus-5-5`) by Anthropic. ## 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: lucktastic <13757243+lucktastic@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
9ee562fd27 |
fix(ui): fit the right side panel to its layout row so it is never clipped (#19864)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The web UI shows a resizable left sidebar, a center column, and a resizable right side panel > - On the chat page (and other layouts with a secondary sidebar), the right side panel can go past the right edge of the window > - Then the right part of the panel is cut off, and the close control is not visible > - Resizing the left sidebar or the panel does not bring it back > - This pull request makes the panel fit the space that its layout row actually has > - The benefit is that the panel always stays inside the window, at all sidebar and panel widths ## Linked Issues or Issue Description No public issue exists. I searched open PRs and issues for overflow, clipped, and right-panel problems and found no match. **What happened?** On the chat page, the right side panel went past the right edge of the window (or crushed the center thread under the 280px conversation list). At a 1280px window, with the left sidebar at 420px and a saved panel width of 624px, the right panel overflowed the available space in its layout row and clipped its right edge and close control. Dragging the panel or the sidebar did not fix it. **Expected behavior** With any sidebar and panel width, the panel stays inside the window with its close control visible, and the center column keeps a usable width. **Steps to reproduce** 1. Open the chat page for an agent and open the right side panel. 2. Drag the left sidebar to its maximum width (420px). 3. Drag the right panel to its maximum width. 4. Look at the right edge of the window or shrink the viewport to 900px: the panel overflows/clips. **Paperclip version or commit** Rebased onto `master` at `2d06567795`. ## What Changed - Cause: `PropertiesPanel` clamped its width to `window.innerWidth - 656`, assuming a fixed 236px left sidebar and no secondary sidebar in the row. The left sidebar can be up to 420px wide, and Agent Chat adds a 280px conversation list in the same row. - `ui/src/components/PropertiesPanel.tsx`: - `measureFittedPaneMax` measures the real space available for the panel: `row.getBoundingClientRect().right - main.getBoundingClientRect().left`. It preserves a 420px minimum center column down to the 260px panel minimum, and when total remaining space is below 260px, fits to that remaining space so the panel and its close control never clip past the row's right edge. - Displays `min(saved width, fitted width)` without overwriting the saved width in `localStorage`, so when space returns the panel grows back to the saved width. - Observes both the layout row and `#main-content` with `ResizeObserver` (plus window `resize`), so changes to the window, primary sidebar, or collapsible secondary rails (such as Agent Chat's collapsible conversation list) apply immediately. - Uses the fitted display width for drag start, drag clamping, and maximize restore glides, and keeps `widthRef` in sync during `pointermove` so fast `pointerup` persists the clamped drag width. - Falls back to window-based clamping when no `#main-content` exists in the row (for example, in isolated stories). - Leaves the classic fixed 320px panel unchanged. - `ui/src/components/PropertiesPanel.test.tsx`: focused regression suite covering layout-row fitting, narrow `<260px` desktop clamping, `#main-content` resize re-measurement when the row width is unchanged, drag start/clamping/persistence, and fallback without `#main-content`. ## Verification - RED before fix (on `2d06567795`): `pnpm --filter @paperclipai/ui exec vitest run src/components/PropertiesPanel.test.tsx` -> 3 failed / 1 passed (`Expected "260px", Received "624px"` and `Expected "372px", Received "624px"`). - GREEN after fix (`66adf42c82`): - `pnpm --filter @paperclipai/ui exec vitest run src/components/PropertiesPanel.test.tsx` -> 4/4 passed. - `pnpm --filter @paperclipai/ui typecheck` -> passed. - `pnpm check:token-gates` -> all 4 gates clean. - `node scripts/check-test-budget.mjs --files ui/src/components/PropertiesPanel.test.tsx` -> PASS. - Affected UI suite (217 files, 3,870 tests): 211 passed on initial parallel run and the 6 CPU-contention timed-out suites passed 6/6 (103/103 tests) on focused rerun. - Real-browser Chromium check against the built production UI (`server/ui-dist`) with left sidebar at 420px and saved panel width 624px: - Agent Chat 1280×800: `mainWidth=320`, `asideWidth=260`, `asideRight=1280`, `closeRight=1272`, `scrollWidth=1280`, saved width still `"624"`. - Agent Chat 900×800: `asideWidth=200`, `asideRight=900`, `closeRight=892`, `scrollWidth=900`. - Agent Chat 1440×900: `mainWidth=420`, `asideWidth=320`, `asideRight=1440`, `closeRight=1432`, `scrollWidth=1440`. - Task Detail 1280×800: `mainWidth=420`, `asideWidth=440`, `asideRight=1280`, `closeRight=1272`, `scrollWidth=1280`. - Task Detail 900×800: `mainWidth=220`, `asideWidth=260`, `asideRight=900`, `closeRight=892`, `scrollWidth=900`. ## Risks - Low risk. The production change is confined to `PropertiesPanel.tsx`. When the row has space, the panel width matches prior behavior. - When space is constrained, the panel narrows to fit the layout row rather than overflowing past the right edge of the window. - Layout measurement relies on `#main-content` rendered by `Layout`; when absent, the existing window-based clamp applies. ## Model Used - Original PR: Claude Opus 5.5 (`claude-opus-5-5`). - Rebase, `#main-content` ResizeObserver & drag-ref refinement, and verification: Antigravity (Google DeepMind) with shell, Vitest, and Playwright Chromium 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 - [ ] 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: Dotta <bippadotta@protonmail.com> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
64bef50be0 |
feat(cloud): add Cloud starter inference proxy, migration modal, and PostHog A/B telemetry (#22966)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Hosted Cloud onboarding currently requires new users to connect a model provider subscription or API key before their first agent can run > - That upfront credential step creates drop-off before a new user sees their first agent do real work > - We need an opt-in, managed Cloud capability that runs the first agent right away through a server-side proxy, keeps the raw provider key out of sandboxes and browsers, prompts the user to connect their own provider when starter inference runs out, and measures treatment vs. control in PostHog > - This pull request adds the default-off `enableCloudTrialInference` managed feature, the server-side OpenRouter reverse proxy with ephemeral per-run tokens, the blocking model-connection and agent-migration modal with Storybook stories, and Cloud-only PostHog A/B cohort and funnel telemetry > - The benefit is zero-friction first-agent onboarding on Cloud stacks enrolled in the experiment, with automatic migration to the user's own model provider and clean A/B observability ## Linked Issues or Issue Description **Subsystem affected** Cross-cutting (`packages/shared`, `packages/paperclip-runner`, `server/`, `ui/`) **Problem or motivation** New Cloud users must connect an AI subscription or API key before they can run their first agent. We want to A/B test letting eligible Cloud workspaces start their first agent right away with managed starter inference (OpenCode / GPT-6 Luna in Paperclip Runner) without exposing any raw upstream API key to the sandbox, database, or browser, and then guide the user to connect their own model provider when starter inference runs out. **Proposed solution** Add an experimental managed feature flag (`enableCloudTrialInference`, off by default on both Cloud and self-hosted) that: - Routes starter-inference runs through a server-side OpenRouter reverse proxy (`/api/internal/cloud-inference/v1/*`) authenticated with ephemeral per-run bearer tokens so the raw OpenRouter key never leaves server memory. - Enforces the configured starter model, detects upstream HTTP 402 exhaustion, invalidates active run tokens, reports exhaustion back to the Cloud control plane, and broadcasts `cloud_trial.status.updated` over live events. - Displays a blocking modal (`CloudTrialExhaustedModal`) when starter inference runs out while agents still depend on it, lets the user connect their own model provider, automatically migrates trial agents to that provider's default harness and model, clears incompatible provider sessions, and resumes paused work. - Stamps the `cloud-trial-inference` (`treatment` / `control`) cohort onto Cloud-only server and browser PostHog telemetry and records Cloud-only funnel events (`$feature_flag_called`, `cloud_trial.started`, `cloud_trial.key_issued`, `cloud_trial.exhausted`, `cloud_trial.modal_shown`, `cloud_trial.migrated`, `cloud_trial.migration_failed`) without affecting self-hosted telemetry. **Alternatives considered** - Passing a capped OpenRouter API key directly into the agent sandbox environment: rejected because a sandboxed agent or user could read and reuse the raw key outside Paperclip. - Showing starter dollar amounts or a usage progress bar in the UI: rejected in favor of a simple prompt asking the user to connect a model provider to continue. **Roadmap alignment** Supports hosted onboarding activation experiments while staying strictly gated behind a default-off managed feature flag (`cloudDefault: false`, `selfHostedDefault: false`) so self-hosted installs and unflagged Cloud stacks see zero behavior change. **Additional context** Paired with the private Cloud control plane key-management service PR that provisions per-stack capped OpenRouter child keys and enforces single-trial caps across accounts. ## What Changed - **Shared contracts & feature flag (`packages/shared`)**: - Added `enableCloudTrialInference` (`tier: "managed"`, `cloudDefault: false`, `selfHostedDefault: false`) to `feature-catalog.ts`, `types/instance.ts`, and `validators/instance.ts`. - Added `packages/shared/src/cloud-inference.ts` with trial status types, migration schemas, provider-to-harness migration defaults, and telemetry event validation. - Added `cloud_trial.status.updated` to `LIVE_EVENT_TYPES`, `cloudTrialInference` to `agentRuntimeConfigSchema`, and optional `cloudTrialInferenceEnabled` to `browserAnalyticsConfigSchema`. - **Paperclip Runner (`packages/paperclip-runner`)**: - Updated OpenCode server driver (`opencode-server-driver.ts`) and `configured-environment.ts` to accept `PAPERCLIP_OPENROUTER_PROXY_URL` and `PAPERCLIP_OPENROUTER_PROXY_TOKEN`. - Updated `provider-failure.ts` to classify HTTP 402 as quota exhaustion and redact `sk-or-` key material. - **Server proxy, migration, and onboarding (`server/`)**: - Added `server/src/services/cloud-trial-inference.ts` and `server/src/routes/cloud-inference.ts` for server-memory key custody, ephemeral per-run proxy tokens, model guard, HTTP 402 exhaustion handling, agent migration, blocked-run resume, and company-scoped status/migrate/telemetry routes. - Wired proxy mounting in `server/src/app.ts`, runtime env & cleanup in `heartbeat.ts` / `execution-configuration.ts`, `cloud_trial_exhausted` error code in `run-completion.ts`, and starter-agent seeding in `onboarding-seed.ts`. - **PostHog A/B telemetry (`server/`, `ui/`)**: - Resolved `cloudTrialInferenceEnabled` from `PAPERCLIP_MANAGED_CONFIG` in `cloud-posthog-config.ts` and `cloud-posthog-browser.ts`. - Stamped `cloud_trial_inference_enabled` and `$feature/cloud-trial-inference` on `workspace` groups, `cloud.workspace_started`, direct server PostHog events, and browser PostHog super-properties plus `$set_once.cloud_trial_inference_cohort`. - Added Cloud-only direct PostHog helpers (`trackCloudPostHogEvent`, `trackCloudTrialExposure`) in `server/src/telemetry.ts` and wired exposure + lifecycle funnel events (no-op on self-hosted). - **UI & Storybook (`ui/`)**: - Added `ui/src/api/cloud-inference.ts`, `CloudTrialExhaustedModal.tsx`, `CloudTrialGate.tsx`, and optional `hideCancel` / `hideProviderHeading` props on `AiProviderSetup.tsx`. - Wired `CloudTrialGate` into `Layout.tsx` / `Layout.production.tsx`, live-event invalidation into `LiveUpdatesProvider.tsx`, starter onboarding card into `OnboardingWizard.tsx`, and the experimental card into `InstanceExperimentalSettings.tsx`. - Added Storybook stories in `ui/storybook/stories/onboarding/cloud-trial-exhausted-modal.stories.tsx` covering single agent, multiple agents, migrating, migration succeeded, and migration error states. ## Verification - `pnpm --filter @paperclipai/shared build`: passed. - `pnpm --filter @paperclipai/paperclip-runner build`: passed (TypeScript, protocol manifest, Cargo release build, replay golden parity). - `pnpm --filter @paperclipai/ui typecheck` & `node scripts/storybook-catalog.mjs --check`: passed (372 files, 3484 stories). - `pnpm --filter @paperclipai/server exec tsc --noEmit`: passed. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/cloud-trial-inference.test.ts src/__tests__/cloud-posthog-config.test.ts src/__tests__/cloud-posthog-browser.test.ts src/__tests__/posthog-direct-event-shape.test.ts src/__tests__/posthog-direct-telemetry.test.ts src/__tests__/auth-routes.test.ts`: 6 files, 144/144 passed. - `pnpm --filter @paperclipai/ui exec vitest run src/lib/analytics/product-analytics.test.ts src/lib/analytics/product-analytics-events.test.ts`: 2 files, 14/14 passed. - Verified Storybook stories interactively in the embedded browser (`ExhaustedSingleAgent`, `ExhaustedMultipleAgents`, `MigrationSucceeded`) with passing `play()` interactions and zero console errors, plus live end-to-end onboarding → exhaustion → blocking modal → provider connect → agent migration flow against a mock OpenRouter server. ## Risks - **Default-off isolation**: `enableCloudTrialInference` defaults to `false` everywhere, and Cloud stacks hide `instance.experimental.*` controls by default, so existing self-hosted and unflagged Cloud stacks have zero behavior change. - **Key custody boundary**: Raw OpenRouter keys stay strictly in server process memory; sandboxes only receive short-lived per-run proxy tokens invalidated on run exit or exhaustion. - **PostHog direct contract**: Existing self-hosted collector envelopes remain unchanged; `posthog-direct-event-shape.test.ts` and `product-analytics-events.test.ts` verify event shape and ownership invariants. - **CI coverage**: Broad workspace suites and E2E lanes were not run locally and will run on PR CI. ## Model Used - Google Gemini (Antigravity agentic assistant) with code editing, terminal execution, browser verification, and test 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 - [ ] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
a336e295f6 |
feat(ui): turn Connectors into a Plugins marketplace (#22869)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents reach outside tools through connectors, which people add on the Connectors page > - That page is one long list. Each row mixes the catalog entry with its accounts, so it is hard to scan and hard to tell what is installed > - Some connectors also bring skills, but the page does not show them > - This pull request renames the page to Plugins and changes the browse view into a marketplace of small cards grouped by category. Each card opens a plugin page that holds the accounts, the skills and the tool permissions > - The benefit is a catalog that people can scan fast, with one place per connector for its accounts and its skills. Connector behavior does not change ## Linked Issues or Issue Description **Subsystem affected** UI: the Connectors (Apps catalog) pages under `ui/src/pages/apps/` and the navigation labels that point to them. **Problem or motivation** The Connectors browse page is a vertical list of large rows. A row shows the catalog entry and every account under it. People must expand rows to see what is connected. The page does not show which skills come with a connector. **Proposed solution** - Rename the page from Connectors to Plugins in the navigation, the breadcrumbs, and the page titles. A single app is still called a connector. - Remove the Browse / Review rail. The page header carries the title, a Review shortcut, and an Add menu for a custom MCP server, a pasted config, or an assistant connection. - Show the catalog as a marketplace under one "All" tab: "Most used" and "New and noteworthy" for first-party connectors, then one block per category. Composio and Arcade connectors sit in the same blocks. A block shows at most nine plugins, its total, and a "See all" link to a category page at `/apps/category/:categoryId`. - Use a compact card: logo, name, description, and one corner control. The control is a plus to connect, a check when connected, or a warning when an account needs attention. - Open a plugin page at `/apps/plugin/:pluginKey` from each card. The page has Connect in its header and groups Accounts, Connector, Skills, Tool permissions, and Information as blocks. Tool permissions shows a connected account's actions as Reads and Writes, each with a group policy and per-action policies. - Start sign-in straight from the card for a one-click connector: one OAuth method that Paperclip can start itself, with nothing to fill in and no warning to read. The success screen states who can use the connection and links to where that changes. - Search reads plugin titles only. - Keep the account list on the Installed filter. **Related pull requests** A search of open and closed pull requests for the Connectors browse page, a plugins or connectors marketplace, connector categories, and one-click sign-in found no duplicate. #22863 compresses connector logo files and does not overlap with these pages. **Alternatives considered** - An experimental setting that keeps the old page. The product owner chose to replace the page for everyone. - A new backend link between connectors and catalog skills. This pull request stays in the front end. The pairing for GitHub is a constant in `PluginSkills.tsx`. - Real categories for Composio apps. Its public catalog file has names only, so those apps are sorted by keywords in the name and the rest go to "Other". Arcade's catalog states a category, which is now carried through `AggregatorAppCatalogEntry.category`. ## What Changed - `Browse.tsx`: keeps all data loading, connect logic, and dialogs. The render now has five views: marketplace, category page, flat results grid, Installed list, and plugin page. The default source is `all`; the `paperclip` source is removed. - `PluginMarketplace.tsx` (new): `PluginTile`, `PluginShelf` (count and "See all"), `PluginCategories`, and the category labels. - `PluginsHeader.tsx` (new): page title, Review shortcut with the pending count, and the Add menu. - `PluginPageSections.tsx` (new): plugin page header, Connector row, and Information facts read from the app definition. - `PluginPermissions.tsx` (new): Reads and Writes blocks for a connected account. Saves go through `useConnectionPermissionSave` and restate agent access exactly as the per-connection page does. The four helpers it shares with that page moved from `AppDetail.tsx` to `app-detail/saved-permissions.ts` with no behavior change. - `PluginSkills.tsx` (new): lists built-in connector skills, skills that a connected server publishes, and paired catalog skills. "Add skill" calls the existing catalog install endpoint. - `plugin-categories.ts` (new): maps Arcade categories onto the Plugins categories and guesses a category from the name for apps that state none. - `features/connections/one-click-oauth.ts` (new): the one-click rule and the hand-over of the sign-in window from the card's click to the connect flow. A browser only opens that window during a click, so the card opens it and `ConnectionSetupFlow` takes it over. If the window is blocked, or the page is reloaded, the ordinary confirmation screen shows. - `ConnectionSetupFlow.tsx`: takes the handed-over window, starts sign-in when the app qualifies, and adds a "Change" link beside the stated default on the success screen. - `apps-rail.ts` (new), `AppsSidebar*.tsx`, `Layout*.tsx`: the marketplace pages have no second rail. Chat setup and detail keep theirs, and the developer pages keep one while a developer tab is on. - `ConnectorCard`: new `variant="page"` that renders the accounts as one block with "Add account" at the bottom. - `ConnectorsToolbar.tsx`: source filters first, a wider "Search plugins" field on the right. - `App.tsx`, `Layout.tsx`, `Layout.production.tsx`: new `apps/plugin/:pluginKey` and `apps/category/:categoryId` routes and reserved subpaths. - Navigation and breadcrumb labels: "Connectors" becomes "Plugins" in 19 files, and the instance plugin system becomes "System plugins". - `packages/shared/src/aggregator-app-catalog.ts`: optional `category` on a catalog entry, set from Arcade's catalog. - `ui/storybook/prototypes/ConnectorCatalogNavigation.tsx`: keeps its own five-source list so the older prototype still builds. - Tests: label renames in the specs and stories that named Connectors or "Search connectors". Seven specs now reach the custom-server setup through the Add menu. New specs: `one-click-connect`, `plugins-browse`. `apps-prosumer-mcp-flow` also covers the plugin page permissions and the success-screen link. Kept on purpose, so current flows and specs continue to work: the `Connector list` list label, `data-app-slug` and `data-connected` on each card, and the `<Verb> <App name>` button names. ## Verification - `cd ui && pnpm typecheck`: pass. - `pnpm run check:token-gates`: pass. - `cd ui && npx vitest run`: 564 files, 7,059 tests pass, 1 skipped. - `cd packages/shared && npx vitest run src/aggregator-app-catalog.test.ts`: 9 tests pass. - `PAPERCLIP_RUNNER_BINARY=/usr/bin/true npx playwright test --config tests/e2e/playwright.config.ts` for the 15 spec files under `tests/e2e/*.spec.ts` that touch the Plugins pages, plus `one-click-connect` and `plugins-browse`: all pass (3 skipped by their own conditions). - Storybook: built this branch and master and ran the interaction tests of the 253 stories in the files that mount the browse page. Master passes 230; this branch passes the same 230. The 23 that fail do so on master too. - Manual: opened Plugins, a category page, a plugin page, the Installed filter, and Review on a local instance. - Not run locally: `execution-recovery/recovery.spec.ts`, `in-feed-native/connections.spec.ts`, the runner e2e tests, and the repo-wide typecheck (it needs the Rust toolchain). A real provider sign-in was not completed; the one-click test stops at the point the flow starts. `pnpm verify` exits 2 and names CI as the source of broad coverage. ## Risks - The page changes for every user. People who know the old list must learn the new layout. The Installed filter keeps the old account list. - The instance plugin system is renamed "System plugins" in the settings navigation, breadcrumbs, and its management page, so the two areas no longer share a name. URLs and lower-case mentions of "plugin" inside sentences are unchanged. - One-click connect skips the screen that states the access default ("Connects for everyone in your organization, available to all agents") and offers Change. The default is applied without being shown first; the success screen states it and links to the permissions page. - Most Composio apps (about 1,100 of 1,583) land in "Other", and the keyword guess is sometimes wrong. Correct categories need category data in the catalog file. - The plugin page can now save action permissions. It uses the same save path and access derivation as the per-connection page and waits for all four reads before it enables the controls. The account picker for several accounts and the read-only view have no test. - The Smoke Lab developer page has no link from the browse page; it is reachable by URL. - e2e specs that this pull request did not run locally can fail on selectors. CI must confirm them. - "New and noteworthy" is a fixed list in code. The catalog has no date to sort by. - Skill pairing is a front-end constant. Nothing records that a skill came from a connector, so removing a connector does not remove the skill. - The per-connection permissions page is not restyled in this pull request. > 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 Fable 5.2 (`claude-fable-5-2`) through Claude Code, with tool use, code execution, and subagents for read-only code search. ## 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) - [ ] 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 - [ ] 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 Fable 5.2 <noreply@anthropic.com> |
||
|
|
1fa6d71171 |
fix(connections): clear run answer copies and show reconnect state when Google access ends (#22937)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents use Google Workspace through a connection, and Paperclip saves what they read in runs and tool-call records > - Google's Workspace AI Tools Addendum says Paperclip must keep no user data from a connection after access ends. #22836 and #22842 delete this content when access ends. > - A live test found two gaps. The run record still holds the run's final answer and its evidence (a Drive link, text from a Drive file). And after a person removes Paperclip at their Google Account, the connection still shows as healthy and agents still get its tools. > - This pull request clears the answer and evidence copies in the run record, and puts the connection in the existing "sign in again" state when no grant on it is active. > - The benefit is that no Google data stays in run records after deletion, and people and agents see that the connection must be signed in again. ## Linked Issues or Issue Description Refs #22836 **What happened?** 1. After `tool_connection.content_deleted`, `GET /api/heartbeat-runs/:id` still returned Google data. The data was in `resultJson.nativeResult.evidence[].ref`, `verification[].detail` and `commandOrCheck`, `completionClaim.criteria[].evidenceRefs[]`, and in `runnerProfileJson.sessionCheckpoint` (`semanticResult` and `terminalTurns[].fingerprint`, a 1.3 to 1.9 KB copy of the result). 2. After a person removed Paperclip at their Google Account, the next Google call failed with `oauth_reauthorization_required` and the deletion started with reason `provider_access_ended`. But the connection status stayed `active` with healthy status, and agents were still offered its 34 tools. **What did you expect to happen?** 1. The deletion clears the run's answer and evidence copies the same way it clears the transcript. The run keeps its status, ids, counts and hashes, so the run page still shows. 2. The connection shows that it needs a new sign-in, and agents do not get its tools until someone reconnects. **Steps to reproduce** 1. Connect Google Workspace and let an agent run that reads a Drive file and reports a link as evidence. 2. Remove the connection (or remove Paperclip at the Google Account and let the next Google call fail). 3. Wait for `tool_connection.content_deleted`. 4. Open `GET /api/heartbeat-runs/:id` for that run. See the Drive link in `resultJson.nativeResult` and in `runnerProfileJson.sessionCheckpoint`. 5. For case 2, open the connection. See status `active` and health `ok`. List the agent's tools. See the Google tools. ## What Changed - `content-cleaning.ts`: add `withoutRunAnswers`. In every `paperclip.run_result.v1` object in `result_json` (`nativeResult`, `acceptedResult`, `semanticResult.result`), each free-text string becomes the fixed text "Removed because the connection data was deleted.", so the result still passes `validatePrpStructuredRunResult`. Structural fields stay (schema, disposition, status, scope, reason codes, Paperclip ids, booleans and numbers). Agent-chosen `idempotencyKey` values become `sha256:` hashes. - `content-cleaning.ts`: add `withoutCheckpointAnswers`. It cleans the persisted checkpoint (`PersistedNativeSession`): `semanticResult` and `governedWait.result` the same way, `governedWait.sourceEvent.payload` free text, and each `terminalTurns[]` fingerprint becomes its `sha256:` hash. The recovery hash is updated when it matched. - Each store gets its own mark: `result_json.answerCopiesDeletedAt` and `sessionCheckpoint.contentDeletedAt`. A run in scope whose result or checkpoint lacks its mark is cleaned again. This fixes runs cleaned by an older build and a checkpoint rewritten later. - `paperclip-control-plane-port.ts`: a checkpoint written for a run whose result has `contentDeletedAt` is cleaned before it is saved (`checkpointProfileForRun`). - `withoutResultText` no longer blanks fields inside a run result; `withoutRunAnswers` owns those. - `withoutFreeText` moves from `run-copies.ts` to `content-cleaning.ts`; `native_run_results` gets the same treatment. - The task text stays: `contextSnapshot.paperclipIssue.description` and `runnerProfileJson.nativeExecutionInput.task` are the user's text, not Google data. - `grant-refresh.ts`: when a refresh marks a grant `needs_reauthorization` and no grant on the connection is still active, the connection gets the needs-attention state: health `error`, last error `oauth_reauthorization_required`, message "Access to this app ended. Reconnect to continue." The check and the write run under a row lock on the connection, so a reconnect that finishes at the same time is not overwritten. This applies to the Paperclip Cloud broker path and to the direct token path for personal grants. Status and the enabled flag do not change, so the app list shows "Needs attention" (not "Paused"), and a reconnect keeps the chosen tools. - `tool-gateway.ts`: agents are not offered a connection's tools (tool list, tool search, and the prompt guidance for usable connections) while the connection has a `needs_reauthorization` grant and no active grant. An action that a person already approved still finds its tool and waits for the new sign-in, as before. - Plain copy: "OAuth authorization expired/has expired" becomes "Access to this app ended. Reconnect to continue." in `connection-refresh.ts`, `grant-refresh.ts`, `catalog/failures.ts` and `oauth/client.ts`. - UI (`Connections.tsx`, `Browse.tsx`): the removal message and dialog count a connection as "available to agents" only when agents are offered its tools: it is on, it is not waiting for a new sign-in, and it is healthy, personal or a plugin. New helper `isConnectionAvailableToAgents` in `connection-identity.ts`. - Docs: the inventory and access-end notes in `doc/memory/google-connector-memory.md`, and the help page `docs/guides/board-operator/deleting-connection-data.md`. ## Verification - Red/green: `server/src/__tests__/tool-connection-content-deletion.test.ts`, "removes the run's final answer and evidence from its result and session checkpoint, and keeps the task text". It failed before the fix (the Drive link and quoted text stayed in `nativeResult`) and passes after. It also checks that a run cleaned by an older build is cleaned again, that the task text stays, that `hasAcceptedSemanticResult` is still true, and that the recovery hash matches the new checkpoint. - Red/green: `server/src/__tests__/google-managed-connection-removal.test.ts`, "shows a user/organization connection needs signing in again and stops offering its tools after Google access ends". Before the fix, health stayed `ok`. After the fix, health is `error`, the agent's tool list for the connection is empty, and after a reconnect health is `ok` and the tool comes back. - The deletion test checks that the fixture result is valid and that the cleaned `nativeResult` and checkpoint `semanticResult` still pass `validatePrpStructuredRunResult`. It rewrites a dirty checkpoint on a cleaned run and checks that the next deletion cleans it, and checks `checkpointProfileForRun`. It uses the persisted checkpoint shape (`semanticResult` is the run result, plus `governedWait`). A second phase stores a legacy run (no `answerCopiesDeletedAt` mark) whose only remaining text is `nativeResult.evidence[].ref` and the checkpoint copies, with hashed fingerprints and blank summaries. The new selection rule cleans it. - `tool-access-oauth-protocol.integration.test.ts` still passes: an approved action waits for sign-in and runs after reconnect. Its fixture now also restores the health fields when it restores the connection by hand. - `ui/src/pages/apps/connection-identity.test.ts`: the new helper does not count a connection that needs attention. - Agents in the needs-attention state: the provider-ended test lists the agent's tools before (1), after Google access ends (0) and after reconnect (1). So agents are not offered the actions of a connection in that state. - On the final code: deletion, removal and OAuth protocol files 77/77; `paperclip-control-plane-port.test.ts` 108/108; deletion and reauthorization cases in `tool-access-service.test.ts` 9/9; UI helper test 12/12. Server and UI typecheck pass. - `tsc --noEmit` for `server`: pass. - `pnpm verify`: see the comment below for the result. ## Risks - Medium-low. The tool gateway now hides a connection's tools from discovery when it has a `needs_reauthorization` grant and no active grant. Before, a personal (`per_user`) connection in that state still listed its tools, and each call failed. Execution of an already approved action is not changed. Connections with no grants, or with one active grant, do not change. - Health `error` is set for any provider whose last active grant needs a new sign-in, not only Google. This is the same state a direct token refresh already uses. - No schema change and no migration. - Not covered: the encrypted controller checkpoint rows (`native_runner_checkpoints`). The harness backup expiration removes them. This is recorded in the memory doc. ## 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> |
||
|
|
c5107f12fe |
feat(runner): flip Google Antigravity ACPX profile to qualified (#22939)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Paperclip Runner executes native ACPX providers using release-verified profiles, capability declarations, and provider packs > - Google Antigravity is wired across Runner, server routes, UI pickers, and remote provider packs, but its ACPX profile remained `qualificationStatus: "pending"` behind operator candidate grants > - The owner waived the paid-key `runner-e2e-paid` gate on 2026-11-25 so Google Antigravity can ship to staging and be tested there live > - This pull request flips the Google Antigravity ACPX profile from `pending` to `qualified` (profile revision 2), updates its capability declaration while keeping `recovery: "unverified"`, enables ordinary server/UI/pack admission without candidate grants, and updates tests and qualification docs honestly > - The benefit is that Google Antigravity enters the default `linux-x64` remote provider pack and ordinary board setup/execution flows on staging, while candidate-era v1 saved sessions are cleanly rejected and unverified recovery/paid-key evidence remains honestly labeled ## Linked Issues or Issue Description Refs #22923 Refs #22935 (merge after #22935 `fix/per-turn-harness-on-warm-environment`) **What existing behavior does this improve?** Google Antigravity native ACPX profile qualification, remote provider-pack assembly, and Paperclip Runner agent setup/admission across `packages/paperclip-runner`, `packages/adapter-utils`, `packages/adapters/codex-local`, `server`, `ui`, and `tests/runner-e2e`. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** `packages/paperclip-runner/acpx-profiles.json` declares `antigravity` at `agentProfileVersion: 1` with `qualificationStatus: "pending"`. `PAPERCLIP_RUNNER_ACPX_PROFILES` marks `antigravity.qualified = false`, remote `linux-x64` provider packs exclude Antigravity unless built with `--candidate-providers=antigravity`, and server/Runner admission requires a short-lived operator candidate grant. **Proposed behavior** Remove `qualificationStatus: "pending"` from `antigravity` and bump `agentProfileVersion` from `1` to `2` so candidate-era v1 saved state is refused permanently as `provider_state_incompatible`. Flip `PAPERCLIP_RUNNER_ACPX_PROFILES.antigravity.qualified` to `true`, mark `ACPX_CAPABILITY_PROFILES.antigravity` as `qualified` with `models: "explicit-provider-verified"` while keeping `recovery: "unverified"`, require an explicit provider model in config builders and server validation, and admit qualified Antigravity through the ordinary ACPX path without candidate grants. **Reason and benefit** Unblocks staging deployment and live testing of Google Antigravity under the 2026-11-25 owner waiver of `runner-e2e-paid`, including default `linux-x64` provider pack inclusion (local `darwin-arm64` continues to use `paperclipai runtime setup antigravity`). **Breaking changes** Any candidate-era v1 Google Antigravity saved session state is intentionally refused as `provider_state_incompatible` due to the `agentProfileVersion` bump (`1` -> `2`). ## What Changed - **Runner profile & generated contracts**: - `packages/paperclip-runner/acpx-profiles.json`: removed `qualificationStatus: "pending"` on `antigravity` and bumped `agentProfileVersion` from `1` to `2`. - Regenerated `packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts` and `packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs` (`qualification_pending: false`). - `packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts`: set `antigravity.qualification` to `"qualified"` and `models` to `"explicit-provider-verified"` when released; kept `recovery: "unverified"` (never claiming `session-load` without live proof). - **Adapter utils & config builder**: - `packages/adapter-utils/src/paperclip-runner-permissions.ts`: flipped `PAPERCLIP_RUNNER_ACPX_PROFILES.antigravity.qualified` to `true`. - `packages/adapters/codex-local/src/ui/build-config.ts`: added `"antigravity"` to the explicit-provider-model validation check. - **Server admission & routes**: - `server/src/services/native-runtime/provider-profile.ts`: added `antigravity: null` to `DEFAULT_ACPX_RUNNER_MODELS`, included `antigravity` in explicit-model-required and qualified ACPX checks. - `server/src/services/native-runtime/acpx-qualification.ts`: short-circuited `resolveAntigravityCandidateAdmission` to return `undefined` once `qualificationStatus !== "pending"`. - `server/src/routes/agents.ts`: allowed qualified `antigravity` without `experimental.enableNativeRunner` (matching Copilot and UI rules), preserved empty model on provisional setup draft transitions, and allowed `setupOnly` draft creation before model selection. - **Tests**: - Updated Runner TS/Rust tests (`profile-compatibility.test.ts`, `candidate-provider-pack.test.mjs`, `release-provider-pack.test.mjs`, `antigravity-provider-pack-smoke.test.mjs`, `candidate-admission*.test.ts`, `antigravity-models.test.ts`, `acpx-runtime-sidecar.test.ts`, `runner-core` Rust unit/integration tests). - Updated `@paperclipai/adapter-utils`, `@paperclipai/adapter-codex-local`, `@paperclipai/server`, `@paperclipai/ui`, and `tests/runner-e2e` (`catalog.test.ts`, `controller-rolling-deployment.test.ts`) tests for qualified Antigravity behavior. - **Documentation & maps**: - `doc/plans/2026-11-22-antigravity-qualification.md`, `doc/plans/2026-11-25-antigravity-cloud-rollout.md`, and `packages/paperclip-runner/README.md`: recorded the 2026-11-25 owner waiver of `runner-e2e-paid` for staging verification while keeping all `NOT RUN` paid-key rows honestly marked `NOT RUN` / deferred. - Minimal in-place accuracy updates in `maps/feature-map/instance-operations.md` and `maps/agent-access-map/instance-operations.md` (`node scripts/check-maps.mjs` passing). ## Verification - `pnpm --filter @paperclipai/paperclip-runner build` (TS + Rust release binary + `check:acpx-profiles`, `generate-antigravity-models --check`, `check:protocol-types`, capability/attestation/traceability/replay-golden checks) — passed. - `pnpm --filter @paperclipai/paperclip-runner test:typescript:prep` (468 tests) and focused Runner Vitest suites (`acpx-runtime-sidecar.test.ts` 127/127, `antigravity-models.test.ts` 22/22, `candidate-admission*.test.ts`, `profile-compatibility.test.ts`, `runnerd-codex-transport-antigravity-release.test.ts`, pack script tests) — passed. - Rust tests in `packages/paperclip-runner/runner`: `cargo fmt --all -- --check`, `paperclip_process_table` (3/3), `paperclip_runner_core --lib` (670/670, skipping macOS-incompatible `task_memory::tests::monitor_*`), `paperclip-runnerd` bin tests (11/11), and `acpx_provider_resolutions` (12/12) — passed. - `packages/adapter-utils` (`paperclip-runner-permissions.test.ts` 50/50) and `packages/adapters/codex-local` (`build-config.test.ts` 64/64) — passed. - `scripts/__tests__/prepare-runner-release-image.test.mjs`, `node scripts/check-maps.mjs`, and `node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --check` — passed. - Server suites: `adapter-routes.test.ts` (36/36), `registry.test.ts` (67/67), `agent-adapter-validation-routes.test.ts` (`Antigravity|YAML`), `antigravity-connection-probe.test.ts`, `antigravity-save-refusal.test.ts`, `antigravity-release.test.ts` (10/10), `acpx-qualification.test.ts` (39/39), `antigravity-candidate-admission.test.ts`, `remote-provider-pack.test.ts` (60/60), `native-session-executor.test.ts` (`Antigravity|provider pack`), `plugin-runner-credentials.test.ts`, `plugin-runner-credential-names.test.ts`, `antigravity-plugin-task-credential-writeback.test.ts` — passed. - CLI (`runtime.test.ts`, `runtime-setup.test.ts` 15/15), UI (6 Antigravity/setup suites 58/58 + `AgentConfigForm.render.test.tsx`), and `tests/runner-e2e` (`catalog.test.ts`, `controller-rolling-deployment.test.ts`, `antigravity-qualification.test.ts`, `eval-gateway-drain.test.ts`, and 690+ unit files) — passed. - Typechecks: `@paperclipai/adapter-utils`, `@paperclipai/adapter-codex-local`, `@paperclipai/paperclip-runner`, `@paperclipai/server` (all 7 layers), `@paperclipai/ui`, and `pnpm test:e2e:runner:typecheck` — all passed. - **Not run locally**: Live paid-key `runner-e2e` suites (`antigravity-qualification`, `antigravity-model-lineup`, `antigravity-agent-journey`) were waived by the owner on 2026-11-25 to enable staging testing and remain marked `NOT RUN` / deferred in the qualification docs. Rust `task_memory::tests::monitor_*` cgroup tests require Linux CI. ## Risks - **Merge sequencing**: Merge after #22935 (`fix/per-turn-harness-on-warm-environment`) so warm environments keep Antigravity on its per-turn lifecycle. - **Deferred live qualification**: Paid-key `antigravity-qualification` cells have not run in CI; `ACPX_CAPABILITY_PROFILES.antigravity.recovery` remains `"unverified"` until live multi-turn and restart continuity are verified on staging. - **Profile version reset**: Bumping `agentProfileVersion` from `1` to `2` intentionally rejects any candidate-era v1 saved sessions as `provider_state_incompatible`; new runs start a clean replacement conversation in the same workspace. - **Remote provider pack targets**: Remote provider packs intentionally target `linux-x64` (Core Docker images and Linux sandboxes); local `darwin-arm64` hosts continue to provision via `paperclipai runtime setup antigravity`. > 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 - 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> |
||
|
|
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> |
||
|
|
e04efb9734 |
feat(antigravity): allow plugin Runner-task and remote Google sign-in targets once released (#22940)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The native Runner executes Google Antigravity on local hosts, Core managed sandboxes, and plugin Runner-task environments such as Paperclip Computer. > - Before this change, Paperclip refused Google sign-in on all remote targets even after release, returned an unavailable error when testing Antigravity on plugin Runner-task environments, and did not wire remote refresh-token write-back on Core sandboxes or released Antigravity profile resolution. > - Paperclip Cloud needs Google Antigravity to run with both Gemini API keys and Google sign-in on both plugin Runner-task environments and Core managed sandboxes once the profile flips from pending to qualified. > - This pull request lifts the released-state remote sign-in refusal, wires plugin Runner-task probing and released profile resolution for Antigravity, adds Core sandbox remote sign-in write-back and checkpoint exclusion, and keeps pending-release candidate grants restricted to API-key non-plugin targets. > - The benefit is that flipping the Antigravity profile from pending to qualified immediately enables picker selection, agent creation/save, Test probing, and execution with either Gemini API keys or Google sign-in on both plugin Runner-task environments and Core sandboxes. ## Linked Issues or Issue Description - Refs #22923 (Item 6 of `doc/plans/2026-11-25-antigravity-cloud-rollout.md`, gaps G6 and G7) - Pairs with #22933 (Item 2: Antigravity sign-in task credential and plugin write-back) and #22935 (Item 3: keep per-turn-only harnesses per-turn on warm environments) - Refs #22930 (Item 1: Gemini API key task credential for plugin Runners) ## What Changed - **Remote Google sign-in policy & credential preparation (`antigravity-connection-policy.ts`, `antigravity-runner-credentials.ts`)**: - Allow both Gemini API key and Google sign-in on remote targets in `antigravityConnectionRefusal` once `releasePending` is `false`, while keeping `lifecycleMode: "warm"` refused and keeping pending-release candidate grants API-key-only on non-plugin remote targets. - Strip all `GOOGLE_*` and non-selected `GEMINI_*` variables (plus `PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET`) in `prepareAntigravityRunnerCredentials`, enforce `antigravityConnectionRefusal` using `antigravityReleasePending()`, and pass pure sanitized sign-in JSON on remote runs (without local `/swarm` metadata). - **Core sandbox remote sign-in write-back & checkpoint safety (`native-credential-store.ts`, `native-session-executor.ts`, `antigravity-runner-credentials.ts`)**: - Extend `createNativeCredentialStore` to support `provider: "antigravity"` (`acp_token.json` and `auth-refresh.json`) over local and remote command runners. - Add optional `runtimeStore` support to `antigravityCredentialTurn` and wire it in `native-session-executor.ts` for Core remote sandboxes so rotated Google refresh tokens copy back after process retirement and remote credential files are scrubbed. - Exclude `antigravity-home/antigravity-acp/{acp_token.json,auth-refresh.json,auth-refresh.json.tmp,logs}` from remote ACPX session checkpoints. - Enforce `antigravityConnectionRefusal` in `preparePluginTaskOwner` and reject pending `pluginTask` execution in `assertAntigravityExecutionAdmissible` (defense in depth). - **Plugin Runner-task probing, released profile resolution & agent save/setup (`provider-profile.ts`, `plugin-runner-probe.ts`, `antigravity-connection-probe.ts`, `agent-environment-test.ts`, `agents.ts`, `NewAgentSetup.tsx`)**: - Add `antigravity` to `DEFAULT_ACPX_RUNNER_MODELS` and the qualified ACPX agent allowlist in `provider-profile.ts`, requiring an explicit non-placeholder model ID and checking `antigravityReleasePending()`. - Wire `testAntigravityConnection` to delegate plugin Runner-task targets to `probePluginRunnerEnvironment` instead of returning `"Google Antigravity is unavailable in this hosting environment."`, and update `probePluginRunnerEnvironment` to run `admissionOnly: true` for Antigravity with either Gemini API key or Google sign-in once released, returning `antigravity_metadata_verified`. - Allow Core sandbox/SSH `probeAntigravityExecutionTarget` for Google sign-in once released, preserve `antigravity_remote_runtime_ready` warn status in `agent-environment-test.ts` and `NewAgentSetup.tsx`. - Allow released Antigravity creation without `enableNativeRunner`, allow released remote sign-in account model discovery on the tenant host, and refuse pending plugin targets even when a `linux-x64` candidate grant exists. - Note on existing >1,000-line files: edits to `server/src/routes/agents.ts` and `server/src/services/native-runtime/native-session-executor.ts` are minimal wiring at existing Antigravity call sites (+12 and +26 net lines). - **Tests**: - Updated `antigravity-runner-credentials.test.ts`, `native-credential-store.test.ts`, `antigravity-save-refusal.test.ts`, `antigravity-connection-probe.test.ts`, `antigravity-release.test.ts`, `adapter-routes.test.ts`, `agent-runner-selection.test.ts`, `agent-environment-test-status.test.ts`, `native-session-executor.test.ts`, and `ui/src/lib/cloud-harness-policy.test.ts`. - Added `server/src/services/native-runtime/plugin-runner-probe-antigravity.test.ts`. ## Verification - Local Vitest (all passed against a released-profile fixture as well as the real pending profile): - `pnpm --filter @paperclipai/server exec vitest run src/services/native-runtime/antigravity-runner-credentials.test.ts src/services/native-runtime/native-credential-store.test.ts src/services/native-runtime/antigravity-release.test.ts src/services/native-runtime/plugin-runner-probe-antigravity.test.ts src/services/native-runtime/plugin-runner-probe-runner-mismatch.test.ts src/services/native-runtime/plugin-runner-credentials.test.ts src/__tests__/antigravity-connection-probe.test.ts src/__tests__/antigravity-save-refusal.test.ts src/__tests__/antigravity-managed-subscription.test.ts src/__tests__/antigravity-plugin-task-credential-writeback.test.ts src/services/agent-runner-selection.test.ts src/services/agent-environment-test-status.test.ts` (12 files, 425 tests passed) - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/adapter-routes.test.ts --hookTimeout=60000` (36 passed) - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/agent-test-environment-routes.test.ts --hookTimeout=60000 -t "passes the selected Antigravity"` (1 passed) - `pnpm --filter @paperclipai/server exec vitest run src/services/native-runtime/native-session-executor.test.ts -t "projects the selected Antigravity subscription"` (2 passed) - `pnpm --filter @paperclipai/ui exec vitest run src/lib/cloud-harness-policy.test.ts` (36 passed) - Typechecks: - `pnpm --filter @paperclipai/server exec tsc --noEmit` (passed) - `pnpm --filter @paperclipai/ui typecheck` (passed) - Not run live: the real Antigravity profile remains `pending` until Item 8; live staging verification on Paperclip Computer and Core managed sandboxes is covered by Item 12. ## Risks - Low risk while the Antigravity profile remains `pending`: all new remote sign-in and plugin Runner-task paths stay gated behind `!antigravityReleasePending()`, and pending-release candidate behavior remains unchanged (and tighter on plugin environments). - Once Item 8 flips the profile to qualified, released Antigravity agents on Core sandboxes and plugin Runner-task environments will use the paths tested here; live acceptance on staging is gated by Items 9–12. > 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 - 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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
585f58aeba |
fix(workspaces): stop retrying copy-back when a Git operation is in progress (#22844)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - After a native run on a remote sandbox, Paperclip copies the workspace back to durable storage during finalization. > - The archive capture guard refuses to save a workspace that still has an unfinished Git operation (such as an unresolved merge or rebase) with `remote_workspace_archive_git_operation_in_progress`. > - Finalization treated that refusal as transient and retried three times, then saved-work recovery treated it as a transient provider error and retried across its 30-minute window. > - Nothing finishes or aborts a Git operation in an idle or stopped sandbox between automatic retries, so every retry fails the same way while delaying user action. > - This pull request stops both finalization and saved-work recovery on the first unfinished Git operation refusal, keeps the accepted result and retained sandbox intact, and hands the task to the board with a clear Retry path. > - The benefit is that tasks stop immediately with an accurate explanation instead of burning futile retries, and Retry saves the files and applies the accepted result without another provider turn once the Git operation is resolved. ## Linked Issues or Issue Description Refs #20678 (stop retrying copy-back on a full sandbox disk), Refs #20758 (stop re-saving a retained sandbox whose disk is still full), Refs #20819 (apply a saved accepted result on Retry instead of a new turn) **What happened?** When an agent finishes a native turn and leaves an unresolved Git operation (such as a conflicted merge or rebase) in the remote sandbox, workspace archive capture fails with `remote_workspace_archive_git_operation_in_progress: finish or abort the Git operation before saving the workspace`. Finalization retried copy-back 3 times before ending with `native_workspace_sync_out_retry_exhausted` ("Saving the workspace failed after 3 attempts"), and saved-work recovery then classified the refusal as `export_interrupted` / `retry_transient` (`provider_error`) and retried across its 30-minute window. **Expected behavior** Paperclip recognizes `remote_workspace_archive_git_operation_in_progress` on the first failure in both finalization and saved-work recovery. It stops automatic retries immediately, keeps the accepted result linked and the retained sandbox intact, names the unfinished Git operation clearly, and exposes the task's Retry action so the user can save the files and apply the accepted result without another agent turn once the Git operation is finished or aborted. **Steps to reproduce** 1. Run a native task on a remote sandbox and leave a conflicted `git merge` open before the turn finishes with an accepted result. 2. Observe copy-back fail with `remote_workspace_archive_git_operation_in_progress: finish or abort the Git operation before saving the workspace`. 3. Before this change, finalization stays in `retryable_failure` for 3 attempts, and saved-work recovery schedules automatic transient retries with cause `provider_error`. ## What Changed - `server/src/services/native-runtime/native-workspace-failure.ts`: export `REMOTE_WORKSPACE_GIT_OPERATION_IN_PROGRESS_CODE`, `isWorkspaceGitOperationInProgress()`, and a unified `workspaceSaveRestCause()` helper (`"sandbox_disk_full" | "git_operation_in_progress" | null`) used by both finalization and saved-work recovery as the single source of truth. - `server/src/services/native-runtime/native-run-finalizer.ts`: use `workspaceSaveRestCause(failureCause)` to exhaust workspace copy-back on Attempt 1 for both `sandbox_disk_full` and `git_operation_in_progress` (keeping `failureCode = native_workspace_sync_out_retry_exhausted`, accepted result linked, retained sandbox lease preserved, and no new wakeups), and emit truthful run error and recovery `nextAction` text without "after 3 attempts" or "Finalization retry budget exhausted." (net file size change: +1 line). - `server/src/services/workspace-recovery.ts` & `server/src/services/system-recovery-state.ts`: use `workspaceSaveRestCause(error)` so retained saved-work recovery stops on Attempt 1 for `git_operation_in_progress` with `export_interrupted`, `retryClass: "user_action_required"`, and cause `{ label: "git_operation_in_progress", code: null, status: null }`, keeping unsaved files protected and showing plain-language `exhaustedSystemRecoveryAction` guidance. - `ui/src/components/WorkspaceExportRecovery.tsx`: treat `git_operation_in_progress` alongside `sandbox_disk_full` as a user-action save rest so the panel surfaces clear status copy and leaves the task's Retry control available. - Added red-to-green regression tests across `server/src/services/native-runtime/native-workspace-failure.test.ts` (including producer-to-detector redaction round-trip through `remoteWorkspaceCaptureFailureMessage` and `remoteWorkspaceFailureCause`), `server/src/services/native-runtime/native-run-finalizer-telemetry.test.ts`, `server/src/services/workspace-recovery-warm-handoff.test.ts`, and `ui/src/components/WorkspaceExportRecovery.control.test.tsx`. ## Verification - **Red before production edits**: - Finalizer (`recordNativeFinalizationFailure`), saved-work recovery (`recoverRetainedWorkspace`), `exhaustedSystemRecoveryAction`, and `WorkspaceExportRecovery` regressions all failed against unfixed production code (finalizer stayed `retryable_failure`, recovery stayed `scheduled`/`retry_transient`/`provider_error`, UI rendered `Recover saved files` button instead of handing off to task Retry). - **Green at `6b18fd8b63`** (rebased cleanly onto `origin/master` `ba63f4f8b2`): - `npx tsc --noEmit -p server/tsconfig.json`: pass. - `pnpm --filter @paperclipai/ui typecheck`: pass. - `cd server && npx vitest run src/services/native-runtime/native-workspace-failure.test.ts src/services/native-runtime/native-run-finalizer-telemetry.test.ts src/services/workspace-recovery-warm-handoff.test.ts`: 89/89 pass (covers producer->detector redaction round-trip, Attempt-1 stop for git-op-in-progress and disk-full, preserved accepted result, transient `remote_workspace_archive_changed` & `ECONNRESET` still retrying, permanent errors still permanent, Retry-while-open resting immediately, and Retry-after-resolved saving and applying the accepted result without a new turn). - `cd ui && npx vitest run src/components/WorkspaceExportRecovery.control.test.tsx`: 51/51 pass. - Required GitHub CI supplies the full repo-wide suite on `6b18fd8b63`. - Environment: local macOS worktree with embedded Postgres fixture for server integration tests and jsdom for UI tests; live Daytona sandbox acceptance was not run locally. ## Risks - Low risk. The terminal finalization code (`native_workspace_sync_out_retry_exhausted`) and recovery schema (`export_interrupted` / `user_action_required` with closed-label cause `git_operation_in_progress`) reuse existing persisted contracts and DB indexes without any migration. - Upgrade safety: a run persisted in `retryable_failure` by an earlier release with `remote_workspace_archive_git_operation_in_progress` stops on its next attempt; an earlier release reading the new `git_operation_in_progress` cause passes schema validation and displays its generic Retry copy. - Does not modify `remote-workspace-snapshot-archive.ts` or relax any Git archive safety guard. Unsaved files remain protected in the retained sandbox and never trigger the `source_unavailable` fallback. ## Model Used - Gemini 4 Neon (High) (`gemini-4-neon-high`), Google, via Antigravity with tool use (shell, file edits, 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 - [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 |
||
|
|
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> |
||
|
|
5347c01de5 |
fix(antigravity): give the follow-up after a swarm its result, and say each thing once in the thread (#22893)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - A task thread shows an agent's runs, and each new run starts from the task's saved context > - A second hands-on check of Google Antigravity `/swarm` runs (after #22886) still found gaps > - The first ordinary follow-up after a swarm was slow: it spent minutes searching the instance's run logs to learn what the swarm did > - The thread also showed each file twice, lost the "Swarm" note after a reload, and read "Swarm Swarm started…" > - This pull request gives the next run the swarm's result in its opening context and removes the prompt's pointer to run records, and it fixes the four thread problems > - The benefit is a faster follow-up after a swarm and a thread that says each thing once ## Linked Issues or Issue Description Refs #22886 **What happened?** 1. After a finished `/swarm`, the ordinary follow-up "append three to v1.txt" took 4 min 6 s (an earlier one took 5.5 min). The agent read the server's raw run log of the swarm run with about 20 shell commands, searched the instance folder, and listed processes. Other follow-ups took 41 s and 105 s. 2. Each file showed twice: the run's file card, and a second card under the final reply (from the reply's "Download: v1.txt" link). This also happened on the ordinary follow-up. 3. The "Swarm" note on the user's message showed while live, but not after a page reload. 4. Swarm activity rows read "Swarm Swarm started in the task folder…", with the word twice. **Expected behavior** 1. The follow-up starts with what the swarm did, so it has no reason to search for it. 2. Each file shows once per run, as the run's file card. 3. The "Swarm" note shows after a reload. 4. A swarm row reads its sentence once. **Steps to reproduce** 1. Send `/swarm Create v1.txt containing "one" and v2.txt containing "two", one helper per file, then verify both.` to a Google Antigravity agent. 2. When it finishes, look at the files and the activity rows, then reload the page. 3. Send the ordinary follow-up `append three to v1.txt` and time it. 4. Put another task in Plan mode and send `/swarm do something`. ## What Changed - Follow-up context (cause of item 1). A swarm runs in the Antigravity CLI, and an ordinary turn runs on the registry route. The ordinary route cannot reopen the swarm's conversation, so the Runner refuses the saved session and the server starts a fresh one. That fresh session gets the same wake prompt as any other turn. Before this change, its only record of the swarm was the task continuation summary, and that summary listed no files ("No file or route paths were detected"; the path detector only knows repository folders such as `server/`). It also gave three run ids and said "Detailed shell/tool commands remain in the run log and transcript." The agent followed that line: its first searches matched the swarm's run id, and an earlier follow-up searched for `transcript*.jsonl` files. An ordinary follow-up after an ordinary turn gets the same prompt, but it resumes its own conversation, so it already knows what it did. - `issue-continuation-summary.ts` (shared by every harness): a new "Files Delivered" section lists, by name, the files the run handed in as deliverables (applied or duplicate receipts), newest first, and keeps earlier runs' names. These names are kept apart from "Files / Routes Touched", because a deliverable's name is not always its path. The run's own checks are listed, read through the shared accepted-result reader. The summary contains no run ids, adapter names or log locations. The "Commands Run" section is removed: it held only the run id and the log pointer. The summary reaches the next turn through the existing mechanism (the wake prompt's "Issue continuation summary" and the continuation evidence). - Server: `GET /issues/:id/recent-comments` and both chat bootstrap routes now add the swarm marker with the same shared rule (`withAntigravitySwarmMarkers`) as the comment list, the single comment and the POST response. A cold task page reads this recent window, so the marker was missing after a reload. - UI: a reply does not show a second card for a file that its own run already shows as a file card. The reply text and its links do not change. A later run's reply that links the same file still shows the file. - UI: a swarm progress row shows its sentence without the "Swarm" label. A failed or stopped row keeps its label and marker. Live and settled rows use the same rule. Not changed, by investigation: - "Check passed cat v1.txt one\nthree" and "verifier check on swarm board #6": the model wrote both strings in its `paperclip_finish` call. The Runner's first record of the result already holds the literal backslash and the board number, so this is model text, not Paperclip's presentation. - The inline "Download: v1.txt" links in the reply are the model's own words, so they stay. - No read-confinement policy is added. The agent finds the instance folder from its working directory, not from the prompt. - A refused send still shows its reason twice (inline under the composer and as a toast). Each attempt to remove the toast missed a send path, which could leave a refusal with no visible reason. A repeated reason is better than a missing one, so this PR does not change the toast. ## Verification - Red/green `server/src/__tests__/issue-continuation-summary.test.ts`: a swarm's accepted result (from a live run, with ids replaced) is built into the summary and rendered into the follow-up's wake prompt. The prompt contains the hand-in summary, `v1.txt` and `v2.txt` under "Files Delivered" (one with a different content reference and a duplicate receipt), and the verifier check. A later run lists its own delivered file first. A full path list still takes the latest run's path first. It contains no run id, "run log", "transcript", attachment path, digest or adapter name. A later run keeps the files listed. This failed before the change. - Red/green `server/src/__tests__/issue-chat-bootstrap-routes.test.ts` (embedded Postgres): for an ordinary task and a conversation, a recorded `/swarm` request carries `nativeCommand: "swarm"` on `GET /comments`, `GET /comments/:id`, `GET /recent-comments`, `GET /issues/:ref/chat-bootstrap` and the batch chat bootstrap. It failed on `recent-comments` before the change. - Red/green `ui/src/components/TaskChatThread.test.tsx`: a reply that links its run's file shows no second card; a later run's reply still shows it. It failed before the change. - Red/green `ui/src/components/task-chat/antigravity-thread.test.tsx`: the live swarm fixture's rows read "Swarm started in the task folder…" (no doubled word), and live rows equal settled rows. - Focused suites: UI `TaskChatThread.test.tsx` and `src/components/task-chat` (925 tests), server bootstrap routes (19 tests) and continuation summary (7 tests) pass. UI and server typechecks pass. - Not proved without a live run: that the next follow-up after a swarm is faster. The tests prove the opening input; the agent's behavior with that input needs a live Antigravity run. ## Risks - The continuation summary wording changes for every harness that runs on a task (every adapter whose finished run refreshes the summary, not only Antigravity): no run ids, no adapter name, no "Commands Run" section, and a new "Files Delivered" section when the run registered deliverables. Nothing in the code parses those lines. Older saved summaries keep their text until the next run refreshes them. - One extra indexed activity-log query for each recent-comments or chat-bootstrap read (the same query the comment list already runs). The bootstrap budget test still passes. - The second-card rule matches only a file whose card belongs to the same run as the reply. ## 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> |
||
|
|
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>
|
||
|
|
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) | ||
|
|
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 |
||
|
|
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> |
||
|
|
1a57a2abec |
refactor(ui): prune 36 thin mocked jsdom UI tests and consolidate replay masking checks (#22834)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The `@paperclipai/ui` Vitest suite includes 182 component/page test files, many of which boot full jsdom and React module graphs with 6–19 mocks solely to verify wiring that Playwright E2E specs already exercise end-to-end. > - Auth, security, permission, privacy, error-boundary, pure-logic `ui/src/lib` / `ui/src/hooks` / `ui/src/api` suites, and complex interactive client logic must stay intact. > - This pull request removes 36 thin mocked/E2E-duplicated/synthetic-perf jsdom component/page test files (-17,367 LOC), consolidates 7 tiny single-purpose session-replay privacy tests into `ui/src/lib/analytics/replay-masking.test.tsx` with 100% of assertions preserved, converts 2 pure-logic suites from `jsdom` to `node`, and updates affected feature/agent-access map references plus `.github/workflows/ci-incremental-qualification.yml`. > - The benefit is cutting full `@paperclipai/ui` suite execution to ~36s locally (~42s fewer raw test seconds and 42 fewer jsdom boots) while preserving 100% of auth, permission, privacy, and pure-logic coverage. ## Linked Issues or Issue Description Refs #22804 **What existing behavior does this improve?** UI Vitest runtime, signal-to-noise ratio, and jsdom boot overhead in `ui/src/`. **Subsystem affected** ui/ — React + Vite board UI **Current behavior** 36 thin mocked/E2E-duplicated/synthetic-perf jsdom component/page tests and 7 tiny single-purpose session-replay privacy files pay full jsdom+React boot overhead on every UI PR despite duplicate Playwright E2E and pure-logic coverage. **Proposed behavior** Remove the 36 thin mocked/E2E-duplicated jsdom suites, consolidate the 7 session-replay privacy suites into `ui/src/lib/analytics/replay-masking.test.tsx`, convert 2 pure-logic suites to `node`, and keep all maps and incremental qualification checks aligned. ## What Changed - **Deleted 36 thin mocked / E2E-duplicated / synthetic-perf jsdom suites (`-17,367 LOC`):** - Mocked chat-adapter setup & banner wiring (4 files), heavily mocked `Inbox.test.tsx` shell (1 file, 19 mocks; pure logic in `ui/src/lib/inbox.test.ts` and browser E2E retained), synthetic jsdom microbenchmarks & mocked app/browse/connector wiring (9 files), mocked AI-connection & agent-config wiring (6 files), and thin presentational/mocked component wiring (16 files). - **Consolidated 7 tiny session-replay privacy tests into `ui/src/lib/analytics/replay-masking.test.tsx` (498 LOC, 100% of assertions preserved):** `AccountQuotaPanels`, `WebhookFields`, `AiConnectionPicker`, `AiConnectionAccountControls`, `AiConnectionIdentity`, `AiConnectionPoolRunDetails`, and `AgentSetupPrompt`. - **Converted 2 pure-logic suites from `jsdom` to `node` (0 assertions lost):** `ui/src/pages/Secrets.test.ts` and `ui/src/pages/tools/ProfilesTab.test.ts`. - **Retained 100% of high-signal UI coverage:** all 276 `ui/src/lib`, 56 `ui/src/hooks`, 19 `ui/src/context`, 26 `ui/src/api`, 14 `ui/src/adapters`, 6 `ui/src/plugins`, all 94 pure-logic `node` component/page tests, and all auth/security/permission/privacy/error-boundary/complex-interactive suites. - **Updated references:** updated the 7 affected `maps/` files to reference current canonical suites and updated `.github/workflows/ci-incremental-qualification.yml` (`ui/src/pages/Inbox.tsx → Inbox.test.tsx` to `ui/src/pages/Auth.tsx → Auth.test.tsx`). ## Verification - `pnpm exec vitest run --project @paperclipai/ui` — **557/557 files, 6,916 passed | 1 skipped (`36.14s`)** - `pnpm --filter @paperclipai/ui typecheck` — **PASS (0 errors)** - `node scripts/storybook-catalog.mjs` — **PASS (371 files, 3,480 stories)** - `node scripts/check-maps.mjs` — **PASS (35 areas, 192 capability IDs)** - `node scripts/check-query-error-rendering.mjs` — **PASS (0 findings)** - `node scripts/check-test-budget.mjs --base origin/master` — **PASS (588 nightly suites validated)** - Verified `.github/workflows/ci-incremental-qualification.yml` `qualify_test_selection` check locally (`Auth.tsx → Auth.test.tsx`) — **PASS** ## Risks - Low risk: zero production UI code changed; all auth, permission, privacy, replay-masking, error-boundary, pure-logic, and Playwright E2E behavioral checks remain intact. ## Model Used - Google Gemini (Antigravity agent swarm) with extended reasoning, tool use, and local test execution (`e2e-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 |
||
|
|
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 |
||
|
|
137bd29531 |
fix(heartbeat): a provider usage-limit hold applies only to the account that reported it (#22800)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents run on an AI connection: a connected provider account (a
connection grant), or the host's own account
> - When a provider reports an exhausted allowance, Paperclip holds new
work for that agent until the reported reset (`provider_limit_wait`),
and schedules one recheck at the reset
> - The hold was keyed by agent only. After a user connected a
different, working account and the agent moved to it, every new run was
still cancelled with the old account's reset time. A reply on the task
did not recheck the wait. Only a manual "Check now" got work moving
> - A usage limit belongs to the account that reported it. When that
account is gone or replaced, the hold must be gone too, and waiting work
must start without manual repair
> - The banner's "Check now" button also failed here. It answered 409
"Issue has no scheduled monitor", because the button calls the
issue-monitor route and this task has a scheduled retry, not a monitor
> - This pull request scopes the hold to the credential, releases
waiting work when the account changes or is revoked, makes a reply
recheck the wait, and makes "Check now" recheck a waiting retry
> - The benefit is that fixing the account fixes the task. The same
account stays held, so an exhausted account is not called again
## Linked Issues or Issue Description
No public issue exists. Bug report:
**What happened?**
An agent's connected provider account ran out of quota, with a reset
about six days away. Paperclip held the agent's work ("Pool exhausted",
runs cancelled with `provider_limit_wait`, one recheck scheduled 24
hours later). The user then connected a different, paid account. The old
account became revoked, and the agent was moved to the new account. The
agent's connection test passed. But every new run was still cancelled at
once with the old account's reset time. A new comment on the task did
not start a run, although the composer said "Sending a reply wakes the
agent now". The task stayed in `todo`. Pressing "Check now" on the "Pool
exhausted" banner did nothing: `POST /issues/:id/monitor/check-now`
answered 409, because the task has no issue monitor
(`triggerIssueMonitor` throws "Issue has no scheduled monitor").
**Expected behavior**
A limit reported on account A must not hold a run that uses account B.
When account A is revoked, removed or replaced on the agent, the hold
stops. Work that waited on it starts promptly. While the agent still
uses account A, the hold stays, with the plain message. A reply does
what the composer says.
**Steps to reproduce**
1. Bind an agent to connected account A.
2. Let a run fail with `quota_exhausted` and a reported reset days away.
The next wake is cancelled with `provider_limit_wait`, and a recheck is
scheduled about 24 hours later.
3. Connect account B and move the agent to it, or revoke account A.
4. Wake the agent on the task, or reply on the task. Before this change,
the run is cancelled with `provider_limit_wait` again, and the reply
does not recheck.
## What Changed
- `server/src/services/native-runtime/native-startup-retry.ts`: limit
evidence now comes only from runs on the checked credential. A run
records its grant in `contextSnapshot.aiConnection.grantId`. A run with
no recorded grant used the host's own account. Evidence from a revoked,
expired or removed grant never applies. A later success on another
account no longer clears this account's limit. New helpers resolve the
credential of an agent's next run from its saved binding
(`shared`/`delegated`: the bound grant; `responsible_user`: that user's
default grants for the provider).
- `server/src/services/heartbeat/provider-limit-wait.ts`: the
pre-dispatch hold checks the agent's current credential, and records the
limited grant on `providerLimitWait.grantId`. New
`releaseProviderLimitWaits` makes waiting usage-limit retries due now,
notifies retry dispatch in the same transaction, and logs
`issue.scheduled_retry_retry_now` activity with `source:
provider_limit_recheck`. The recheck goes through normal dispatch. It
reads saved evidence only, so a still-limited account is held again with
no provider work.
- `server/src/services/agent-configuration.ts`: a change to an agent's
`runtimeConfig.aiConnection` releases that agent's waits, in the same
transaction as the change.
- `server/src/services/tool-access/connections/grants.ts` and
`removal.ts`: revoking or removing an account releases the waits whose
limit was reported on it (after commit, best effort; the evidence rule
alone already stops the hold).
- `server/src/services/heartbeat/queue.ts`: a user's wake that is folded
into a usage wait (comment or other user wake) rechecks it at once.
Agent and system wakes keep the scheduled time, so they cannot loop.
- `server/src/routes/issues.ts`: `POST /issues/:id/monitor/check-now` on
a task with no monitor and a waiting scheduled retry now starts that
retry (the same path as "retry now"). The retry rechecks availability
before any work. It logs `issue.scheduled_retry_retry_now` with `source:
monitor_check_now`. If the check cannot start, the 409 has a plain
reason. Tasks with a monitor keep the old behavior.
- `ui/src/components/IssueMonitorBanner.tsx`: for a usage wait, the
composer now says "Sending a reply checks usage again now. The agent
starts as soon as usage is available." The banner says work also resumes
when the agent uses a different account.
- Upgrade safety: holds are derived from saved run evidence, so old
holds resolve by the new rule after deploy. A wait saved before this
change has no `grantId`; the release finds its account from the run that
reported the limit (`providerLimitWait.sourceRunId`).
- `queue.ts` was already far above 1,000 lines. This change adds one
small helper beside the two coalescing paths that need it, rather than a
new module for one call.
## Verification
- Red first: the new tests ran against the `origin/master` sources and 6
of them failed (hold on account A blocked a run on account B; revoked
account still held; rebind and reply did not release the 24-hour retry;
old-shape release missing). The shared-account test passed on master
too, as intended: it guards that the hold stays.
- Check now: a route test covers a `todo` task with no monitor and a
waiting retry (200, the retry starts, the monitor path is not called,
activity is logged) and a refused check (409 with a plain reason). An
integration test covers the exact saved state: `todo` task, cancelled
`provider_limit_wait` run, `scheduled_retry` successor, agent already
moved to another account. "Check now" starts the retry, and it is not
held again.
- Green: `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/heartbeat-provider-limit-wait.test.ts
src/services/native-runtime/native-provider-limit-cooldown.integration.test.ts
src/services/native-runtime/native-startup-retry.integration.test.ts`
passes (58 tests), and
`src/__tests__/issue-execution-policy-routes.test.ts`.
- UI: `ui/src/components/IssueMonitorBanner.test.tsx` passes (2 tests).
- `npx tsc --noEmit -p server` passes.
- `pnpm verify` exited 2 ("broader verification required"; its graph
worker was killed under machine load). I ran the focused checks above
and rely on required CI for broad coverage.
- New tests cover: same account still held with the plain message; agent
moved to another connected account starts; revoked account stops
holding; rebind releases the pending retry and logs activity; a wait
saved in the old shape is released when its account is revoked, and not
when another account is revoked; two agents on one account both stay
held when one agent moves away; a user reply rechecks at once and holds
again (keeping the reply) while the account is still limited, and an
agent's comment does not.
- Not run live: I did not reproduce this on a running instance. I read
the evidence from a local instance where the bug happened, and I did not
change that instance. Live confirmation of the release after deploy is
still to do.
## Risks
- Behavior change: a limit no longer carries over to a different
account. If two accounts share one provider-side quota, the agent can
make one call on the new account before that account gets its own hold.
- A `responsible_user` agent whose user has no saved default cannot
resolve its account before the run. In that case only the revoked-grant
rule applies, as before.
- A user reply on a still-limited account makes one cancelled recheck
run and a new scheduled wait. This is cheap (no workspace or provider
work) and is bounded by the number of user replies.
- No schema change and no new background worker.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, agentic coding 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
- [ ] 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>
|
||
|
|
d128e2db6f |
feat(analytics): track onboarding step failures and agent chat sends (#22814)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - On Paperclip Cloud, browser analytics tracks onboarding wizard steps through PostHog > - Today, failures on the model connection step and user replies in the onboarding chat emit no browser analytics events > - Without those events, teams cannot tell whether users hit an error during model setup or leave after the automatic welcome greeting > - This pull request adds structured enum-only browser events for onboarding step failures and agent chat message sends > - The benefit is clear visibility into onboarding drop-offs and post-launch engagement without sending customer text or raw error strings ## Linked Issues or Issue Description **What existing behavior does this improve?** Cloud browser onboarding analytics in `ui/src/lib/analytics/onboarding-analytics.ts`, `ui/src/components/OnboardingWizard.tsx`, `ui/src/pages/AgentChat.tsx`, and `ui/src/pages/IssueDetail.tsx`. **Subsystem affected** ui/ — React + Vite board UI **Current behavior** The onboarding wizard emits `onboarding_opened`, `onboarding_step_viewed`, `onboarding_step_completed`, and `onboarding_dismissed`. Failures during API key storage, subscription sign-in, adapter environment tests, agent creation, and onboarding welcome greeting emit no failure event. Onboarding also launches into Agent Chat (where server-side `task.created` skips conversations), so user replies after launch emit no distinct engagement event. **Proposed behavior** Add two browser analytics events on Cloud (inert on self-hosted installs and gated on existing analytics consent): - `onboarding_step_failed` with bounded `step`, `reason`, sanitized `provider`, and `method` fields. - `agent_chat_message_sent` with `surface` (`onboarding_chat` or `agent_chat`). **Reason and benefit** Teams can separate actual setup errors (bad API key, failed OAuth, failed environment test, failed greeting) from user abandonment on the model-connect step, and separate passive greeting-only visits from active replies in Agent Chat. **Breaking changes** None. Existing event names and properties are unchanged, and no `PAPERCLIP_EVENTS` server event names are captured from the browser. ## What Changed - Add `onboarding_step_failed` (`captureOnboardingStepFailed`) and `agent_chat_message_sent` (`captureAgentChatMessageSent`) to `ui/src/lib/analytics/onboarding-analytics.ts`, with bounded reason enums and provider slug validation. - Wire `captureOnboardingStepFailed` into the failure paths in `ui/src/components/OnboardingWizard.tsx` (API key save, subscription sign-in failure, environment test failure, agent creation failure, chat launch failure) and `ui/src/pages/AgentChat.tsx` (onboarding greeting failure). - Wire `captureAgentChatMessageSent` in `ui/src/pages/IssueDetail.tsx` when a user posts a comment to an Agent Chat conversation. - Add unit tests in `ui/src/lib/analytics/onboarding-analytics.test.tsx` covering failure capture, unsafe provider filtering, and chat surface tagging. ## Verification - `pnpm --filter @paperclipai/ui typecheck` — passed after rebase onto `origin/master`. - `pnpm --filter @paperclipai/ui exec vitest run src/lib/analytics/onboarding-analytics.test.tsx src/lib/analytics/product-analytics-events.test.ts src/lib/analytics/product-analytics.test.ts` — 3 test files, 28/28 tests passed (including the event-ownership test proving no `PAPERCLIP_EVENTS` are captured from UI code). - Prior to rebase, ran the full `ui/src/lib/analytics/` directory — 7 test files, 255/255 tests passed. ## Risks - Low risk. Browser product analytics stays completely inert on self-hosted installs and respects Cloud consent gates. No message content, raw error text, credentials, or PII leave the browser. > 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 - Google Gemini (high reasoning mode) in Antigravity, with file editing, git, and shell tool use. ## 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 |
||
|
|
9502a12252 |
design(ui): show Antigravity swarm events in a task (inventory and stories) (#22803)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - A task can run Google's Antigravity CLI as a swarm: one coordinator and several helpers work in the task folder. > - Today the task shows the swarm only as a flat list of step titles, such as "Started helper writer-a". > - Antigravity's own Swarm UI shows a goal, threads, helpers with their state and current step, and a numbered message board. > - We did not know which of these facts Paperclip actually receives. We also did not know how the facts could look in a task. > - This pull request records what Paperclip receives, from real recorded runs. It also adds design-proposal stories that show three directions, built only from those facts. > - The benefit is a grounded design decision. The next step is clear: read the swarm's own files and fix one driver bug. ## Linked Issues or Issue Description Refs #22731 (the swarm driver). Refs #22733 (the `/swarm` command). **Subsystem affected** Task chat and run activity for the Antigravity CLI swarm turn (`packages/paperclip-runner/src/drivers/acpx/antigravity-swarm-*`). Storybook design proposals. **Problem or motivation** During a swarm, the user sees only short step titles. The user cannot see which helper does what, which helper is blocked, or how far the work is. Antigravity's own UI shows all of this. We did not know if Paperclip can get the same data. **Proposed solution** Record the evidence in `doc/plans/2026-11-24-antigravity-swarm-events.md`. The short answer is "partly": - Over ACP, Paperclip gets everything the coordinator does. This includes the swarm title, each helper's name and brief, a goal/task/thread plan, the coordinator's own messages, finish and stop, and one usage total. - Paperclip gets nothing that the helpers do over ACP. The results of `swarm status` and `read_board` are not forwarded. - The CLI writes the board, the roster and each helper's steps as structured JSON in its private `--gemini-dir`. Paperclip already owns that folder. Then show three directions in Storybook, built only from this data. Each element has a tag that tells where its data comes from. **Alternatives considered** - Show only the facts that come over ACP. With this choice, the task cannot show helper state, the current step or helper messages. - Ask the coordinator to post summaries. This costs tokens, and the summaries are still prose. - Wait for Google to expose more. The work graph, a Google review state and the narrator overview are not available today. The stories show them only in a variant with the label "Needs Google". **Additional context** The inventory found a driver bug. The coordinator writes its plan to `<state-dir>/antigravity-cli/brain/<session>/.system_generated/swarm/plan.json`, because its built-in `swarm_pane` skill tells it to. `antigravityOutsideChange` thinks that this is a write outside the task folder, so the driver stops the swarm. This happened in 3 of 7 recorded swarm turns. This PR does not fix it. The fix is to exempt that one folder, with a red/green test. ## What Changed - `doc/plans/2026-11-24-antigravity-swarm-events.md`: the inventory. It lists each element of the reference UI, where the data comes from (ACP update, tool input or file), samples, timing and risk. - `ui/storybook/fixtures/antigravity-swarm.sample.json`: redacted events from one real 4-helper swarm run (CLI 1.5.15, auto mode, isolated state folder). It holds the ACP updates and the swarm files. - `ui/storybook/support/design-proposals/swarm-activity/`: turns the fixture into a view model (helpers, state, current step, messages, progress, threads) and adds the state variants. It also holds presentational parts that reuse shipped primitives: the runner header, the activity group, the subagent tree, `StatusGlyph`, `Tabs`, `Badge` and `Button`. - `ui/storybook/stories/design-proposals/swarm-activity.stories.tsx` (`design-antigravity-swarm-activity`) adds 16 stories: - Compare directions. - Today: the step titles from the current driver. - Direction 1 · Inline helpers (running, helper blocked, finished). - Direction 2 · Swarm panel (overview, helpers, messages). - Direction 3 · Summary card (collapsed, expanded). - The states starting, running, helper blocked, stopping, stopped, failed, not available and finished. - A long swarm with 11 helpers and 25 messages. - Narrow width. - "Would need Google to expose". - No product code changes. Nothing is connected to live pages. ## Verification - `node scripts/storybook-catalog.mjs --check`: pass (371 files, 3480 stories). - `node --test scripts/storybook-catalog.test.mjs`: 13/13 pass. - `node scripts/check-token-gates.mjs`: all gates clean. - `cd ui && npx tsc -p tsconfig.json --noEmit`: 0 errors. - `pnpm build-storybook`: pass. A headless Playwright run opened each of the 16 stories in light and dark at 1440 px (390 px for the narrow story) and saved screenshots. No story scrolls horizontally. - Evidence for the inventory: 7 recorded swarm turns and 1 new real run, about 3 minutes and 180k coordinator tokens. ## Risks - Low risk. The change adds Storybook files and a doc only. - The design depends on files that the CLI does not document. A future reader must pin to the CLI version and use fixture tests. The doc tells this. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use (shell, file edit, headless browser). ## 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 - [ ] I have added or updated tests where applicable (stories only; no behavior to test) - [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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
6385c171fa |
fix(connections): show only the privacy policy link in the Google Workspace picker (#22795)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The built-in Google Workspace connection lets agents use Gmail, Drive (with Docs, Sheets and Slides) and Calendar > - Before Google consent, the user chooses services in the "Connect Google Workspace" picker > - On Nov 17, #21998 added two text sections to this picker: "What agents can do" and "How your data is used" > - On Nov 24, the owner decided that this screen must show only the privacy policy link and no other explanatory text > - This pull request removes the two sections and keeps the privacy policy link directly under the service rows > - The benefit is a short picker that matches the owner decision, for new setup and reconnect, in the Apps flow and the task-hosted flow ## Linked Issues or Issue Description Refs #22634 **What happened?** The "Connect Google Workspace" picker shows a "What agents can do" section and a "How your data is used" section with bullet sentences. The text changes with the selected services. The owner does not want this text on the screen. **What did you expect to happen?** The picker shows the title, the three service rows (each with its access select and switch), the privacy policy link, and Cancel / Continue. It shows no other explanatory text for any selection. **Steps to reproduce** 1. Open Apps and start a Google Workspace connection, or reconnect an existing one. 2. Look at the service picker with all services on, with read only, and with one service on. 3. See the two text sections above the footer. ## What Changed - `ui/src/features/connections/GoogleWorkspaceServices.tsx`: remove the `DataUseDisclosure` block. The privacy policy link ("Read our privacy policy, including how we meet Google's Limited Use requirements", `https://paperclip.ing/privacy`, new tab) now sits directly under the service rows for every selection, including no selection. The "Select at least one service to continue." status stays. The screen-reader description "Choose the Google services to connect." stays. The URL constant `GOOGLE_WORKSPACE_PRIVACY_POLICY_URL` moves into this file. - `ui/src/features/connections/googleWorkspaceDisclosure.ts`: deleted. Nothing else used the copy builder. - `ui/src/features/connections/GoogleWorkspaceServices.test.tsx` (new; the earlier suite was removed in #22729): for all services read & write, all read only, one service, and no service, the dialog has no section headings, no lists and none of the removed sentences. The link has its text, href and new-tab target. The dialog keeps its accessible description. Continue stays disabled with no service and submits the chosen services. - `ui/storybook/stories/connection-setup/google-workspace-services.stories.tsx`: the `ProductionPickerReadOnly` play test now checks that the removed text is absent and the link is present. - Docs: `doc/memory/google-connector-memory.md` gets a dated Nov 24 decision row with the risk. `doc/plans/2026-11-17-google-workspace-production-checklist.md` no longer claims a disclosure in the picker. `doc/plans/2026-11-17-google-workspace-code-fixes.md` item 1 records the removal. The dialog now contains, from top to bottom: the Google Workspace logo and the title "Connect Google Workspace"; Gmail, Drive ("Docs, Sheets, and Slides") and Calendar rows, each with a "Read only / Read & write" select and a switch; the privacy policy link; the empty-selection status (only with no service on); Cancel and Continue in one footer row. ## Verification - Red first: the new test ran against the old picker and 4 of 5 tests failed (removed text present; link absent with no selection). After the change all 5 pass. - `cd ui && npx vitest run src/features/connections src/pages/apps/AppDetail.test.tsx src/pages/apps/AppsConnect.test.tsx`: 8 files, 55 tests pass. - `cd ui && node ../scripts/run-tsc.mjs -b`: no errors. - `node scripts/check-token-gates.mjs`: all gates clean. `node scripts/check-test-budget.mjs --files ui/src/features/connections/GoogleWorkspaceServices.test.tsx`: pass. `node scripts/storybook-catalog.mjs`: pass. - `pnpm verify` exits 2 (a global CI input changed: `doc/memory/google-connector-memory.md`). Required CI supplies the broad coverage. - Headless Playwright against Storybook dev, `ProductionPicker` at 1280x900 (dark and light) and `ProductionPickerMobile` at 375x812: the dialog text is only the title, the rows, the link, and Cancel / Continue. No horizontal scroll at 375 px. The link sits under the last row with the normal dialog gap, and the footer follows it. - Before: see the screenshots in #21998. After: the same dialog without the two text sections. ## Risks - Policy risk: Google's user data policy may expect a disclosure inside the product, before consent, that says what data the app uses and how. A privacy policy link alone may not satisfy a Google reviewer. This is a recorded owner decision. If a reviewer asks, restore a short statement above the link. The memory doc and the production checklist record this risk. - Low code risk. The change is UI-only. Selection, requested scopes, OAuth and saved state do not 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`), Anthropic, in Claude Code with tool use (shell, file edits, headless browser). ## 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> |
||
|
|
11cfe0910d |
fix(connections): keep a finished setup checklist on screen when the app refreshes queries (#22715)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - "Set it up with your agent" screens give the person's own agent a
setup checklist to fill in, shown live on the page (#22626, AWS role
setup first)
> - Testing it end to end on staging, the agent's updates appeared
within 0.3–0.6 seconds and the page showed "Your agent set up AWS" with
the role ARN, then a few seconds later replaced it with a blank new
checklist
> - When the live connection reconnects or the tab becomes visible
again, the app refreshes every query on screen. The checklist's handoff
query refetched, found no checklist in storage (a finished one is
removed so it is never reused), and created a new one
> - This pull request makes a refetch keep the checklist the page
already has; only Start again, or a finished checklist from an earlier
visit, makes a new one
> - The benefit is that a finished setup stays on screen with its
summary until the person moves on
## Linked Issues or Issue Description
Refs #22626 (the setup checklist this fixes).
**Subsystem affected**
Connections (agent-guided setup), UI.
**Problem or motivation**
On paperclip.staging, after the agent finished, the AWS setup step
showed "Your agent set up AWS" and the role ARN to paste, then about 7
seconds later went back to "Paste the prompt into your agent" with a
new, empty checklist. The page's network log showed a second `POST
/api/companies/{companyId}/agent-setup-progress`. The person loses the
role ARN they were about to copy.
**Proposed solution**
The handoff query's fetch returns the handoff already in the cache
unless the page asked to replace it (`renew`). Creating a checklist
stays a deliberate action.
**Alternatives considered**
- Excluding the handoff key from the live reconcile
(`LIVE_EVENT_FREE_QUERY_KEYS`): covers that one caller but not any other
broad invalidation. Guarding the fetch covers them all.
- Keeping a finished checklist in storage: it would then be reused by a
later visit, which #22626 deliberately avoids (a finished checklist
takes no more updates).
## What Changed
- `ui/src/components/AgentSetupProgress.tsx`: the handoff query's
`queryFn` returns the cached handoff unless `renew` set a one-shot
`replacing` flag.
- `ui/src/components/AgentSetupProgress.test.tsx`: regression test. A
checklist finishes, then every active query is invalidated (as the live
reconcile does); the checklist is created once and "Your agent set up
AWS" with the role ARN stays.
## Verification
- New test fails on master (`create` called twice) and passes with the
fix (red/green).
- `AgentSetupProgress.test.tsx` and `AwsRoleSetup.test.tsx`: 26 passed.
UI typecheck clean.
- Staging reproduction (before this fix), paperclip.staging on
|
||
|
|
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> |
||
|
|
63e6e56407 |
fix(onboarding): disable unsupported browser sign-in (#22695)
## Thinking Path > - Paperclip lets people manage AI agents and connect their AI accounts. > - Onboarding connects the first agent to a provider account. > - Some execution environments cannot start browser sign-in. > - The wizard showed this limitation but left Connect enabled. > - This pull request uses that same state to block Connect and keyboard submission. > - Users get a clear reason and can go back to use an API key or another model. ## Linked Issues or Issue Description **What happened?** Onboarding showed that browser sign-in was unsupported. Connect remained enabled when no saved subscription was available. Repeated clicks could test a connection that the user could not establish. **Expected behavior** Disable Connect and keyboard submission while browser sign-in is unsupported and no saved subscription is available. Show the reason. Keep saved subscriptions and API-key connections usable. **Steps to reproduce** 1. Open the onboarding Connect step in an environment without browser sign-in support. 2. Select Claude or OpenAI with subscription authentication and no saved subscription. 3. Observe the unsupported sign-in notice and press Connect or Cmd/Ctrl+Enter. **Paperclip version or commit** Reproduced in component tests on master at `8ce422e45d0c47ede1c8ea905575b93879c1854b`. **Deployment mode** Authenticated setup with a sandbox provider that reports `supportsLoginPty: false`. Tests use the real wizard with simulated API responses. Related: #19336 fixes shared sign-in actions and retry behavior. #17615 addresses a platform-specific login transport error. This change guards the onboarding submission action when browser sign-in is unavailable. ## What Changed - Use one unsupported sign-in state for the notice and the Connect submission guard. - Block mouse and keyboard submission before connection testing or hiring. - Keep saved subscriptions and API-key authentication available. - Add regressions for Claude, Codex, saved subscriptions, and returning to API-key setup. - Give existing hire tests usable authentication fixtures and document the behavior. ## Verification - Baseline on unchanged master: both unsupported-sign-in regressions fail because Connect is enabled. Both alternate-authentication tests pass. - Patched focused run: 4 tests pass with `pnpm exec vitest run ui/src/components/OnboardingWizard.test.tsx -t 'browser sign-in is unsupported'`. - Full onboarding component group: 290 tests pass across the wizard, step, adapter, and variant suites. - `pnpm -r typecheck` passes for all workspace packages. - `pnpm build` passes for all workspace packages. - `pnpm test:run` stopped in the chat integration shard: 315 passed, 5 failed, 1,633 skipped, and one unhandled error. The failures include `ENFILE: file table overflow` and SQLite database-open errors. The server, packages, and test-runner sources match the base commit. The focused rerun below passes; this full-suite attempt is still not a pass. - Token gates and `git diff --check` pass. - Focused chat-failure check: 67 tests pass, including all five failures, without source changes. Command: `pnpm exec vitest run server/src/__tests__/chat-channels.integration.test.ts -t 'retains HTTP Retry under the endpoint authorization row lock|retries the newer saved github request instead of the failed request after a budget hold' --maxWorkers=1`. This establishes recovery in isolation, not completion of the full local suite. - CI attempt 1: [serialized server suites (1/9)](https://github.com/paperclipai/paperclip/actions/runs/45265381027/job/138011142554), [Runner Vitest package (3/3)](https://github.com/paperclipai/paperclip/actions/runs/45265381027/job/138011141444), [server tests (7/12)](https://github.com/paperclipai/paperclip/actions/runs/45265381027/job/138011143258), and [server tests (9/12)](https://github.com/paperclipai/paperclip/actions/runs/45265381027/job/138011143086) stopped after their runners received shutdown signals. The repository runner-loss workflow retried these jobs once after the attempt completed. The interrupted first-attempt jobs are not passes. - [Automatic CI recovery](https://github.com/paperclipai/paperclip/actions/runs/45268368345) confirmed that all four failed jobs lost their runners and requested their rerun. The initial aggregate `ci / verify` failed because a dependency was cancelled. [CI attempt 2](https://github.com/paperclipai/paperclip/actions/runs/45265381027/attempts/2) passed for `b92ea53b5322e2d32bf8235db96ce94087fffde4`. The current PR has 58 successful checks, 3 skipped checks, no failures or pending checks, and no merge conflicts. - [Greptile review](https://github.com/paperclipai/paperclip/pull/22695#issuecomment-7113951912): 5/5 on `b92ea53b5322e2d32bf8235db96ce94087fffde4`, with no actionable issues. - No live provider sign-in or browser acceptance is claimed. ## Risks - The gate must keep saved credentials usable. Regression tests cover saved subscriptions and API keys. - Authentication and environment capability reads keep their existing behavior. This change adds no API, schema, or deployment-policy changes. ## Model Used - OpenAI `gpt-6.1-sol` through the Codex harness in T3 Code, with xhigh reasoning effort, code execution, and tool use. 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> |
||
|
|
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> |
||
|
|
8957941656 |
fix(ui): keep AI accounts compatible with harness selection (#22691)
Clear incompatible managed AI accounts when a saved agent changes harness. Filter account choices by saved routing metadata and the selected model. Keep supported Pi accounts before model selection and preserve heartbeat and debug edits in connection saves. Make managed OpenCode and Pi accounts optional. Preserve harness sign-in through setup saves and reopening. Put Connect beside missing-default errors and cover managed versus host-auth model selection. Supersedes #17411. Fixes #14078. Co-Authored-By: Luri Darmawan <luri@carik.id> 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>
|