mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 05:47:10 +01:00
fe2db1c32bc20dc997ed4b01ca85785c7bf16bd2
2696
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
4b5b9b7807 |
fix(antigravity): keep native slash commands in task text as prose (#22701)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The Runner can run tasks on the native Google Antigravity ACP server
(version 1.5.2)
> - The server turns some prompt text into native slash commands before
the model sees it
> - The admission guard refused only lines that start with "/". The
server runs `/plan` anywhere it follows whitespace, so task text such as
"see /plan for details" could switch the session into plan mode without
Paperclip
> - This pull request makes the guard mirror the server's exact rule for
each advertised command and keeps that text as prose
> - The benefit is that task, comment and pasted text cannot change the
native session mode or sign the account out, and ordinary prose that
mentions a command still runs
## Linked Issues or Issue Description
**What happened?**
The 1.5.2 server builds `_CMD_PATTERN = re.compile(r"(?:\s|^)/(" +
"|".join(...) + r")(?:\s|$)")` (server.py, lines 2071-2075) over its
built-in commands (`plan`) and applies it to every text block in
`_parse_prompt` (server.py, line 2136). The Runner sends the task as one
JSON line. A space before `/plan` survives JSON encoding, so
`{"task":"... then /plan the rollout"}` produced a native plan command.
The old guard did not see it, because no line started with "/".
**Expected behavior**
Task text reaches the model as text. Native commands that change the
session (`/plan`) or the account (`/logout`) never run from task
content.
**Paperclip version or commit**
`master` at the base of this branch, with the Antigravity ACP server
1.5.2 and its owned admission patch `1.5.2-paperclip.2`.
**Steps to reproduce**
1. Send a managed Antigravity prompt whose text contains ` /plan ` after
other words.
2. The old guard admits it unchanged.
3. The server's `_CMD_PATTERN.split` returns a `plan` command for that
text.
The other two advertised commands match only the whole prompt: `/logout`
when all text joined and stripped equals `/logout` (logout.py, lines
29-36), and `/usage` when that text starts with `/usage` and whitespace
or the end, case-insensitively (usage.py, lines 29-36). Python's
`str.strip()` also strips characters that JavaScript does not treat as
whitespace (U+001C..U+001F, U+0085), so `"\u001c/logout"` passed the old
guard and is a logout to the server.
## What Changed
- Add `antigravity-native-commands.ts`. It transcribes the server's
three matchers, with Python's exact whitespace set, and a neutraliser
that puts a word joiner (U+2060) before each slash that the server would
act on. The model still reads the same words. Text that the server
treats as prose is sent unchanged.
- The admission guard now rewrites the outbound `session/prompt` text
with the neutraliser instead of refusing every line that starts with
"/". If a native command still matches afterwards, the guard refuses the
prompt.
- The guard fails closed if the runtime advertises a native command
outside `plan`, `logout`, `usage`, so a future server command cannot
pass silently.
- Text blocks keep their other fields when the guard rewrites them.
- The server advertises exactly `plan`, `logout` and `usage` (server.py,
lines 6289-6299: the SDK's built-in commands, which are only `plan`,
plus the logout and usage entries).
- No change to the native admission patch, so the owned patch version
and closure digests stay the same.
## Verification
- Red first: the new admission tests failed on the old guard (19 failed:
`/plan` mid-line, in the JSON envelope, after a newline, inside quoted
text, after a tab, `"\u001c/logout"`, a command split across blocks, and
benign text the old guard refused).
- Green: `npx vitest run antigravity` in `packages/paperclip-runner` (14
files, 202 tests). `tsc --noEmit -p packages/paperclip-runner` passes.
- Cross-check against the server: I ran the server's own regular
expression and the `is_logout_prompt` / `is_usage_prompt` logic in
Python on 40,000 generated multi-block inputs. The TypeScript matcher
agreed on every input (998 plan, 1,423 logout, 2,941 usage matches).
After neutralisation, the server matched no command, and only word
joiners changed.
- `pnpm verify` exits 2 (the changed test files are outside the resolved
test graphs), so required CI supplies the broad coverage.
- Not run live: no prompt was sent to a real Antigravity session,
because the only available Gemini key is refused. The evidence is the
unit-level reproduction against the guard plus the quoted server source.
## Risks
- Low risk. The guard changes only prompt text that the server would run
as a command, and only by inserting an invisible word joiner. If the
model copies `/plan` from such text into a shell command, the word
joiner could come with it. This applies only to `/plan` followed by
whitespace.
- Prompts with lines that start with "/" (for example a path such as
`/usr/bin/x`) are no longer refused. The server does not treat them as
commands.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and
code execution.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
2821af0b52 |
fix(db): fail PR CI on a requires_staging migration without an override (#22628)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Paperclip Cloud deploys a new release while the previous release still serves the same database > - Core classifies every new migration as `online_compatible`, `requires_staging`, or `unknown`, and the pull-request guard checks the migrations a PR adds > - The guard fails an `unknown` migration without an override, but it only prints a notice for a `requires_staging` migration > - A `requires_staging` release is refused by every stack that serves two releases at once, so continuous deploy stalls until somebody runs a maintenance deploy > - This pull request makes the guard fail a `requires_staging` migration unless the file carries a justified `requires_staging` override > - The benefit is that a migration that forces a maintenance window cannot merge by accident. The author must split it or accept the maintenance deploy in writing. ## Linked Issues or Issue Description Refs #20913 (the classifier and the guard). Refs #22513 (the migration that stalled deploys). **What existing behavior does this improve?** The pull-request migration guard in `packages/db/src/migration-compatibility.ts` and `.github/scripts/check-pr-migration-order.mjs`. **Current behavior** A new migration classified `requires_staging` passes the guard with a `::notice`. Nothing stops it from merging. Stacks that deploy with overlap then refuse the release. **Proposed behavior** A new `requires_staging` migration fails the guard unless the file starts with `-- paperclip:migration-compat requires_staging: <justification>`. The error lists the reasons and tells the author to split the migration into expand and contract steps, or to add the override and accept a maintenance deploy. A justified override passes with a notice that says the release ships with a maintenance deploy. **Reason and benefit** On 2026-11-22 a `requires_staging` migration merged. Continuous deploy to the overlap-deploy staging stacks stalled for about 4.5 hours, and a manual maintenance deploy took 38 stacks offline for a median of about 2.5 minutes each. An explicit decision in the migration file makes this cost visible at review time. **Breaking changes** None for existing migrations. The guard judges only the migrations that a PR adds. A PR that adds a `requires_staging` migration must now add the override or split the migration. ## What Changed - `checkNewMigrationCompatibility` returns an error for a `requires_staging` migration without an override. The error lists the `requires_staging` and `unknown` reasons and the two ways forward. - A `requires_staging` migration with a valid override passes with a notice. It reuses the existing in-file directive and its minimum justification length. There is no new mechanism. - `doc/DATABASE.md` ("Migration compatibility with the running release") says that `requires_staging` fails the PR and when to use the override. - Doc comments in the CI script and the `--check` CLI usage now name both blocking classes. The CLI success line says "none blocked". - Red/green tests in `packages/db/src/migration-compatibility.test.ts` and `.github/scripts/tests/check-pr-migration-order.test.mjs`: `requires_staging` without an override fails, with a justified override passes, with an empty justification fails, and `online_compatible` passes. ## Verification - Red: with the old guard, the new tests failed (vitest: 3 failed of 116; node test: 3 failed of 14). - Green: `cd packages/db && pnpm exec vitest run src/migration-compatibility.test.ts` passes 116 of 116. - Green: `node --test .github/scripts/tests/check-pr-migration-order.test.mjs` passes 14 of 14. - `pnpm --filter @paperclipai/db typecheck` passes, including `check:migrations`. - `pnpm verify` exits 2 because a global CI input changed (`.github/scripts/check-pr-migration-order.mjs`). Required CI supplies the broad coverage. ## Risks - Low risk. The change affects only the PR guard for new migrations. Deployers and the cloud migrator manifest do not change. - An open PR that adds a `requires_staging` migration fails the guard after it rebases. The error says how to fix it. - Note: migration `0500_funny_malcolm_colcord.sql` from #22513 already has a justified `requires_staging` override. This guard passes it with a notice. To stop such a migration at review time, a further policy is necessary, for example a required reviewer for the override. > 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 (Anthropic, model ID `claude-opus-5-5`), in Claude Code with tool use (shell, file edits) and extended reasoning. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
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>
|
||
|
|
427d13c38c |
fix(connections): clean up audit-only task traces and wait without rescanning content (#22658)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - #22636 removes connection content (for example Google results) when a task or a company is deleted > - Review on #22636 found two more gaps after it merged > - A task whose only connection trace is an audit entry (for example a denied call) got no cleanup job, so the argument preview stayed after the task was deleted > - A cleanup job that waits for open runs re-ran all content steps on every recheck, which is wasted database work > - This pull request queues a job for audit-only tasks and adds a `waiting` phase that only counts open work > - The benefit is that no audit preview of a deleted task is left behind, and a waiting job stays cheap ## Linked Issues or Issue Description Refs #22636 **Problem** 1. Deleting a task whose only connection trace is a `tool_access_audit_events` row with the task's ID creates no cleanup job, so its argument preview stays. 2. While a task cleanup job waits for open runs or approvals, every recheck runs the six content steps again from the start. **Expected behavior** 1. The audit preview is cleared after the task is deleted. 2. A waiting job only checks whether work is still open, and runs the content steps once when the work settles. **Steps to reproduce** 1. Write a denied policy audit entry with the task's ID and no call or call event. Delete the task. The preview stays. 2. Delete a task while one of its runs is working. Each recheck scans every content table of the task again. ## What Changed - `issue-content-deletion.ts`: when the task has no recorded runs, calls or call events, check for an audit entry with the task's ID. If one exists, queue the job. The audit step already matches by task ID. - `content-deletion.ts`: new `waiting` phase. After a content pass with open work, the job moves to `waiting` instead of restarting. Each recheck counts open runs, open calls, open approvals and open wakes with results for the task. When the count is zero, or after the one-day bound, the job runs the content steps once more and finishes. - Moved the pure JSON cleaning helpers to `content-cleaning.ts` to keep `content-deletion.ts` under 1,000 lines. No behaviour change. - Two canary tests: a task with only an audit entry, and a waiting job that leaves new content alone on a recheck and clears it after the open run settles. Both failed before the fix. - The working memory note is updated. ## Verification - `cd server && npx vitest run src/__tests__/tool-connection-content-deletion-canary.test.ts src/__tests__/tool-connection-content-deletion.test.ts src/__tests__/server-startup-feedback-export.test.ts` (156 tests pass). The two new tests failed before the fix. - `cd server && pnpm typecheck` passes. ## Risks - Task deletion with no other connection trace runs one more query on `tool_access_audit_events` for the company, with `limit 1`. That table has no index on the task ID in its details. - No schema change. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use (shell, file edit, test runs). Extended reasoning on. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] 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> |
||
|
|
c294f21a34 |
fix(claude-local): join every row of a hard-wrapped setup-token URL (#22653)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - People connect a Claude subscription from "Connect a model". Paperclip runs `claude setup-token` in a terminal and reads the sign-in link from the output > - When the CLI prints the link as plain text, the terminal hard-wraps it over several rows. `reassembleUrl` joins the rows and validates the result > - It returns the first join that validates. `state` is the last query key and needs only 16 characters, so a join that stops inside `state` can validate one row early > - The leftover row then sits where the prompt should be. Prompt binding returns null, and the sign-in dialog hangs. No truncated URL gets out, because the parser fails closed > - This pull request uses the wrap shape: every row but the last has the same width, so the parser joins until a row is shorter than the first row > - The benefit is that the plain-text path works at every terminal width, not only at the widths where the break misses `state` ## Linked Issues or Issue Description Refs #19949 (the plain-text path section). The fix follows the change that @aron-intframe proposed and measured in the first comment on that issue. The login-method line defect from the same issue is in a separate pull request, as the triage comment asks. Refs #20050 (PTY window size). ## What Changed - `setup-token-parse.ts`: `reassembleUrl` no longer returns at the first join that validates. If the first row validates on its own, the URL is unwrapped, and the parser stops there as before. Otherwise it joins until a row is shorter than the first row, and it returns the last join that validated. - Tests: the 64-column `claude.com` wrap from #19949, a sweep of every width from 40 to 200 columns for both accepted URLs, and a test that a two-row wrap with a valid first row still fails closed. ## Verification - `pnpm exec vitest run packages/adapters/claude-local/src/server/`: 391 passed, 2 skipped. - The 64-column test and the width sweep fail on `master` and pass with this change. - `pnpm --filter @paperclipai/adapter-claude-local typecheck` passes. - With a 385-character URL like the one in #19949, `master` fails at 49 of 161 widths from 40 to 200. This branch passes at all 161. ## Risks - Low risk. Each existing test passes, including the code-like value after the URL, the repeated OSC 8 rows, and the hostile line between fragments. - One gap stays: a two-row wrap whose first row already holds 16 or more `state` characters. One row gives no width to compare, so the parser fails closed as it does today. A 200-column PTY (#20050) avoids this for current URL lengths. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with shell, file edit, and code execution tools. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge |
||
|
|
2181df544c |
fix(claude-local): skip the setup-token login-method line (#22652)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - People connect a Claude subscription from "Connect a model". Paperclip runs `claude setup-token` in a terminal and reads the sign-in link from the output > - `parseSetupTokenPrompt` binds the link only when the browser-code prompt follows the URL block. It skips repeated URL rows and the copy hint, and it fails closed on any other line > - Claude Code 2.1.306 prints a new line, `Login method pre-selected: Subscription Plan (Claude Pro/Max)`, between the copy hint and the prompt > - The parser returns null for that layout, and the runner waits for the 5-minute timeout. The dialog stays on "Preparing browser sign-in…", and the log says only "timed out" > - This pull request skips the login-method line with a bounded pattern and logs one fixed line when the prompt is on screen but the parser does not bind it > - The benefit is that Claude subscription sign-in works on Claude Code 2.1.306, and the next layout change shows up in the log at once ## Linked Issues or Issue Description Fixes #19949 Refs #19958 (the same fix by @adity982, written before #19211 changed the copy-hint check; this pull request ports it onto `master` and widens the pattern to other method names). Refs #19211, #15550 (earlier copy-hint fixes). Refs #20050 (PTY window size, a separate fix). Refs #22520 (the 2.1.330 short link, a separate fix in the URL validator). The plain-text URL reassembly defect from the same issue is in a separate pull request, as the triage comment asks. ## What Changed - `setup-token-parse.ts`: add `LOGIN_METHOD_LINE_RE`. `findBrowserCodePrompt` skips a line that matches it. The method name is 1 to 80 characters of prose with no `:`, so a URL or a `code:value` cannot hide in it. Any other unknown line still returns null. - `setup-token-parse.ts`: add `hasSetupTokenPromptLine`. It returns true when the output holds the prompt line. It binds no value. - `setup-token-runner.ts`: when the prompt line is on screen and `parseSetupTokenPrompt` still returns null, log one fixed line: `Setup-token login: the browser-code prompt is on screen, but the parser did not recognize the sign-in screen.` The line holds no input bytes, and the runner logs it at most one time per run. - Tests: the 2.1.306 layout (OSC 8 link per row, CHA-spaced words, copy hint, login-method line, prompt), the login-method line without a copy hint, four malformed login-method lines that must fail closed, and two runner tests for the new log line. ## Verification - `pnpm exec vitest run packages/adapters/claude-local/src/server/`: 396 passed, 2 skipped. - The two positive parser tests fail on `master` and pass with this change. - `pnpm --filter @paperclipai/adapter-claude-local typecheck` passes. - I ran the parser on a synthetic 2.1.306 screen built from the output in #19949. `master` returns null. This branch returns the full URL. - Not run: a live `claude setup-token` sign-in on 2.1.306. ## Risks - Low risk. The change adds one allowlisted line shape. The parser keeps its fail-closed contract for every other line. - A future CLI can print another new line. The parser then still returns null, but the new log line names the cause. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with shell, file edit, and code execution tools. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge |
||
|
|
d28becf0f5 |
fix(server): run person-opened gateway sessions as their opener for personal connection grants (#22643)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The tool gateway lets an agent run call connected apps through a short-lived session > - A person on the board can also open a gateway session for a running agent > - Such a session resolved credentials for the run's responsible person, not for the person who opened it > - A member could therefore use another member's personal connection grant through that member's running agent > - This pull request limits personal grants in a person-opened session to the grant owner and requires permission to act on the agent > - The benefit is that a personal connection is used only by its owner or by the owner's own agent runs ## Linked Issues or Issue Description Refs #22635 **What happened?** `POST /api/tool-gateway/sessions` let any non-viewer member open a session for any running agent in the company. Tool calls in that session used the personal grant of the run's responsible person. **What did you expect to happen?** A person who opens a session can use a personal (user-owned) grant only when they own it. The person needs permission to act on the agent. Company-shared connections and agent-opened sessions work as before. **Steps to reproduce** Two members are in one company. Member A has a personal grant on a connection that agent X uses. While a run of X is active, member B opens a gateway session for that run and calls a tool on that connection. The new route test covers this case. **Impact** Access-control hardening for personal connection grants. ## What Changed - Add the nullable column `tool_gateway_sessions.created_by_user_id` (migration `0502`, which also adds `tool_mcp_tasks.created_by_user_id`). The route sets it when a person (not a local implicit board) opens a session. - Grant resolution for such a session acts as the person who opened it. That person's own personal grant is used, or a connect card is addressed to that person. Another member's personal grant is never selected, and that member gets no card. - The opener is recorded on the tool invocation (server-written `policyExplanation.sessionOpenedByUserId`) and restored when an approved action runs. An approved call from that session therefore uses the same person's grant. - A guard after grant resolution refuses a user-owned grant of another person with `403` and `reasonCode: personal_grant_owner_required`, as defense in depth. - Saved-call replay is scoped to the opener: idempotency keys get an opener suffix for such sessions, and approval replay matches only invocations recorded with the same opener. The lookup of keys saved before this change still runs: a saved call that can be attributed to the same person replays, one attributed to another person does not, and one that cannot be attributed returns the existing `legacy_tool_idempotency_unverifiable` conflict instead of running the write again. - Long-running provider tasks (`tool_mcp_tasks`) record the opener in a new `created_by_user_id` column (same migration) and restore it on each background poll, so the task keeps the opener's grant and is attributed to the opener. - Managed GitHub identity selection uses the opener, in the first and the fallback selection. - A call attaches to an existing long-running provider task only when the task uses the same grant the call resolves to. On a personal grant it must also be the same person (an agent session matches only tasks with no opener; the grant owner may also collect a legacy task with no opener). On a shared grant any person may collect. The wake for a finished task now carries the task id, so the agent's continuation resolves the opener's grant and collects the result instead of calling the provider again. - `POST /api/tool-gateway/sessions` checks the existing `agent:wake` permission for a board caller, the same check as invoking the agent. - Agent-opened sessions do not set the column, so agent runs and the recovery of interrupted runs do not change. - Document the rule in `doc/MCP-ACCESS-GOVERNANCE.md`. - I checked the sibling routes. Named gateway tokens minted by a person need `tools:admin` and carry no responsible person. Board test calls and MCP app view calls already run as the caller. Stored MCP task continuations stay pinned to the grant they started with. ## Verification - New route tests in `server/src/__tests__/tool-gateway.test.ts`: - Three members, two with personal grants, on a run that belongs to the first. A session opened by the second member uses only that member's credential. The run owner's session and an agent-opened session use the run owner's credential. A member with no grant gets `409 user_authorization_required`, the card is addressed to that member, and the remote server gets no request. A reviewed call from the second member's session, once approved, runs with that member's credential. The same write from two people's sessions runs once for each person, and only the same person's retry replays. - A pre-upgrade saved write retried by the same person replays (or conflicts when it cannot be attributed) and never reaches the provider twice; another person's identical write runs. - `mcp-tasks.test.ts`: a person-started task keeps the opener's grant through a background poll; an agent retry never receives that task's result and keeps its own task; the continuation after a wake collects once with no new provider call; on a shared grant another person collects the task, including a task started before openers were recorded. - `tool-gateway-service.test.ts`: an opener with their own managed GitHub grant uses it; an opener without one is refused and the run owner's grant is never used. - A viewer cannot open a session for the agent. - Before the fix, the second member's session used the run owner's credential, and the viewer got `201`. Both tests pass now. - `npx vitest run src/__tests__/tool-gateway.test.ts src/__tests__/connection-management.integration.test.ts src/__tests__/mcp-tasks.test.ts`: with `tool-access-service.test.ts` and the policy tests, 833 tests pass. - `tsc --noEmit` for `server` passes. - `pnpm verify` exits 2 because a global CI input (a doc) changed. Required CI gives the broad coverage. ## Risks - A person who opened a session for another member's run used that member's personal grants before. Now the session uses the opener's own grants. This was not an intended flow. Shared connections and agent runs do not change. - A person-opened session that repeats exactly the same side-effecting call an agent session already made in the same run gets a `409` conflict instead of a second write, because that earlier call has no recorded opener. Use a new explicit idempotency key for an intentional repeat. - The migration only adds nullable columns. Sessions and review requests created before this change have no opener record and keep the previous behavior until they expire (15 to 60 minutes). - Follow-up, out of scope: in the experimental MCP Tasks path, a call with a new explicit idempotency key and the same arguments still attaches to the same person's open task under the same grant. That is the existing de-duplication for every caller and does not depend on the opener rule. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b865dd112b |
feat(google-workspace): run Gmail, Drive, Docs, Sheets, Slides and Calendar on Paperclip's REST tools (#22634)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The built-in Google Workspace connector gives agents Gmail, Drive, Docs, Sheets, Slides and Calendar actions through one connection > - Google's hosted Workspace MCP servers are a Developer Preview, so Paperclip cannot offer them to the public > - Paperclip has its own REST tool set for all 36 allowlisted actions, but every service still sent its calls to Google's MCP servers > - The owner decided on 2026-11-23 to launch all six services on REST now and to live-test on the staging tester after deploy > - This pull request switches the six services to `paperclip_rest` and fixes what the switch breaks > - The benefit is that the connector no longer depends on Developer Preview servers, and agents get all 36 actions, including the two Gmail actions Google's live server did not offer ## Linked Issues or Issue Description Refs #22016 (the transport switch), #22000, #22014, #22017, #22027, #22028, #22029 (the REST tool set). **Subsystem affected** Built-in Google Workspace connector (`google-workspace`, `workspace.all`): transport setting, catalog publication, tests and docs. **Problem or motivation** All six launch services used Google's hosted MCP servers. These servers are a Developer Preview and are not available to the public. Google's live Gmail MCP server also did not offer `gmail__list_threads` and `gmail__search_messages`. **Proposed solution** Set Gmail, Drive, Docs, Sheets, Slides and Calendar to `paperclip_rest` in `GOOGLE_WORKSPACE_TOOL_TRANSPORT`. Keep Chat, People and Search on `google_mcp`. Fix the catalog refresh so that an existing connection keeps its actions active after the switch. **Alternatives considered** Switch one service at a time after a live test (the Nov 17 rule). The owner replaced this rule on Nov 23: switch all six now and fix forward. **Roadmap alignment** This is the planned launch step for the Google Workspace connector. It does not overlap other core work. ## What Changed - `packages/shared/src/google-workspace-connectors.ts`: set `gmail`, `drive`, `docs`, `sheets`, `slides` and `calendar` to `paperclip_rest`. `chat`, `people` and `search` stay `google_mcp`. - Connections saved before the switch keep Google's MCP definitions in their catalog. Two changes make them work with no user action: - New resolver `paperclipDefinedTool(connection, toolName)` in `server/src/services/connectors/paperclip-defined-tools.ts` (typed result). It is the one place that says which tools are Paperclip-defined; for a `google-workspace` connection it calls `googleWorkspaceRestToolDefinition` in the dispatch adapter, which returns the REST definition when the service is on `paperclip_rest`. - `server/src/services/tool-gateway.ts`: when the gateway lists a connection's tools, it takes the input schema, output schema, description and annotations of a Paperclip-defined tool from the resolver, not from the saved row. Routing and the advertised definition read the same transport setting in the same process. This is an in-memory lookup, so it adds no request to the turn start. Example: an agent gets the REST `docs__update_doc` schema, where `writeControl.requiredRevisionId` is required, not Google's schema, where it is optional. - `server/src/services/tool-access/catalog/publication.ts`: catalog publication asks the same resolver. It never holds a Paperclip-defined action for review, and it clears the review hold (`quarantined`, `pending_review`) of an action held only because a remote definition changed. Clearing the hold does not count the action as new, so it is never added to the profile: Off stays Off and Ask first stays, also for a held action. Only actions the connection never had (Gmail `list_threads` and `search_messages`) get the default for new actions. Before this fix, a refresh after the switch put every action of an existing managed connection into `pending_review` (10 of 10 in the regression test). - `server/src/__tests__/google-workspace-rest-transport.test.ts`: the fake Google now answers the Docs, Sheets and Slides REST hosts and the Drive and Calendar paths. New tests: - The transport map has exactly the six launch services on `paperclip_rest`. - A full read and write grant lists exactly the 36 allowlisted actions (with `gmail__list_threads` and `gmail__search_messages`) and sends no MCP request. A read-only grant lists the 23 read actions. Gmail, Drive and Calendar group grants list exactly their actions. - One read and one write per service run through the real `executeTool` path on REST with the default policy (no approval request). Each call records the invocation and the `call_completed` event with the connection ID (the "Delete data" bookkeeping keys), and audits the protocol `Google Workspace REST` with the service endpoint. - Injected instructions in Docs, Sheets, Slides, Drive and Calendar REST results are blocked. - An existing connection discovered over MCP keeps its actions active after the switch and can call the new Gmail actions. - Migration without refresh: a connection saved with Google's MCP schemas (`update_doc` with `writeControl` optional) advertises the REST schemas after the switch with no refresh, and `read_doc` then `update_doc` with the revision succeed over REST. - The first refresh after the switch releases an action held for `pending_review`, keeps an Off action unlisted and keeps Ask first (`approval_required`). - An action that is both Off and held stays Off, and one that is both Ask first and held stays Ask first, after the switch and after two refreshes. - The MCP-path test pins Gmail and Docs to `google_mcp` explicitly. - `server/src/__tests__/helpers/google-workspace-transport.ts`: new helper `useGoogleMcpTransport()`. Tests whose fixtures act as Google's MCP servers use it (`tool-access-service`, `tool-gateway-service`) or pin the transport in `beforeAll` (`google-workspace-injection-screening`). These tests still cover the MCP path, which stays available for Chat, People, Search and a switch back. - `packages/shared/src/google-workspace-connectors.test.ts`: assert the new transport map. - Docs: `doc/connections/GOOGLE-WORKSPACE.md` and the REST folder `README.md` say that the six services run on REST. `doc/memory/google-connector-memory.md` has three dated Nov 23 decisions (all six switched to REST, writes default to Allowed, image-by-URL inserts allowed), and the two items are removed from "Still open". ## Verification - Red: after the flip, 50 tests failed in four files because their fixtures act as Google's MCP servers. These are fixture assumptions, not product bugs. - Red: without the gateway change, the migration test gets Google's saved schema; without the publication change, the held action stays `quarantined`; without excluding released rows from the new-action default, the Off and held action comes back. All green with the fixes. - Red: the new test "keeps an existing connection's actions usable when its services move from Google's MCP servers to REST" failed before the `publication.ts` fix: 10 catalog entries were `quarantined` with `pending_review`. Green after the fix. - `cd server && npx vitest run src/__tests__/google-workspace-rest-transport.test.ts src/__tests__/google-workspace-injection-screening.test.ts src/__tests__/tool-gateway-service.test.ts src/__tests__/tool-access-service.test.ts src/services/google-workspace-rest-dispatch.test.ts src/google-workspace-rest-tools`: with `connection-management.integration.test.ts` added: 60 files, 2232 tests pass. `google-workspace-rest-transport.test.ts`: 52 tests pass. - `cd packages/shared && npx vitest run src/google-workspace-connectors.test.ts`: 14 tests pass. - `npx tsc -p server/tsconfig.json --noEmit`: no errors. - Trace of a read (`gmail__get_message`) and a write (`gmail__create_draft`) through `executeTool` in `server/src/services/tool-gateway.ts`: policy decision and invocation record (13723, 13731), approval gate (13820), `call_allowed` audit (13885), dispatch to `executeRemoteHttpTool` (13915), prompt-injection screening of the result (13964), `call_completed` event and audit (14022, 14044), failure audit (14187). In `executeRemoteHttpTool` the grant scope check (8172) runs before the REST branch (8276), which rechecks the current grant and returns before any MCP session, MCP Task or elicitation code. The REST adapter (`google-workspace-rest-dispatch.ts`) calls `google-http.ts` only through the gateway's guarded fetch. - Not verified: calls against real Google. The live test on the staging tester runs after deploy. ## Risks - Real Google answers can differ from the fixtures. The REST tools are not yet run against real Google. The live test on the staging tester runs after this deploys, and problems are fixed forward. - The OAuth client on the staging tester is marked for AI agents and was only used through MCP. If Google refuses REST calls from that client, all six services fail on the tester until the client changes. - Existing connections keep their stored MCP schemas until a catalog refresh, but agents receive the REST definitions at once. The stored risk level of the four update actions stays `write` until that refresh, then becomes `destructive`. The two new Gmail actions appear after a refresh. - Input differences between Google's MCP schemas and the REST tools are listed in the REST folder `README.md` ("Input differences an agent meets after a switch"). Agents receive the REST schemas, so these differences are visible to them. No `tools/list` from Google's servers is recorded, so the check uses Google's published references. - Accepted risk (owner decision, 2026-11-23): Docs and Slides edits may insert an image from any public web address. Google, not Paperclip, fetches the address, and Paperclip's own requests still go only to the allowed Google hosts. The residual risk is that an agent could put data in the address it chooses. Links to Drive or Docs files stay refused. - Update actions (`update_doc`, `update_presentation`, `update_spreadsheet`, `update_event`) are labelled destructive on REST, as decided on Nov 17. This does not add an approval step: write actions stay Allowed by default. - A switch back to `google_mcp` stays possible with a one-line change. The MCP path tests still run. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, file edits, test runs). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ba1b0585bc |
fix(server): send deployment OAuth client secrets only to the token endpoint they are configured for (#22649)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - App connections sign in with OAuth, and an operator can set a deployment-wide OAuth client with `PAPERCLIP_TOOL_OAUTH_*` variables > - The server picked that client by a provider name, and a connection's own settings could set both the provider name and the token URL > - So a deployment client secret could go to a token URL that the deployment did not choose > - A deployment secret must go only to the endpoint of the app it was set up for > - This pull request pins each deployment client to the token endpoint that its app definition fixes, and fails closed for any other endpoint > - The benefit is that member-entered or custom endpoints get only a member-entered client ## Linked Issues or Issue Description Refs #22635 **What happened?** `configuredOAuthClientForConnection` returned the deployment client for any connection whose provider name matched, or the unsuffixed client for any connection. The token exchange then sent that client secret to the connection's token URL. **What did you expect to happen?** A deployment client goes only to the token endpoint that its app definition fixes. A custom endpoint needs a client that the member adds. **Steps to reproduce** Set a provider-specific deployment client. Create a custom connection that names that provider and a different token URL, and start sign-in. The new unit tests cover this case. **Impact** Secret-handling hardening for deployment OAuth clients. ## What Changed - `configuredOAuthClientForConnection` now takes the token URL that the caller will post to. It returns a deployment client only when the connection comes from a real app definition, the provider is that app, the method lists `customer` ownership, and the token URL equals the method's `defaults.tokenEndpoint` (or, when the method fixes no token endpoint, is on the exact host of its fixed server, discovery, metadata or authorization URL). - A pasted (custom) server never gets a deployment client, including the unsuffixed one. It needs a client of its own, or CIMD or dynamic registration. - The token URL is required at every call site: start, callback, connection refresh and grant refresh. - When a deployment client exists but the endpoint does not match, and the connection has no client of its own, sign-in fails with `oauth_instance_client_endpoint_mismatch` and a clear message. - Pin `defaults.tokenEndpoint` in the Asana and Railway definitions, whose token endpoints are on another host than their MCP servers. - Update `doc/connections/GENERIC-REMOTE-MCP.md` and `doc/connections/CONNECTOR-PLAYBOOK.md`. ## Verification - New `server/src/services/tool-access/oauth/client-settings.test.ts` (16 tests): other hosts, a path that resolves elsewhere, plain HTTP, vendor subdomains, another port, a missing URL, empty or padded gallery markers, colliding host names, a custom connection that names a provider, the unsuffixed client on a custom connection, and a connection that names another app's provider all get no deployment client. Slack's fixed endpoint, Notion's server host and the pinned Asana and Railway endpoints still get it. These cases failed before the fix and pass now. - `server/src/__tests__/generic-mcp-connection.test.ts` and the machine-to-machine test in `tool-access-service.test.ts` now check that a pasted server never receives the deployment client or secret. Both failed before the fix. Two other pasted-server tests now use a client of their own. - A positive test sends the Slack deployment client to Slack's pinned token endpoint, with its secret, and nowhere else. - The connect route keeps the draft and returns `manualClientRequired` with a plain reason when a deployment client cannot be used (route and UI tests). - `npx vitest run` on the OAuth service and connection tests: 686 tests pass. Shared app-definition tests pass. `tsc --noEmit` for `server` passes. - `pnpm verify` exits 2 because a global CI input (a doc) changed. Required CI gives the broad coverage. ## Risks - A self-hosted deployment that used `PAPERCLIP_TOOL_OAUTH_*` for a pasted server must add a client to that connection. Sign-in shows a clear error instead of sending the secret. - A gallery app with `customer` ownership whose token endpoint is on another host than its fixed URLs needs `defaults.tokenEndpoint` to keep using a deployment client. Asana and Railway are pinned here. Box, Notion, PostHog, Sentry and Xero rely on the same-host rule: if their discovery returns a token endpoint on another host, a deployment-wide client is refused until the endpoint is pinned, and a client added to the connection always works. A test lists these apps by name, so a new app must choose. Gallery apps with a fixed token endpoint (Slack, Linear, Google) do not change. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
27af8e5c0c |
feat(telemetry): report custom connector domains and aggregator app requests (#22665)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents use tools through connectors: catalog connectors, custom MCP
servers, and aggregator gateways (Composio, Arcade, Executor) that reach
many apps
> - Connector telemetry sends every custom MCP connector as
`connector_key: "custom"`, and it sends nothing about apps behind an
aggregator
> - The team cannot see which services people add as custom servers, or
which aggregator apps people try to connect and which ones they finish
> - This pull request adds a reduced `server_domain` to the connection
events for custom connectors, and two aggregator app events
> - The benefit is a privacy-safe view of connector demand: no URL, no
subdomain, and no provider-controlled string leaves the installation
## Linked Issues or Issue Description
No issue exists. This follows the feature request template
(`.github/ISSUE_TEMPLATE/feature_request.yml`).
**Subsystem affected**
Server connector telemetry
(`server/src/services/connector-telemetry.ts`), the aggregator app sync
and setup paths
(`server/src/services/tool-access/catalog/aggregator-accounts.ts`), the
tool gateway, and the shared telemetry contract
(`packages/shared/src/telemetry`).
**Problem or motivation**
Connector telemetry sends every connector outside the first-party
catalog as `connector_key: "custom"`, and every app behind Composio as
the `composio` connector. Arcade and Executor apps are hidden the same
way. This hides which servers and apps people actually connect to. It
also hides what they try to connect and fail to connect. The team cannot
use telemetry to decide which connectors to add to the catalog or where
setup fails.
**Proposed solution**
For custom connectors only, send the registrable domain of the server
(`server_domain`), with IP, private, and local hosts reduced to
`private` and stdio servers to `stdio`. Send `connection.app_requested`
when a person or agent asks an aggregator to add an app, with the
result, and `connection.app_linked` when that app becomes connected. The
app is a slug from the checked-in aggregator catalog, or `other`. No
user-controlled string leaves the process.
**Alternatives considered**
Sending the full host was rejected: subdomains can name a customer or
tenant. Hashing the host was rejected: it cannot be read in an insight,
and short domains are easy to reverse. Sending the provider's toolkit
name was rejected: Executor and custom integrations use names that
people choose.
## What Changed
- Sync the generated telemetry contract. The telemetry backend registers
`server_domain` and the two new events first, so nothing is dropped as
unregistered.
- `server/src/services/connector-telemetry.ts`:
- `serverDomainForUrl()` reduces a configured address to its registrable
domain (ICANN public suffix plus one label, from `tldts`).
`mcp.smithery.ai/sse?token=…` becomes `smithery.ai`. IPs, loopback,
single-label hosts, non-ICANN or special-use suffixes (`.local`,
`.internal`, `.home.arpa`, `.onion`), non-HTTP schemes, and unparsable
values become `private`. A final pattern check makes sure nothing
URL-shaped can pass.
- `server_domain` goes on `connection.created`, `connection.updated`,
and `connection.invoked` only when `connector_key` is `custom`. Local
stdio servers send `stdio`. A remote connection with no address yet
omits it.
- `aggregatorAppTelemetrySlug()` returns a slug from the shared
aggregator catalog, or `other`. This is the same rule as
`connector_key`.
- `newlyLinkedToolkits()`, `emitAggregatorAppsLinked()`,
`emitAggregatorAppsRequested()`, and
`emitAggregatorAppRequestsFromToolCall()`. All are best-effort and never
throw.
- `aggregator-accounts.ts`: the Composio list check and the
Arcade/Executor inventory sync read the previous snapshot status before
the write. They send `connection.app_linked` only for a change to
`connected`. The Composio check sends it right after each saved row, so
a later app that fails in the same check does not lose it, and it
updates the stored status after each write, so an app named twice in one
check sends one event. The Composio upsert now returns its row, so a
write that loses to a newer observation sends nothing. App setup `start`
and account `add` send `connection.app_requested` (`origin: user`) with
`succeeded`, `needs_auth`, or `failed`.
- `tool-gateway.ts`: one call after the remote MCP response is parsed.
An agent's `COMPOSIO_MANAGE_CONNECTIONS` call with `add` sends one
`connection.app_requested` (`origin: agent`) per app.
`composioAddOutcomes()` parses the response once and reads each app's
own result node: connected is `succeeded`, its own sign-in link is
`needs_auth`, an error or no node is `failed`. A sibling's link never
counts; the response-wide link counts only when one app was added. An
Arcade tool call that answers with an authorization step sends
`needs_auth`.
- `connection-methods.ts`: `remoteEndpointValue()` shares the `url` →
`endpoint` → `remoteUrl` order with `remoteEndpoint()`.
- `server/package.json`: add `tldts` 7.4.10 as a direct dependency. It
is already in the lockfile through `tough-cookie`. The lockfile is left
to CI.
- Shared telemetry: typed helpers `trackConnectionAppLinked` and
`trackConnectionAppRequested`, `server_domain` on the three connection
helpers, retention class `operational_enum_count` for the new events,
and a "Connector Events" section in the telemetry README.
## New Dependency
`tldts` 7.4.10 (MIT) is added to `server/package.json`.
- Why: `server_domain` must be the registrable domain (eTLD+1), so
`mcp.example.co.uk` gives `example.co.uk` and not `co.uk`. That needs
the Public Suffix List. No runtime dependency in the repo parses it.
`new URL()` and `node:net` give only the hostname and IP detection.
Splitting on the last two labels is wrong for multi-part suffixes such
as `co.uk` and would leak or merge domains.
- Already in the tree: `tldts` 7.4.10 is in `pnpm-lock.yaml` through
`jsdom` → `tough-cookie`, a dev-only path. This PR makes it a direct
server dependency at the same version, so no new package is downloaded.
- Size: about 125 KB minified (`dist/index.cjs.min.js`), with one
dependency, `tldts-core` (same author). It bundles the suffix list, so
it does no network or file reads at run time.
- Maintenance: actively maintained (latest release this month), widely
used (it is the suffix parser in `tough-cookie`), with typed exports.
## Verification
- `pnpm exec vitest run src/services/connector-telemetry.test.ts`
(server): 65 pass, including a sibling's link, a top-level link with
several apps, and the one-app fallback. New cases cover domain reduction
(paths with tokens, userinfo, ports, uppercase, trailing dot, IDN,
`github.io` and `vercel.app` subdomains dropped), `private` for IPv4,
IPv6, loopback, `.local`, `.internal`, `.home.arpa`, `.onion`,
single-label, unknown suffix, `ftp:`, and non-strings, a payload check
that no part of a secret-bearing URL appears in any of the three events,
catalog-or-`other` for every provider, a check that every catalog slug
matches the registered `app` pattern, and the transition rule.
- `pnpm exec vitest run src/__tests__/composio-app-setup.test.ts
src/__tests__/aggregator-app-sync.test.ts` (embedded Postgres): 36 pass,
including an app named twice in one check (fails without the fix).
Composio: setup `start` sends one `needs_auth` request; refreshes while
the account is only initiated send nothing; activation sends exactly one
`app_linked` over three refreshes and a `complete`; an app saved before
a later app fails in the same check keeps its `app_linked`; an
unconfirmed `add` sends `failed`. Executor: two syncs send one
`app_linked`; a disconnect sends nothing. Agent requests: mixed per-app
results give `succeeded`, `needs_auth`, and `failed` separately.
- Red check: with the previous-status check or the domain reduction
removed, 13 of these tests fail.
- `pnpm exec vitest run src/telemetry` (shared): 46 pass, including the
real client sending `server_domain` and both new events.
- Related suites still pass: connector telemetry for tool access and the
gateway, Circleback parity, aggregator fallback, connection intents, MCP
protocol versions, MCP tasks, remote MCP connectors, remote MCP pending
(265 tests).
- `tsc --noEmit` reports no errors in the changed files.
- `tests/runner-e2e/source-sdk-public-inputs.json` is regenerated with
`node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --write`,
because it pins the shared telemetry files. `--check` and
`source-sdk-public-inputs.test.mjs` (13) pass.
- CI note: on
|
||
|
|
70d4b6524c |
fix(antigravity): offer the cloud candidate in the agent picker for linux-x64 environments (#22655)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Google Antigravity is a native Runner harness (#22591). Its profile is still pending, so only a company with an operator grant can see or run it > - A grant can name the cloud target (linux-x64), and save, Test and execution already accept it for a cloud environment > - The agent picker computed the candidate only for the local target, so a company with a valid cloud grant never saw the harness for a cloud environment > - This pull request binds the picker to the selected environment's target, in the Antigravity-owned module > - The benefit is that a granted company can pick Antigravity for the linux-x64 cloud environments that can run it, and still sees nothing anywhere else ## Linked Issues or Issue Description Refs #22591 **What happened?** `GET /api/adapters?companyId=…&environmentId=…` returned `candidateHarnesses` only when the environment target was `local`. A company with a valid linux-x64 Antigravity grant got no candidate for a Core sandbox or SSH environment. **What did you expect?** The picker offers the candidate for a linux-x64 cloud environment when the company holds a grant for that target, the same way save, Test and the executor admit it. **Steps to reproduce** 1. Set a candidate grant that names linux-x64 for a company and exact model. 2. Request the adapter list for that company with a linux-x64 sandbox environment. 3. `paperclip_runner` has no `candidateHarnesses`. ## What Changed - `antigravityCandidateForRunnerTarget` (in `antigravity-release.ts`) decides the picker candidate per environment target: - local: unchanged. - Core sandbox or SSH that is linux-x64, or the managed cloud image: only a grant that names linux-x64 and its patched closure. - plugin Runner-task environment, unknown or other platform, unavailable Computer: none. - released profile: none. - `GET /api/adapters` uses it for every resolved target. Expired or mismatched grants stay quiet; malformed grants still log one warning. - The qualification plan notes the picker rule and records, as an open decision, why plugin Runner-task environments cannot run Antigravity yet. ### Not in this PR: plugin Runner-task environments Paperclip Cloud's warm Agent Computer runs agents only as plugin Runner tasks. Antigravity cannot run there yet, and the fix is outside Core alone: - The plugin task credential contract (`environmentTaskCredentialSchema`) has no Gemini API key type. - The plugin prepares the provider launch from `launch-requirements.v1`, which carries no candidate grant. The ACPX sidecar refuses a pending profile without one. - The Cloud plugin's harness table lists only Codex, Claude and OpenCode. Kimi, Copilot and Pi do not run there either. - Antigravity Test refuses the Runner-task path. The picker therefore offers nothing for those environments until that work lands. ## Verification - Red, then green: `server/src/__tests__/adapter-routes.test.ts` "offers a cloud environment the candidate only for the company's linux-x64 grant" failed before the fix and passes after it. - New unit tests in `antigravity-release.test.ts` run the real grant resolver: cloud grant offered, other company / arm64 / Runner-task / expired / host grant refused, released profile offers none. - `npx vitest run src/__tests__/adapter-routes.test.ts src/services/native-runtime/antigravity-release.test.ts src/services/native-runtime/acpx-qualification.test.ts src/services/native-runtime/antigravity-candidate-admission.test.ts`: 98 passed. - Server `tsc --noEmit`: clean. `pnpm verify`: see the CI checks for the final revision. - Not run live: no Antigravity prompt has completed in any environment yet, and the only available Gemini key is free tier. No paid runner E2E workflow was dispatched. ## Risks - Low risk. The change is read-only catalog output. Save, Test and execution keep their strict admission checks. - A company that holds a linux-x64 grant now sees Antigravity for linux-x64 sandbox and SSH environments. Those paths already accept that grant. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use (shell, file edits) in Claude Code. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [ ] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9a6e61cf36 |
fix(connectors): show Anthropic as "Anthropic (Claude)" so a Claude search finds it (#22631)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The Connectors catalog shows each provider as a card with a name and
a short description.
> - The Anthropic card shows the name "Anthropic". People who search for
"Claude" do not find it.
> - The card description says "Use Anthropic APIs with a restricted
key." This text describes an obsolete REST setup. The connector now
offers only a Claude subscription or a Claude API key.
> - This pull request changes the card name to "Anthropic (Claude)" and
the description to "Connect to Claude with Anthropic."
> - The benefit is that a search for "Claude" finds the connector, and
the description matches what the connector does.
## Linked Issues or Issue Description
No public issue exists. This is an enhancement.
**What existing behavior does this improve?**
The Anthropic card in the Connectors catalog. The card name and the card
description change.
**Subsystem affected**
UI: the Connectors catalog (Apps). Shared: the Anthropic app definition.
**Current behavior**
The Connectors catalog shows the Anthropic connector as "Anthropic" with
the description "Use Anthropic APIs with a restricted key." A search for
"claude" in the Connectors search box does not show the Anthropic card.
**Proposed behavior**
The card shows the name "Anthropic (Claude)" and the description
"Connect to Claude with Anthropic." The slug stays `anthropic`.
**Reason and benefit**
Most people know the product as Claude. They search for "Claude" and do
not find the connector. The old description refers to a "restricted
key", which the connector does not use. After this change, a search for
"Claude" finds the connector, and the description is correct.
**Breaking changes**
None. The slug, the setup links, the saved connections, and the AI
provider bindings do not change.
## What Changed
- `packages/shared/src/app-definitions/anthropic.json`: Change `name` to
"Anthropic (Claude)". Change `description` to "Connect to Claude with
Anthropic."
- `scripts/ingest-app-definitions.mjs`: Make the same change in the
generator source. A regeneration now gives the same `anthropic.json`.
- `ui/src/pages/apps/Browse.test.tsx`: Add a test. The test searches the
Connectors catalog for "claude". It checks that the Anthropic card shows
the new name and description, and that the "Connect Anthropic (Claude)"
button is present.
- `tests/ai-connections-app/app.spec.ts`: Update the opt-in browser test
to find the "Connect Anthropic (Claude)" button. The test now escapes
the provider name for the regular expression.
- `tests/runner-e2e/source-sdk-public-inputs.json`: Refresh the pinned
hash of `anthropic.json` with `node
tests/runner-e2e/source-sdk-public-inputs.mjs <sha> --write`.
## Verification
- `cd ui && npx vitest run src/pages/apps/Browse.test.tsx`: 118 passed.
The new test fails on the old definition and passes on the new
definition.
- `cd ui && npx vitest run src/pages/apps/AppsConnect.test.tsx
src/pages/apps/AppDetail.test.tsx
src/pages/apps/app-connect-policy.test.ts
src/pages/apps/app-detail/AdvancedPanel.render.test.tsx`: 369 passed.
- `npx vitest run packages/shared/src/app-definitions.test.ts
packages/shared/src/connection-instructions.test.ts
packages/shared/src/app-definitions-url.test.ts`: 59 passed.
- `node --test scripts/app-definition-overrides.test.mjs`: 3 passed.
- `cd server && npx vitest run
src/__tests__/connection-intents-service.test.ts -t "obsolete Anthropic
tool requests"`: 1 passed. Agent connection search for "Anthropic" still
finds the connector through the `anthropic` slug.
- `node scripts/ingest-app-definitions.mjs --definitions-only` in a
temporary copy: the generated `anthropic.json` is the same as the
committed file.
- `pnpm verify` asks for broad CI coverage because
`scripts/ingest-app-definitions.mjs` is a global CI input. CI supplies
that coverage.
## Risks
- Low risk. The change is display text only.
- The slug stays `anthropic`. Saved connections, setup links, and AI
provider bindings do not change.
- Connection request cards and setup headers that use the connector name
now show "Anthropic (Claude)". This is the intended result.
- The AI method labels ("Claude subscription", "Claude API key") do not
change.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude
Code with tool use (shell, file edit, test execution).
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
98fd412851 |
fix(apps): show readable Google Workspace action names on Review and Permissions (#22630)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Connectors let agents use outside apps. The Google Workspace
connector gives agents Gmail, Calendar, Drive, Docs, Sheets and Slides
actions.
> - Each connection has a Review tab and a Permissions tab. People
approve actions and turn actions on or off there.
> - Google Workspace actions had no human title. These tabs showed the
internal tool name, for example `gmail__get_message` and
`calendar__list_events`.
> - Users must not see internal names. Google's app reviewers will also
look at these screens.
> - This pull request gives every Google Workspace action a readable
name, such as "Gmail: Read a message", for both tool transports.
> - The benefit is that people and reviewers see what each action does,
in plain words.
## Linked Issues or Issue Description
**What happened?**
On the Review tab and the Permissions tab of a Google Workspace
connection, action rows showed internal tool names. Examples:
`gmail__get_message` in the "Review new actions" list and the action
list, and "Calendar Create Event" in the "Waiting for your OK" list.
**Expected behavior**
Each row shows a readable action name, for example "Gmail: Read a
message" or "Calendar: List events". No row shows a `service__tool` name
or a raw ID.
**Steps to reproduce**
1. Connect Google Workspace.
2. Open Connectors, then the connection, then Permissions. Look at the
action list.
3. Open Review. Look at "Review new actions" and "Waiting for your OK".
**Paperclip version or commit**
master at
|
||
|
|
a3af1ac6db |
fix(connections): remove connection content when a task or company is deleted (#22636)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents call connected apps, such as Google Workspace, and Paperclip keeps parts of the results in tool-call records, approvals, run transcripts and files > - #22010 added "Delete data" on a connection. It removes that content for one connection. > - Deleting a task or a company did not run the same cleanup. Task deletion set the task link to null on tool calls, approvals and runs, so their previews and transcripts stayed. Company deletion removed the rows but left run logs and files in storage. > - Google's restricted-scope review requires that users can delete the Google data we hold, and that the policy matches the product > - This pull request runs the "Delete data" steps when a task is deleted, and removes a deleted company's run logs and files from storage in the background > - The benefit is that deleting a task or a company removes every copy of connection content, and a canary test makes sure that a new store cannot skip these paths ## Linked Issues or Issue Description Refs #22010 **Problem** Deleting a task leaves connection content in tool-call previews, audit history, approval requests, results passed to later runs, run transcripts (events, excerpts, result text and the run log in every copy) and saved tool results over 500,000 bytes. Deleting a company leaves run logs (object journal, archive, local file, S3 mirror) and all stored files, including attachments and saved tool results. "Delete data" on a connection also left saved tool results over 500,000 bytes in storage. **Expected behavior** Deleting a task removes the connection content of the task's runs and calls. Deleting a company removes its run logs and files from storage, not only its rows. "Delete data" removes saved tool results of the runs whose transcripts it deletes. **Steps to reproduce** 1. Let an agent call a connection on a task, so that the run has a log, events and a saved tool result. 2. Delete the task, or delete the company. 3. Look in `tool_invocations`, `heartbeat_runs`, `heartbeat_run_events` and object storage. The content is still there. ## What Changed - New table `issue_connection_content_deletions`. Task deletion records, in the same transaction and before the task row goes, the task's runs that used a connection or are still working, the task's calls without a run, and the task's call events that belong to neither. Audit entries are matched by run, call or task. The background worker then runs the existing "Delete data" steps for that scope. Runs of the task that are still working are recorded too, even if they have not used a connection yet, so a connection call they make after the deletion is also cleared. The job rechecks every 1 to 5 minutes while runs or approvals are open and finishes as soon as they settle, for up to a day. It writes an `issue.connection_content_deleted` activity entry with counts only, and only when it deleted something. - New table `stored_object_deletions`. Company deletion records every run log and every file of the company before the rows go. The table has no foreign key to the company, so the removal continues after the company is gone. Each object is retried with backoff until storage confirms the deletion. Task deletion also records the task's attached files here, so a failed best-effort delete in the route is retried. - `content-deletion.ts` stays the one owner of "remove connection content". Each job table has its own typed store (load, save, finish, activity, failure), so no per-table column can compile against the other table. The storage ledger is in `stored-object-deletion.ts`, and the task request is in `issue-content-deletion.ts`. The steps now take a scope (one connection, or the runs and calls of one deleted task). The connection path behaves as before. - "Delete data" and task deletion now also delete saved tool results over 500,000 bytes (`runner-api` assets) of each run whose transcript they delete: the object in storage and the asset row. Files attached to a task, a case or a company logo are not touched. - The canary test scans every text and JSON column and every storage copy (object journal, legacy mirror, local files and file storage) after a connection deletion, a task deletion and a company deletion. It also checks that another task and another company keep their content. - Docs: the store inventory in `doc/memory/google-connector-memory.md` has columns for task and company deletion. The production checklist, the code-fixes plan, the connector playbook and the user help page `docs/guides/board-operator/deleting-connection-data.md` are updated. ## Verification - `cd server && npx vitest run src/__tests__/tool-connection-content-deletion-canary.test.ts` (12 tests). Before the fix, the new task and company tests failed: the scan found the marker in run logs, the legacy mirror, local files, saved results and attachments. The connection test also failed on the saved tool result file. - `cd server && npx vitest run src/__tests__/tool-connection-content-deletion.test.ts src/__tests__/google-managed-connection-removal.test.ts src/__tests__/git-restore-point-ledger.test.ts src/__tests__/agent-observability.test.ts` (85 tests pass). - Nine more suites that delete tasks or companies pass (456 tests), for example `decision-target-work`, `approval-retention-work`, `cleanup-removal-service` and `tool-gateway-service`. - `pnpm --filter @paperclipai/db typecheck` passes, including the migration compatibility guard (`0501` is `online_compatible`: two new tables and their indexes). - `cd server && pnpm typecheck` passes. - `pnpm verify` exits 2 because a global CI input changed. Required CI supplies the broad coverage. ## Risks - Migration: two new tables only. The previous release does not read them, so it keeps working during the overlap deploy. - Task deletion runs three more indexed queries in its transaction. It creates a job only when the task used a connection. - Company deletion inserts one ledger row per run log and per file in its existing transaction. The storage work is batched in the background, 50 objects at a time. - Company deletion now removes all of the company's files and run logs from storage. Before, they stayed in storage with no row that pointed to them. - `stored_object_deletions` keeps `company_id` without a foreign key, like `execution_workspace_restore_points`, so that removal can finish after the company is gone. It holds object keys only, no content. - A task deletion creates a job when the task used a connection or still has a run that is working. While runs or approvals are open, the job rechecks every 1 to 5 minutes. It stops waiting one day after the deletion. It then writes `issue.connection_content_deletion_incomplete` with the counts of what was still open, and that content stays. A job that deleted nothing and left nothing open writes no activity entry. - A run of the deleted task that was still working is in the scope. If it calls a connection after the task is deleted, the job waits for it and clears that content too. - Not changed: deleting a company does not ask Google to revoke the grant. Raw provider traces still expire on their own. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use (shell, file edit, test runs). Extended reasoning on. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] 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> |
||
|
|
ad163d0e36 |
fix(ui): open and link only http(s) or same-origin URLs from user and agent content (#22639)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The board UI shows content that agents and people write: comments, tool results, work products, approval cards and runtime links > - Some of this content becomes a link, an image or a new window > - Some of these places did not limit the URL scheme, and the chat image click opened the URL without `noopener` > - A URL with a script scheme must never open or navigate from the board, because it would run with the board origin > - This pull request adds one URL helper and routes the content-fed link, image-click and window sinks through it > - The benefit is that only http(s) or same-origin URLs can open from user or agent content, and new windows never get an opener ## Linked Issues or Issue Description **What happened?** The issue-reference parser accepted a URL with any scheme when its path contained an issue path. The markdown renderer trusted that match and kept the URL. The chat image click then gave the URL to `window.open` with no scheme check and no `noopener`. Several other components had their own copies of a scheme check, and some links used content URLs with no check. **What did you expect?** The board opens or links only http(s) URLs and same-origin paths from user or agent content. New windows open with `noopener,noreferrer`. **Steps to reproduce** Render markdown with an image whose URL uses a non-http scheme and an issue path, then click the image. The new unit tests cover this case. **Impact** Defense-in-depth hardening of the board UI against unsafe URLs in stored content. ## What Changed - Add `ui/src/lib/safe-url.ts` with `safeNavigableUrl` (http(s) or same-origin), `safeExternalHttpUrl` (absolute http(s) only) and `openSafeUrl` (opens with `noopener,noreferrer`). - `parseIssueReferenceHref` in `packages/shared` now accepts only relative paths and http(s) URLs. - `MarkdownBody` keeps the issue-reference shortcut only for safe URLs. The image click handler gets only a safe URL. - The task chat image click, the work products panel and MCP app links open through `openSafeUrl`. - The plugin bridge does a top-level navigation only to an http(s) URL. - Replace the local scheme checks in the task chat thread, protocol activity row, transcript adapter, MCP app host, workspace detail pages and artifact cards with the shared helper. - Apply the helper to artifact rows, rich artifact source and download links, approval result links, request-confirmation target links, attachment links in chat bubbles, provider source links, action test result links and runtime service links. - Refresh `tests/runner-e2e/source-sdk-public-inputs.json` for the changed shared files. ## Verification - `ui/src/lib/safe-url.test.ts`: one table of hostile inputs (script, data, file, blob, about and custom schemes, whitespace and control-character variants, non-string values) runs against each helper. It also checks that `openSafeUrl` uses `noopener,noreferrer`. - `ui/src/components/MarkdownBody.interaction.test.tsx`: an image with an unsafe URL never reaches the click handler. An http image still does. This test failed before the fix (the unsafe URL reached the handler) and passes now. - `packages/shared/src/issue-references.test.ts`: non-http schemes with an issue path return `null`. These cases failed before the fix and pass now. - A headless Chromium check confirmed the risk of the old call: a script URL opened with `window.open(url, "_blank")` ran with access to the opener. With `noopener,noreferrer` it did not reach the opener. - `npx vitest run` on the affected UI folders: 116 files, 2119 tests pass. `tsc --noEmit` for `ui` has no errors in `src`. - `pnpm verify` exits 2 because the pinned-input registry changed. Required CI gives the broad coverage. ## Risks - Low risk. A link from content with a non-http scheme (for example `mailto:` in an artifact source link) no longer renders as a link in the changed components. Markdown links keep the existing `react-markdown` URL rules. - Mention chips with their own schemes (agent, project, user, skill, routine) do not change. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
06d488b430 |
fix(telemetry): report every Paperclip runner harness as its own adapter_type (#22637)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The server sends `agent.task_run` and `agent.task_completed`
telemetry. Each event has an `adapter_type` dimension with a fixed enum
in the generated telemetry contract.
> - #22324 made a Paperclip runner agent report its underlying harness
as `adapter_type`.
> - Seven harnesses that the runner can resolve to are not in the enum:
Copilot, Antigravity, AWS AgentCore, Claude Managed, Grok Bot, Muse and
OpenAI Dot. Delivery normalizes them to `other`, on open source and on
Cloud.
> - Thus, the adapter breakdown in analytics still has an `other` bucket
that no build can fix.
> - This pull request syncs the telemetry contract, which now lists the
seven harnesses, and sends Copilot as `copilot_runtime`.
> - The benefit is that every runner harness has its own `adapter_type`
value in analytics.
## Linked Issues or Issue Description
Refs #22324
**What happened?**
A Paperclip runner agent that uses Copilot, Antigravity, AWS AgentCore,
Claude Managed, Grok Bot, Muse or OpenAI Dot sends an `adapter_type`
value that is not in the generated contract enum. The value is
normalized to `other`. Copilot also sends `acpx:copilot`, which is not a
contract-style name.
**Expected behavior**
Each runner harness reports its own `adapter_type` value. Copilot
reports `copilot_runtime`, which is the name
`agentRuntimeSettingsHarness()` already uses.
**Steps to reproduce**
1. Create a Paperclip runner agent with `provider: "acpx"` and
`acpxAgent: "antigravity"` (or `"copilot"`).
2. Let the agent finish a run.
3. Look at the `agent.task_run` event. `adapter_type` is `other`.
**Paperclip version or commit**
`master` at
|
||
|
|
8f20961d20 |
fix(claude-local): accept every copy hint key in the setup-token prompt parser (#19211)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The "Connect a model" step signs in to a Claude subscription. The
server runs `claude setup-token` in a PTY. The parser reads the output
for the authorization URL.
> - Claude Code prints a copy hint between the URL and the code prompt.
The key in the hint depends on the host terminal. The server passes its
environment to the child, so the terminal that started Paperclip decides
the hint.
> - The parser accepts only `Hold Shift while selecting…` on one line.
Claude Code also prints `Fn`, `Option`, and `Shift (Option in iTerm2, Fn
in Terminal.app)`. The long hint wraps across two rows.
> - For these hints the parser returns `null`. The UI stays on
"Preparing browser sign-in…" with no error until the 5-minute timeout.
> - This pull request accepts the four key phrases and joins a hint that
wraps.
> - The benefit is that sign-in works on macOS, over SSH, and in tmux,
screen, or zellij. The parser still fails closed for all other text.
## Linked Issues or Issue Description
Refs #17868. The macOS comment on that issue shows this symptom:
`local/check` returns `sign_in_required` with no `authorizationUrl`.
This PR fixes the copy hint part of that issue. It does not fix the
token parse part (#17276).
Related PRs. I searched all open PRs that change `setup-token-parse.ts`:
- #15550 (merged) added the one-line `Shift` hint.
- #16988 and #18560 (open) accept a `Shift` hint only. A comment on
#16988 reports the long `Shift (Option in iTerm2, Fn in Terminal.app)`
hint under tmux on WSL2. Neither PR accepts that hint, and neither
accepts `Fn` or `Option`.
- #17276 (open) reads the token from the rendered screen. That is the
next step after this one. The two changes do not overlap, and both are
necessary. With this PR alone, the sign-in link shows, but the token
step can still fail (see Verification).
**What happened?**
On macOS, the connect step shows "Preparing browser sign-in…" and never
shows the sign-in link. The `claude setup-token` child is alive. It
prints the URL and the code prompt.
**Root cause**
Claude Code 2.1.317 selects the hint key with this logic (paraphrased
from the CLI bundle):
| Condition | Key in the hint |
|---|---|
| `TERM_PROGRAM=Apple_Terminal` | `Fn` |
| `TERM_PROGRAM=iTerm.app`, `LC_TERMINAL=iTerm2`, or VS Code/Cursor on
macOS | `Option` |
| a known terminal such as xterm, kitty, or WezTerm | `Shift` |
| other: SSH session (`SSH_CONNECTION`), multiplexer (`TMUX`, `STY`,
`ZELLIJ`), or macOS | `Shift (Option in iTerm2, Fn in Terminal.app)` |
`findBrowserCodePrompt` returns `null` when the first non-blank line
after the URL is not the prompt and not the `Shift` hint.
**Steps to reproduce**
1. On macOS, start Paperclip from Terminal.app, from iTerm2, or from a
shell with no `TERM_PROGRAM`.
2. Open onboarding. Select Connect a model → Claude (Subscription).
3. The UI stays on "Preparing browser sign-in…".
**Paperclip version or commit**
`master` at
|
||
|
|
78e4f4f130 |
feat(runner): Antigravity on ACP 1.5.2 with Linux, API-key auth and Gemini 4 Neon (still pending) (#22591)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The native Runner starts each agent harness and owns its lifecycle, credentials and recovery > - Google Antigravity is Google's only first-party coding harness, and it is the harness for Gemini 4 Neon > - The Runner had an Antigravity integration, but only as a pending candidate: ACP server 1.4.3, macOS ARM64 only, Google sign-in only, closed unless an operator opened it for one company and one model > - Cloud sandboxes run Linux and use API keys, so the candidate could not run there, and it had one attended test cell > - This pull request moves the integration to ACP server 1.5.2, makes it run on Linux and with a Gemini API key, adds the tests the other ACPX harnesses have, and removes the code paths that would block recovery after release > - The benefit is that the release of Antigravity becomes a small declaration change after the live suites pass. The profile stays `pending` in this pull request. ## Linked Issues or Issue Description Refs #98 Refs #6559 Refs #8523 Refs #21121 (a separate legacy-style `agy_local` adapter that uses the CLI print protocol; this pull request does not replace or include it) ## What Changed **Runtime** - Pin Antigravity ACP server 1.5.2 (was 1.4.3). Owned admission patch is `1.5.2-paperclip.2`. - Verified patched closures for `darwin-arm64`, `linux-x64` and `linux-arm64`. `darwin-x64` stays inventory-only. - The patcher reads Mach-O and ELF builds. It signs macOS output only. One admission source serves all platforms. - Platform gates in TypeScript, Rust, the sidecar schema and the server admit each host that has a verified closure. **Auth and models** - Gemini API-key auth reaches an exact-model session receipt. Admission accepts a model only when the base model and the thinking level both match the requested ID. - API-key connections get a model list on local and cloud environments. The list is generated at build time from the pinned runtime. The server starts no process to read it. - Gemini 4 Neon, Carbon, Argon and Hydrogen are selectable. The picker marks them "needs a paid Gemini API plan" for API-key connections. - One shared module maps model ID to family and thinking level. - `google/gemini-4-neon` is added to the OpenCode model list. A new model audit is in `doc/adapter-model-audit-2026-11-22.md`. **Lifecycle and failures** - A provider error no longer completes the turn. The driver classifies it: overloaded, rate limit, quota, auth rejected, model unavailable. - Overload retries are bounded (3 attempts, about 14 seconds). - A refused session reload maps to incompatible saved state, so the automatic replacement conversation applies. - Server gates that refused restart recovery, remote targets and shared state for Antigravity now apply only while the profile is pending. - A Google sign-in connection with a cloud environment is refused at save and at Test, with a plain message. - A released profile rejects candidate grants in TypeScript and in Rust. **Launch cost and integrity (all native ACPX providers)** - Each closure is verified one time into a sealed read-only store. Later launches check file identities and hash the exact executable they start. - Remote provider-pack verification is recorded per sandbox lease. Later runs check kernel identity and fall back to the full hash on any difference. - Superseded stores are removed in the background after a launch. **Provider pack and image** - The provider pack carries Antigravity for `linux-x64` as a candidate provider. It becomes an ordinary provider from the profile status alone. - The Daytona image build accepts the candidate. A credential-free smoke runs in the build. **Tests and CI** - New `antigravity-qualification` suite: 24 cells, local and Daytona. - New model lineup suites: 14 API-key cells and 14 Gemini 4 cells. Each cell requires the exact model in the Runner receipt. - Antigravity can run the `chat-features` cases with `--profile runner-acpx-antigravity`. - `runner-full-stack-e2e.yml` passes `GEMINI_API_KEY` for the new profile and derives candidate providers from the selected Daytona cells. **Docs** - `doc/plans/2026-11-22-antigravity-qualification.md` is the current release contract, acceptance ledger and operator recipe. ## Verification Commands that passed on the final revision: - `pnpm build` - Typecheck for all packages, including the runner-e2e test projects - `pnpm test:e2e:runner:unit`: 11,665 Vitest tests passed, 25 skipped; 386 node tests passed - `cargo test -p paperclip-runner-core -- --test-threads=4`: 1,199 passed, 2 failed. The 2 failures are Codex transport timing tests that pass alone and on `master`. - `cargo fmt --check`, `check:acpx-profiles`, `check:protocol-types`, `node scripts/check-maps.mjs` - Native patch tests: 9 of 9 on `darwin-arm64` and 9 of 9 on `linux-x64` - UI picker tests: 397 of 397 Known failures that also fail on `master`: - 11 runner package script tests (browser, Pi and package-boundary checks) - 6 `runtime-selection` tests that read an untracked local skill file Live evidence, without a prompt: - Clean provisioning on `darwin-arm64` and on `linux-x64` in a Daytona sandbox. The closure digests reproduce. A changed or missing file is rejected. - `initialize` reports 1.5.2. An API-key session returns a receipt for exactly `gemini-3.8-flash-low` and the exact instruction bytes, on both platforms. - All 28 model IDs (14 Gemini 3, 14 Gemini 4) return an exact receipt under an API key. - A session survives a process kill and resumes in a new process with exact receipts, on both platforms. - The server's remote path verifies the provider pack in a Daytona sandbox. - Run start to native `initialize`: 3.45 s to 1.46 s on macOS, 3.65 s to 1.74 s on Linux x64, before the per-launch executable hash was restored (about 60 ms on macOS; not measured on Linux). - Remote pack verification on a reused sandbox lease: about 4.3 s to about 0.25 s. Live evidence, with a prompt, on an already-released harness: - Pi native, `pi-native.runner-acpx-pi.local.agent-files-fresh-run`, on `darwin-arm64` at `427e9b088b`: 1 of 1 passed, 14 of 14 checks, both native runs succeeded (25.5 s and 25.7 s). The process started from the new launch store with no fallback warning. - The same cell and `native-pending-controller-restart` failed in the paid workflow on this branch and on `master` in the same way, before any native start. The workflow does not install the Pi runtime for local cells, so the agent setup check fails. That is a workflow gap, not part of this change. **Not run.** No Antigravity prompt completed on 1.5.2 on any platform. The only Gemini key available is on the free tier, and Google returned 503 or 429 for each attempt on two days. These gates are open: - All 24 `antigravity-qualification` cells - Both model lineup suites, including inference on Gemini 4 Neon - The attended Google sign-in journey on 1.5.2 - The chat cases under Antigravity - Image pull time and startup time on a published image - A native start on `linux-arm64` - A live provider-death cell for Kimi, Pi or Copilot on the new launch store (one ordinary Pi cell passed live; see above) ## Risks - **The launch store changes how every native ACPX provider starts** (Kimi, Copilot, Cursor, Pi), not only Antigravity. A review found two defects in the first version (an executable swap was possible, and Pi launches broke). Both are fixed with tests. One live Pi cell passed on this branch on macOS. No live provider-death cell and no Linux cell ran for those providers. - The profile digest changes. Saved Antigravity candidate sessions and existing candidate grants stop working. The new release refuses old state by name and starts a replacement conversation. - The Linux provider pack and the Daytona image grow by about 834 MB (about 274 MB compressed) when Antigravity is included. - The pack verification record is in server memory. The first run after a server restart pays the full hash again. - Antigravity 1.5.2 reads the workspace `GEMINI.md` and `AGENTS.md` as user rules. This is deliberate and matches Codex. Any other rule file is refused. - Orchestrator mode is not available. ACP server 1.5.2 does not expose it. - Antigravity stays `pending`. Normal users cannot run it until a later change removes the pending status. ## Model Used - Claude Fable 5.2 (`claude-fable-5-2`) planned, briefed and integrated the work, with tool use. - Claude Opus 5.5 (`claude-opus-5-5`) subagents wrote the code and ran the tests, 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
17ccf6bd2e |
fix(runner-tests): stop the host-control test wrapper from aborting at exit (#22624)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The paperclip-runner package has a live test that starts the native
runner through a Python wrapper, `test/support/private-host-control.py`
> - The wrapper has a daemon thread that reads frames from stdin. This
thread stays blocked in `readline` after the native child exits
> - At interpreter shutdown, Python must close stdin. The blocked thread
holds the stdin buffer lock, so Python aborts with "could not acquire
lock ... at interpreter shutdown, possibly due to daemon threads"
(SIGABRT)
> - On macOS, each abort opens a "Python quit unexpectedly" dialog. Long
unattended agent sessions run this test many times and leave tens of
dialogs (59 crash reports on one machine)
> - This pull request makes the wrapper exit with `os._exit` after it
flushes its receipts
> - The benefit is a clean wrapper exit and no crash dialogs on
developer machines
## Linked Issues or Issue Description
**What happened?**
Each run of `src/live/runnerd-codex-transport-release-resume.test.ts`
aborts its Python wrapper with SIGABRT at exit. On macOS each abort
opens a crash dialog. The crash reports show `_enter_buffered_busy` in
`_io__Buffered_close` during `_Py_Finalize`, with a `forward` thread
blocked in `_buffered_readline`.
**Expected behavior**
The wrapper exits with code 0 and no crash report after it emits the
`exited` receipt.
**Steps to reproduce**
1. On macOS or Linux, start `python3
test/support/private-host-control.py /bin/sh -c "sleep 0.3"` in a new
process group with stdin as an open pipe.
2. Keep stdin open after the child exits.
3. The wrapper ends with SIGABRT.
**Paperclip version or commit**
master at
|
||
|
|
28c11084ad |
test(runner): wait for the background task notification turn before the next Claude turn (#22522)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Paperclip Runner converts raw Claude ACP session updates the same way ACPX does. One test proves this against the real Claude ACP bridge. > - The test runs four turns. The third turn starts a background command (`sleep 1`). When that command ends, Claude starts its own task-notification turn. > - The test starts to record raw updates before ACPX sends the next prompt. If the notification turn arrives in that window, the test records it. ACPX correctly does not give it to the prompt. The two lists then differ. > - This race stopped the Release for |
||
|
|
856f14e507 | fix(dashboard): scope areas and responsibilities to each user (#22513) | ||
|
|
2b8d92c769 |
build(deps-dev): bump @cloudflare/workers-types from 5.20261114.1 to 5.20261117.1 in /scripts/typecheck-sandbox-providers (#19570)
Bumps [@cloudflare/workers-types](https://github.com/cloudflare/workerd) from 5.20261114.1 to 5.20261117.1. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/cloudflare/workerd/releases">@cloudflare/workers-types's releases</a>.</em></p> <blockquote> <h2>PGO profiles</h2> <p>The profiles that optimize the Linux release builds (build/pgo/README.md). Don't delete them: build/pgo/profile.json names one of them, as may older commits that are built again.</p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/cloudflare/workerd/commits">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
b4cea5b5a4 |
fix(runner): show disk exhaustion before recovery errors (#22448)
Show the confirmed sandbox disk failure before a later lost-turn or restore error in saved run errors and both run detail views. Preserve the original diagnostics and leave scarce inodes available when preparing the existing runner relaunch reserve. Verified focused regressions, scoped typechecks, and full CI on the reviewed revision, including Runner checks and all eight end-to-end shards. Greptile is 5/5 with all review findings resolved. Co-Authored-By: Paperclip <noreply@paperclip.ing> |
||
|
|
611dc68581 |
fix(runner): continue a lost turn on a resumed warm session (#22447)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents in a managed sandbox run under the Paperclip runner (`runnerd`). When `runnerd` exits mid-run, the transport relaunches it, and the runner restores the same conversation > - #22235 lets the execution that started a turn send one continuation turn when the restored runner reports that turn as `provider_turn_lost_on_restore` > - That rule applies only to a session that the execution opened fresh (`!recovered`). A run that resumes the warm conversation of its previous run is a recovered session. A chat follow-up does this on every new message > - So a resumed session that loses its own task turn gets no continuation. The run fails, and the user must press Retry > - This pull request makes the task turn that this execution started its own turn, whether the session was opened fresh or resumed > - The benefit is that a chat follow-up keeps its conversation and workspace after a mid-run `runnerd` restore, as #22235 intended ## Linked Issues or Issue Description Refs #22235 (continue a turn lost to a mid-run runnerd restore). Refs #22068 (disk reserve). Refs #22239 (stop retrying a run that filled its sandbox disk). **What happened?** On staging, an agent in a chat task filled its 10 GiB managed sandbox disk. It fetched the full history of a large Git repository and searched it. `runnerd` exited with `failed to create private durable state temporary file: No space left on device (os error 28)`. The disk reserve let the transport relaunch `runnerd`, and the runner restored the same conversation. Then the runner reported `turn.failed {code: provider_turn_lost_on_restore, recoverable: true}` for the turn that this run had started. The runtime did not send the continuation turn. The run failed as `sandbox_disk_full` with the message "The runner restored the conversation after process loss, but the previous turn is no longer active." A manual Retry on a fresh provider session finished the work. The run started from the warm checkpoint of the previous run in the same conversation (`startup reuse: provider_session (reused)`, then `session.resumed` with the same provider session id). `loadWarmNativeCheckpoint` rebinds that checkpoint to the new run and clears its turns. `executeNativeSession` recovers it, so `recovered` is true. The run then starts its own task turn. `restoredInThisExecution` required `!recovered`, so that turn could not be continued. **Expected behavior** When a mid-run `runnerd` restore loses the task turn that this execution started, the execution sends one continuation turn in the restored conversation. This applies to a fresh session and to a resumed warm session. **Steps to reproduce** 1. Run a native agent through `paperclip_runner` in a managed sandbox, as a follow-up on an existing conversation (a warm resumed session). 2. During the turn, make `runnerd` exit, for example by filling the sandbox disk. 3. The transport relaunches `runnerd`, and the runner reports the turn as lost on restore. 4. The run fails instead of continuing the turn. ## What Changed - `packages/paperclip-runner/src/native-session-runtime.ts`: `restoredInThisExecution` no longer requires a fresh session. The turn id that this execution records when it starts its task turn is now enough. - The execution records that turn id only for a turn that carries the task work. A disposition-only recovery turn (the turn that asks only for `paperclip_finish` after a completed turn) is still not continued, as before. - All other guards stay: one continuation per run, the provider allowlist, no compaction or goal runs, no pending runtime requests, no saved semantic result, and the snapshot must show that same turn as restart-interrupted. The control-plane restart claim path (`restoredAtStartup`) does not change. - `native-session-runtime.test.ts`: three new cases for a recovered warm session: - it continues its own task turn once after a mid-run restore; - it does not continue a lost turn that it never started; - it does not continue a lost disposition-only recovery turn. ## Verification - Red before the fix: `npx vitest run src/native-session-runtime.test.ts` in `packages/paperclip-runner` failed `continues its own turn on a resumed warm session once when runnerd is restored mid-execution` with `NativeProviderTerminalFailure` (`code: native_provider_terminal_failed`, `providerCode: provider_turn_lost_on_restore`). This is the same failure as on staging. - Green after the fix: the same file has 303 passed, 1 failed. The one failure is `settles a governed wait through real Runner shutdown after a missing Codex terminal`. It needs the Rust `paperclip-runnerd` binary (`ENOENT runner/target/debug/paperclip-runnerd`). It fails the same way before and after the change. - The existing `requires the control plane restart claim` and `does not continue a lost turn this execution never started` cases still pass. - To prove that the disposition-only guard is necessary, I removed it locally. The new disposition-only case then failed (the run continued). I put the guard back. - `native-session-runtime.provider-turn.test.ts`: 36/36 passed. The Codex driver provider-turn, recovery, stale-generation and terminal-replay suites and `terminal-call-freshness.test.ts` passed. - Not run locally: `src/live/runnerd-restart-continuation.test.ts`. It needs the real Rust `runnerd` binary, and this sandbox has no Rust toolchain. CI builds the runner and runs these tests. - Live acceptance: after the automatic staging deploy, a chat follow-up whose `runnerd` restarts mid-turn must show one continuation turn in the same sandbox instead of a failed run. ## Risks - **Second executor.** The continuation starts only for the turn id that this execution received from its own `startTurn` call. A turn from an earlier process, or a turn that the execution adopted, is not this execution's turn. That path still needs the control-plane restart claim. The continuation runs at most once per run (`restartContinuationStarted`). - **Disk still full.** If the continuation fills the disk again, the second lost turn finds `restartContinuationStarted` set. The run then fails as `sandbox_disk_full`, and automatic retries stay off (#22239). The worst case is the current behavior. - **Disposition-only turns.** A recovered session that only asks for the disposition does not change. This change does not add a continuation for that turn. - Low risk otherwise. The change is 1 condition and 1 assignment in the runner runtime. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use (shell, Paperclip API and Sentry connectors). ## 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 (except one test that needs the Rust runner binary; see Verification) - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes (no doc change is necessary: the runtime comment states the rule) - [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: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b6a904554d |
Load summaries for the Access Profiles index (#22456)
## Thinking Path > - Paperclip helps people manage AI agents for work. > - The Access Profiles page shows profile names, counts, and agent assignments. > - The index loaded every selector and started detail queries for each connection. > - The server can compute the displayed fields with the existing visibility and review rules. > - A summary route lets the index fetch just the data it renders. ## Linked Issues or Issue Description **What existing behavior does this improve?** Opening the Access Profiles index for a company with many assigned tools. **Current behavior** The index downloads full profiles and requests other resources used by detail views. **Proposed behavior** Fetch summaries and agents at mount. Keep the existing full-profile route for detail callers. **Reason and benefit** In a generated fixture with 166 profiles and 176,257 entries, the uncompressed response fell from 86,879,901 bytes to 58,095 bytes. The mounted query count fell from 28 to 2 with 22 connections. ## What Changed - Add the typed company summary route and its OpenAPI entry. - Compute counts with the existing projection and use the same profile visibility rules. Group equal selectors in PostgreSQL and send their profile memberships as ordinals. - Read summaries from the index. Keep profile mutations invalidating the index. ## Verification - Local UI typecheck and 27 UI tests passed. PostgreSQL projection and route tests checked count parity, delegated visibility, and rejected access. - Layered server typecheck passed. PostgreSQL tests also covered all selector types, null and unknown legacy selectors, duplicate memberships, and overlapping include/exclude rules. - On a disposable database with fresh PostgreSQL statistics, 166 profiles and 176,257 memberships, four interleaved trials per summary implementation returned identical 58,095-byte JSON responses. PostgreSQL transferred 36,338,231 bytes for flat summaries and 1,819,600 bytes for grouped summaries (95% less). Both used five statements. Median service and serialization time fell from 589 to 227 ms (564–627 ms versus 216–238 ms). ## Risks The summary still enumerates selector memberships in PostgreSQL. Grouping raised warm PostgreSQL executor time for the selector query from about 17 ms to 136–137 ms and used about 15 MiB for the temporary sort in the fixture. The smaller transfer reduced total service time in the same synthetic workload. Exact timing will vary with database resources and profile shape. ## Model Used OpenAI Codex (GPT-6), with GPT-6.2 Sol agents for implementation and local 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: Paperclip <noreply@paperclip.ing> |
||
|
|
7d8c4537f7 |
build(deps-dev): bump wrangler from 4.158.0 to 4.164.0 in /scripts/typecheck-sandbox-providers (#19571)
Bumps [wrangler](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler) from 4.158.0 to 4.164.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/cloudflare/workers-sdk/releases">wrangler's releases</a>.</em></p> <blockquote> <h2>wrangler@4.164.0</h2> <h3>Minor Changes</h3> <ul> <li> <p><a href="https://redirect.github.com/cloudflare/workers-sdk/pull/16450">#16450</a> <a href="https://github.com/cloudflare/workers-sdk/commit/5f05841d4d4a4a67fee5ddc0150309b5ed782069"><code>5f05841</code></a> Thanks <a href="https://github.com/xortive"><code>@xortive</code></a>! - Add custom CA and client certificate references to Workers VPC service TLS settings</p> <p>Workers VPC (open beta) service create and update commands accept <code>--certificate-authority</code> and <code>--client-certificate</code> UUIDs. Use either flag alone or both together. Whenever you supply either reference, explicitly choose <code>--cert-verification-mode</code>:</p> <ul> <li><code>verify_full</code>: verify the origin certificate chain and hostname (the platform default).</li> <li><code>verify_ca</code>: verify the chain but skip hostname verification, weakening origin identity checks.</li> <li><code>disabled</code>: do not verify the origin certificate; this allows connections to impersonated origins and is unsafe for production.</li> </ul> <p>For HTTP services, these settings apply to HTTPS connections, not plaintext HTTP. TCP services can use them for upstream TLS, including PostgreSQL.</p> <p>TLS settings are per-service only: host and resolver networks have no TLS settings or inheritance. Omitting TLS settings uses platform defaults (certificate chain and hostname verification). Explicit mode-only configuration, including <code>verify_full</code>, is accepted. A custom CA cannot be combined with <code>disabled</code>; a client certificate without a custom CA can.</p> <p>Upload certificates using the existing commands, then use the returned IDs below. Replace <code><ca-uuid></code>, <code><client-uuid></code>, <code><tunnel-uuid></code>, and service IDs with your own values; certificate references must be valid UUIDs. Upload replacement certificates the same way before rotating their references.</p> <pre lang="sh"><code>pnpm exec wrangler cert upload certificate-authority --ca-cert ./ca.pem --name private-ca pnpm exec wrangler cert upload mtls-certificate --cert ./client.pem --key ./client-key.pem --name private-client </code></pre> <p>Create an HTTPS service with both a custom trust chain and an mTLS client certificate, or a PostgreSQL TCP service with only a custom CA:</p> <pre lang="sh"><code>pnpm exec wrangler vpc service create private-web \ --type http --https-port 443 --ipv4 10.0.0.10 --tunnel-id <tunnel-uuid> \ --certificate-authority <ca-uuid> --client-certificate <client-uuid> \ --cert-verification-mode verify_full <p>pnpm exec wrangler vpc service create private-db <br /> --type tcp --tcp-port 5432 --app-protocol postgresql <br /> --hostname db.internal.example --resolver-ips 10.0.0.53 --tunnel-id <tunnel-uuid> <br /> --certificate-authority <ca-uuid> --cert-verification-mode verify_full </code></pre></p> <p>For client-certificate-only configuration, use <code>--client-certificate <client-uuid> --cert-verification-mode verify_full</code> instead of the certificate flags in either create command.</p> <p>Updates replace the complete service configuration, including TLS settings, in a single request, the same as <code>cf workers-vpc services update</code>. Pass every TLS option the service should keep: certificate references and the verification mode that you omit are cleared, and an update without TLS options returns the service to the platform defaults. Removing a reference releases its backend certificate binding but does not delete the uploaded account certificate. For example, rotate the web service's client certificate while keeping its CA:</p> <pre lang="sh"><code>pnpm exec wrangler vpc service update <web-service-uuid> \ --name private-web --type http --https-port 443 \ --ipv4 10.0.0.10 --tunnel-id <tunnel-uuid> \ --certificate-authority <ca-uuid> --client-certificate <replacement-client-uuid> \ --cert-verification-mode verify_full </code></pre> <p>To remove the CA while keeping the client certificate, repeat the update with only <code>--client-certificate <client-uuid></code> and a verification mode.</p> </li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/cloudflare/workers-sdk/commit/02a61779a14fe40a5626ec9d26153b93929282d7"><code>02a6177</code></a> Version Packages (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16950">#16950</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/5f05841d4d4a4a67fee5ddc0150309b5ed782069"><code>5f05841</code></a> [wrangler] Add custom CA and mTLS configuration to VPC services (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16450">#16450</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/06acbd4bd236ec272ea76c4e77a9ef2e0f395654"><code>06acbd4</code></a> Version Packages (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16915">#16915</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/d36b39d440a8f408f41dcf4925a81f2f8a58f73b"><code>d36b39d</code></a> <code>@cloudflare/build-output-utils</code> v1 RC (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16917">#16917</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/0bf81ac16041a1f47f5474f7d6f5b0da6160f76b"><code>0bf81ac</code></a> Move <code>@cloudflare/config</code> package to 1.0 RC (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16907">#16907</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/db3c071619a64e0cf267fbadd4be12708c02df2d"><code>db3c071</code></a> Stop wrangler dev from losing config changes after a reload (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16944">#16944</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/81e56ddf3e1ba28ea2320388fac86011a68f7be4"><code>81e56dd</code></a> Use effective max_instances for container rollout defaults (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16920">#16920</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/349fc4e7443aa744cbe129f84f28571bf8625155"><code>349fc4e</code></a> [miniflare] Start local Workflows from Artifacts events (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16246">#16246</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/79b890ab89a62823198a0c551c44ff647c80de4d"><code>79b890a</code></a> Version Packages (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16863">#16863</a>)</li> <li><a href="https://github.com/cloudflare/workers-sdk/commit/f005593c1ed0d1f429dafc6919c4335f4d5070c7"><code>f005593</code></a> [wrangler] Use the local Artifacts simulator when remote is omitted (<a href="https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler/issues/16735">#16735</a>)</li> <li>Additional commits viewable in <a href="https://github.com/cloudflare/workers-sdk/commits/wrangler@4.164.0/packages/wrangler">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
8a2b2f57a3 |
build(deps): bump @boxd-sh/sdk from 0.2.22 to 0.3.2 in /scripts/typecheck-sandbox-providers (#19572)
Bumps [@boxd-sh/sdk](https://github.com/boxd-sh/sdk/tree/HEAD/typescript) from 0.2.22 to 0.3.2. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/boxd-sh/sdk/commit/7bf5bf389a49323013fa65d222c15418b75732b6"><code>7bf5bf3</code></a> CLI 0.3.5, SDKs 0.3.2</li> <li><a href="https://github.com/boxd-sh/sdk/commit/f784e0440a26bc0c514f97cdb1ad4d1f44b2a1bf"><code>f784e04</code></a> Windows guests on self-hosted boxd: UEFI firmware boot, --os windows, license...</li> <li><a href="https://github.com/boxd-sh/sdk/commit/d037b1f6e9c58cde0cdaf31d04a9baf4a7bb0021"><code>d037b1f</code></a> Remove ListPlans, the retired monthly plan catalog</li> <li><a href="https://github.com/boxd-sh/sdk/commit/f2843553695415fcc47f89a300939d411ac9c8dc"><code>f284355</code></a> api: SetOrgBotProtectionDefault changes existing machines too</li> <li><a href="https://github.com/boxd-sh/sdk/commit/9736596397bdc10f6415348d4fd619846a51653a"><code>9736596</code></a> SDKs 0.3.1: computer use</li> <li><a href="https://github.com/boxd-sh/sdk/commit/5cdba5bb69cbfe0885d691440c9ad76c792f02cf"><code>5cdba5b</code></a> Computer use API and a settable screen size</li> <li><a href="https://github.com/boxd-sh/sdk/commit/0ee9437a651c746efd6a8f25d165c01a5b52dc51"><code>0ee9437</code></a> Show no balance for an org on a custom plan (comped), and cut long org names ...</li> <li><a href="https://github.com/boxd-sh/sdk/commit/9fc94e185819f2de28054b199e91a45efddf5f7f"><code>9fc94e1</code></a> boxd v2: storage engine, routed network and live migration</li> <li><a href="https://github.com/boxd-sh/sdk/commit/c4a3ee3d591977f4ffa36e6f573c9853839205b1"><code>c4a3ee3</code></a> billing: vCPU bills CPU time used, not the machine's size</li> <li><a href="https://github.com/boxd-sh/sdk/commit/d912ff453fdf5a13226d7c4e4f5c49bf490b3e61"><code>d912ff4</code></a> Raw TCP forwards stop refusing connections, and ExposePort answers once the p...</li> <li>See full diff in <a href="https://github.com/boxd-sh/sdk/commits/v0.3.2/typescript">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
5371c83152 |
fix(runner): bundle the Copilot metadata probe as a standalone entrypoint (#22436)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Paperclip Runner ships a provider pack with pinned provider runtimes and small entrypoints > - Most provider entrypoints, such as the Kimi metadata probe and the ACPX sidecar, are esbuild bundles that run as one file > - The Copilot metadata probe is plain `tsc` output that imports sibling driver modules > - So an environment that installs only selected provider-pack files cannot run the Copilot probe > - This pull request makes the Copilot metadata probe a standalone verified entrypoint, like the Kimi probe > - The benefit is that every metadata probe has the same self-contained shape, and a consumer can ship the probe as one file ## Linked Issues or Issue Description No public issue exists. This is an enhancement. **What existing behavior does this improve?** The Copilot metadata probe entrypoint (`dist/cli/copilot-metadata-probe.js`, the `paperclip-runner-copilot-metadata-probe` bin and provider-pack shim). **Subsystem affected** Paperclip Runner provider pack build (`packages/paperclip-runner`). **Current behavior** The probe is plain `tsc` output. It imports `../drivers/copilot-metadata-probe.js` and more modules. It fails when a consumer installs only selected provider-pack artifacts. The Kimi probe does not have this problem because `scripts/build-verified-provider-entrypoints.mjs` bundles it. **Proposed behavior** The build bundles the Copilot probe into one self-contained file, like the Kimi probe. The bundle still finds the pinned Copilot assets when it runs from `dist/cli/`. **Reason and benefit** Every metadata probe has the same standalone shape. A consumer can ship the probe as one file. An alternative was to ship the full `dist/drivers` tree with the probe, but that keeps the multi-file shape. **Breaking changes** None. The bin name, the output path and the probe output do not change. ## What Changed - `scripts/build-verified-provider-entrypoints.mjs`: add `copilot-metadata-probe` (source `src/cli/copilot-metadata-probe.ts`, outputs `dist/cli/copilot-metadata-probe.js` and `.cjs`) with the same format and flags as `kimi-metadata-probe`. The bundler asserts one output and only `node:` imports. - `src/cli/copilot-metadata-probe.ts`: move the top-level `await` into `main()`. esbuild cannot emit top-level `await` in the CommonJS bundle. Output and exit codes do not change. - `src/drivers/acpx/provider-assets-root.ts`: when no package root is bound, accept the bundled `dist/cli/copilot-metadata-probe.(js|cjs)` module URL for the `copilot` provider only. This is the same rule the bundled ACPX sidecar uses. Before this change, the bundle's `import.meta.url` is the `dist/cli` file, not `dist/drivers/acpx/copilot-installation.js`, so the module-URL lookup failed. The bound `PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT` path does not change. - Tests: a bundler test that runs both bundles alone in a temporary pack layout, and an asset-root test for the bundled probe path that also proves other providers do not get the new path. ## Verification - `node --test scripts/build-verified-provider-entrypoints.test.mjs` (44 tests, includes the new standalone-run test) - `pnpm exec vitest run src/drivers/acpx/provider-assets-root.test.ts src/drivers/copilot-metadata-probe.test.ts src/drivers/acpx/copilot-installation.test.ts` - `node --test scripts/kimi-metadata-probe.test.mjs scripts/provider-pack-executable-shims.test.mjs test/acpx-codex-package-contract.test.mjs` - `pnpm exec vitest run server/src/__tests__/copilot-connection-probe.test.ts` - `pnpm --filter @paperclipai/paperclip-runner run typecheck:typescript` - Manual check on darwin-arm64 with the pinned Copilot closure installed, child process spawn denied by a preload: - Bundled `.js` and `.cjs`, no bound root: installation verification passes and the probe reaches the spawn step. - Same run without the `provider-assets-root.ts` change: `COPILOT_INSTALLATION_INVALID`. - Bundled `.js` with `PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT` bound: installation verification passes. - `pnpm verify` requires broader coverage (the bundler is a broad input), so CI supplies it. ## Risks - Low risk. The bin name, output path and shim do not change. The probe output and exit codes do not change. - The new module-URL rule accepts only `/dist/cli/copilot-metadata-probe.(js|cjs)` and only for `copilot`. It resolves to the package that holds `dist/cli`, the same as the sidecar rule. - The build now also writes `dist/cli/copilot-metadata-probe.cjs`. Nothing reads it yet. > 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 - Provider: Anthropic Claude - Model: Claude Opus 5.5 (`claude-opus-5-5`) - Mode: agentic coding 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 - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1ced68c636 |
build(deps-dev): bump typescript from 5.9.3 to 7.0.2 in /scripts/typecheck-sandbox-providers (#19574)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 7.0.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/microsoft/TypeScript/releases">typescript's releases</a>.</em></p> <blockquote> <h2>TypeScript 7.0.2</h2> <p><a href="https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/">https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/</a></p> <p>This tag was originally released at: <a href="https://github.com/microsoft/typescript-go/releases/tag/typescript%2Fv7.0.2">https://github.com/microsoft/typescript-go/releases/tag/typescript%2Fv7.0.2</a></p> <h2>TypeScript 6.0.3</h2> <p>For release notes, check out the <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/">release announcement blog post</a>.</p> <ul> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.0%22">fixed issues query for TypeScript 6.0.0 (Beta)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.1%22">fixed issues query for TypeScript 6.0.1 (RC)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.2%22">fixed issues query for TypeScript 6.0.2 (Stable)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.3%22">fixed issues query for TypeScript 6.0.3 (Stable)</a>.</li> </ul> <p>Downloads are available on:</p> <ul> <li><a href="https://www.npmjs.com/package/typescript">npm</a></li> </ul> <h2>TypeScript 6.0</h2> <p>For release notes, check out the <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/">release announcement blog post</a>.</p> <ul> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.0%22">fixed issues query for TypeScript 6.0.0 (Beta)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.1%22">fixed issues query for TypeScript 6.0.1 (RC)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.2%22">fixed issues query for TypeScript 6.0.2 (Stable)</a>.</li> </ul> <p>Downloads are available on:</p> <ul> <li><a href="https://www.npmjs.com/package/typescript">npm</a></li> </ul> <h2>TypeScript 6.0.1 RC</h2> <p>For release notes, check out the <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-rc/">release announcement blog post</a>.</p> <ul> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.0%22">fixed issues query for TypeScript 6.0.0 (Beta)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.1%22">fixed issues query for TypeScript 6.0.1 (RC)</a>.</li> </ul> <p>Downloads are available on:</p> <ul> <li><a href="https://www.npmjs.com/package/typescript">npm</a></li> </ul> <h2>TypeScript 6.0 Beta</h2> <p>For release notes, check out the <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-beta/">release announcement</a>.</p> <ul> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=milestone%3A%22TypeScript+6.0.0%22+is%3Aclosed+">fixed issues query for Typescript 6.0.0 (Beta)</a>.</li> </ul> <p>Downloads are available on:</p> <ul> <li><a href="https://www.npmjs.com/package/typescript">npm</a></li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/microsoft/TypeScript/commit/1e4744d68260a7cb91b62b12edc3f6a2187faaf1"><code>1e4744d</code></a> Merge branch 'main' into ts7-release</li> <li><a href="https://github.com/microsoft/TypeScript/commit/a5a219c3b5da0db4fa0ecf6c0b1f588c9af9c669"><code>a5a219c</code></a><code>microsoft/typescript-go#4558</code></li> <li><a href="https://github.com/microsoft/TypeScript/commit/ecfe30dce91368d52c9a49b6095bb0b673a238f8"><code>ecfe30d</code></a> Update status localization</li> <li><a href="https://github.com/microsoft/TypeScript/commit/5de25b5f8fec2ca35eadaed041f1f06d2e214895"><code>5de25b5</code></a> Hide executable name in TypeScript status</li> <li><a href="https://github.com/microsoft/TypeScript/commit/d7ce74a75da2b80e8201506a1599c06549432b93"><code>d7ce74a</code></a> Show bundled TypeScript version for packaged servers</li> <li><a href="https://github.com/microsoft/TypeScript/commit/29be66a607707f90d7a53103a4469bb3015a4d54"><code>29be66a</code></a> Correct TS 7 release version to 7.0.2</li> <li><a href="https://github.com/microsoft/TypeScript/commit/ed2bd1bfa4aac5211ce4bc58fcd1313c7eddc8ff"><code>ed2bd1b</code></a> Merge branch 'main' into ts7-release</li> <li><a href="https://github.com/microsoft/TypeScript/commit/887307575c58ea640dbeba3b4e8fdb6347cd3044"><code>8873075</code></a> Bump the github-actions group across 1 directory with 3 updates (microsoft/ty...</li> <li><a href="https://github.com/microsoft/TypeScript/commit/9427131ae2d4e230a90ee8a09daac4e75da3e311"><code>9427131</code></a> Set up stable / nightly extension split, other prep (microsoft/typescript-go#...</li> <li><a href="https://github.com/microsoft/TypeScript/commit/d4eaca5460a1f5f02a829e62706794b0a6fb903e"><code>d4eaca5</code></a><code>microsoft/typescript-go#4549</code></li> <li>Additional commits viewable in <a href="https://github.com/microsoft/TypeScript/compare/v5.9.3...v7.0.2">compare view</a></li> </ul> </details> <details> <summary>Maintainer changes</summary> <p>This version was pushed to npm by <a href="https://www.npmjs.com/~microsoft1es">microsoft1es</a>, a new releaser for typescript since your current version.</p> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
f7db7312b4 |
build(deps): bump e2b from 2.62.1 to 2.64.0 in /scripts/typecheck-sandbox-providers (#20197)
Bumps [e2b](https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk) from 2.62.1 to 2.64.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/e2b-dev/E2B/blob/main/packages/js-sdk/CHANGELOG.md">e2b's changelog</a>.</em></p> <blockquote> <h2>2.64.0</h2> <h3>Minor Changes</h3> <ul> <li> <p>6a976f3: <code>e2b template list</code> and <code>e2b template delete</code> now use the SDK's <code>Template.list()</code> and <code>Template.delete()</code>. <code>TemplateInfo</code> gains <code>maxCpuCount</code> (<code>max_cpu_count</code> in Python) for resizable templates.</p> <p>Breaking: <code>e2b template list -f json</code> now prints the SDK's <code>TemplateInfo</code> objects (<code>templateId</code>, <code>buildId</code>, <code>names</code>, …) instead of the raw API response (<code>templateID</code>, <code>buildID</code>, <code>aliases</code>, <code>createdBy</code>, …), and the pretty table drops the <code>Created by</code> column (the API deprecated the creator's email).</p> </li> <li> <p>1b3b2a4: Add <code>shell</code> option to <code>commands.run</code> to run the command in a custom shell, e.g. <code>shell: ['/bin/sh', '-c']</code> runs <code>/bin/sh -c <cmd></code> (default stays <code>['/bin/bash', '-l', '-c']</code>)</p> </li> <li> <p>6ee9a4b: Add resizable templates: build a template with <code>maxCpuCount</code> and pick each sandbox's <code>cpuCount</code> on create. <code>e2b template list</code> shows a <code>Max vCPUs</code> column.</p> </li> <li> <p>106efea: The API client accepts an <code>Authorization</code> header in place of an API key. Requests can now authenticate with an OAuth access token passed through <code>apiHeaders</code> (JS) or <code>api_headers</code> (Python), together with the <code>X-Team-ID</code> header that selects the team:</p> <pre lang="ts"><code>await Sandbox.create({ apiHeaders: { Authorization: `Bearer ${accessToken}`, 'X-Team-ID': teamId }, }) </code></pre> <pre lang="python"><code>Sandbox.create(api_headers={"Authorization": f"Bearer {access_token}", "X-Team-ID": team_id}) </code></pre> </li> <li> <p>c513ae1: Add <code>Template.delete(nameOrId)</code> (JS) and <code>Template.delete(name_or_id)</code> / <code>AsyncTemplate.delete(name_or_id)</code> (Python) to delete a template or snapshot; returns <code>false</code> when it isn't found. <code>Sandbox.deleteSnapshot</code> / <code>Sandbox.delete_snapshot</code> now share its implementation and raise <code>TemplateError</code> / <code>TemplateException</code> (subclasses of <code>SandboxError</code> / <code>SandboxException</code>) on failure</p> </li> <li> <p>e50db00: Add <code>Template.list()</code> returning a <code>TemplatePaginator</code> (<code>AsyncTemplatePaginator</code> for <code>AsyncTemplate</code>) that pages through the project's templates as <code>TemplateInfo</code>, like <code>Sandbox.list()</code> and <code>Secret.list()</code>.</p> </li> </ul> <h3>Patch Changes</h3> <ul> <li>cf7208a: Bump <code>@connectrpc/connect</code> and <code>@connectrpc/connect-web</code> to ^2.3.0 (HTTP/2 stream cleanup and cancellation fixes) and <code>glob</code> to ^14.0.3</li> <li>Updated dependencies [aec4543] <ul> <li><code>@e2b/dockerfile-utils</code><a href="https://github.com/0"><code>@0</code></a>.1.2</li> </ul> </li> </ul> <h2>2.63.0</h2> <h3>Minor Changes</h3> <ul> <li>a8155c4: Add <code>strict</code> to <code>pause()</code> (default <code>false</code>). With <code>strict: true</code> / <code>strict=True</code> a pause is refused with <code>ServiceBusyError</code> / <code>ServiceBusyException</code> while the sandbox's guest agent does not respond, and the sandbox keeps running. Without it the API's default applies: the memory snapshot is taken anyway and marked. Sandbox info exposes the mark as <code>envdUnresponsiveAtPause</code> / <code>envd_unresponsive_at_pause</code>, and resuming such a sandbox without <code>onResume: 'reboot'</code> / <code>on_resume="reboot"</code> now throws <code>GuestUnresponsiveError</code> / <code>GuestUnresponsiveException</code>.</li> </ul> <h2>2.62.2</h2> <h3>Patch Changes</h3> <ul> <li>08f05bb: Fix <code>TypeError: fetch failed</code> / <code>NGHTTP2_ENHANCE_YOUR_CALM</code> on concurrent <code>files.write()</code> calls. Node's HTTP/2 client queues each request body in full against a 10 MB per-session memory budget and resets the stream whose response arrives while it is exhausted; since undici 8 every envd request of a process shares one session, so parallel or large uploads reset each other and the reads next to them. <code>files.write()</code> uploads now go over HTTP/1.1 on a pool of their own (one request per connection, no shared budget; <code>E2B_ENVD_UPLOAD_CONNECTIONS</code>, default 50), and an envd dispatcher whose HTTP/2 session Node reports as out of memory is retired and replaced instead of failing every later request. Nothing is retried: a failed write may already have been applied.</li> <li>1ad3f76: Template builds hash <code>copy()</code> files in 1 MB chunks instead of reading each file fully into memory, cutting peak memory for large files. Hashes are unchanged, so existing build caches stay valid.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/e2b-dev/E2B/commit/607e4a6d6fca19ad49c090b40a6db0853165af2a"><code>607e4a6</code></a> [skip ci] Release new versions</li> <li><a href="https://github.com/e2b-dev/E2B/commit/1b3b2a4b078ffb4c3f6197e03019686b7da644dd"><code>1b3b2a4</code></a> feat(sdk): add shell option to commands.run (<a href="https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk/issues/2138">#2138</a>)</li> <li><a href="https://github.com/e2b-dev/E2B/commit/02176c1a00013ddd8f128a3b5766f0f4ae1b989b"><code>02176c1</code></a> test: stabilize auto-resume pause and CLI template pagination tests (<a href="https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk/issues/2129">#2129</a>)</li> <li><a href="https://github.com/e2b-dev/E2B/commit/6a976f3d3d1c12a7baac348b3255abefe10b874a"><code>6a976f3</code></a> feat(cli): use SDK Template.list and Template.delete in template commands (<a href="https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk/issues/2">#2</a>...</li> <li><a href="https://github.com/e2b-dev/E2B/commit/77343ca2d36081fb47ca78f7addf1c2b2dc69241"><code>77343ca</code></a> refactor(cli): type the workspace-api client with openapi-typescript + openap...</li> <li><a href="https://github.com/e2b-dev/E2B/commit/e50db000621409e5c4021ac6b2b80156441a0f69"><code>e50db00</code></a> feat(sdk): add Template.list() returning a TemplatePaginator (<a href="https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk/issues/2099">#2099</a>)</li> <li><a href="https://github.com/e2b-dev/E2B/commit/c513ae17f64b2894d4722d5b2215f52a47f331a2"><code>c513ae1</code></a> feat(sdk): add Template.delete (<a href="https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk/issues/2098">#2098</a>)</li> <li><a href="https://github.com/e2b-dev/E2B/commit/6ee9a4bd3c6a6f7ed69ca27138d28acda970dc39"><code>6ee9a4b</code></a> feat(sdk,cli): resizable templates (<a href="https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk/issues/2117">#2117</a>)</li> <li><a href="https://github.com/e2b-dev/E2B/commit/106efea7e260f752b478709e5fbc5ce0ce6a35ce"><code>106efea</code></a> feat(sdk): accept an Authorization header in place of an API key (<a href="https://github.com/e2b-dev/e2b/tree/HEAD/packages/js-sdk/issues/2102">#2102</a>)</li> <li><a href="https://github.com/e2b-dev/E2B/commit/cf7208ad85d5a747ba50ddf4e3bbdd364e4851bf"><code>cf7208a</code></a> chore(deps): scheduled patch/minor dependency updates for js-sdk / cli / pyth...</li> <li>Additional commits viewable in <a href="https://github.com/e2b-dev/e2b/commits/e2b@2.64.0/packages/js-sdk">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
0e5e7a9ea3 |
build(deps-dev): bump @cloudflare/workers-types from 4.20260702.1 to 5.20261114.1 in /scripts/typecheck-sandbox-providers (#20198)
Bumps [@cloudflare/workers-types](https://github.com/cloudflare/workerd) from 4.20260702.1 to 5.20261114.1. <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/cloudflare/workerd/commits">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
dce4d47f60 |
feat(plugins): carry Grok, Copilot and OpenCode credentials to plugin Runners (#22359)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Environment-driver plugins can run `paperclip_runner` tasks on hosts
that the plugin owns
> - Core transfers the selected managed AI credential to the plugin as a
typed task credential
> - The credential contract has only two types: a Codex auth file and a
direct Claude credential
> - Grok, GitHub Copilot and OpenCode agents in a task-capable plugin
environment therefore fail closed, although the Runner already reads
their credentials from its environment
> - This pull request adds one generic, allowlisted environment
credential for these three harnesses and accepts the Runner's Grok
launch settings
> - The benefit is that plugin-provided Runner execution can run Grok,
Copilot and OpenCode agents with their selected connection
## Linked Issues or Issue Description
**Subsystem affected**
Plugin environment tasks (`packages/plugins/sdk` task contract) and
plugin-provided Runner execution in `server`.
**Problem or motivation**
An agent with the Grok, Copilot or OpenCode harness cannot run in a
plugin environment that runs Runner tasks. Core stops at credential
preparation with "Plugin Runner does not support the selected credential
provider". A Grok agent fails before that point too. The Runner emits
`grokEffort` and `grokDisableWebSearch` in its launch requirements (Core
turns off Grok web search by default), but the strict `settings` schema
of `environmentRunnerLaunchRequirementsSchema` rejects both keys.
**Proposed solution**
Core transfers the selected connection's credential variables for these
harnesses through one typed `provider-env` credential. Each provider has
a fixed allowlist of complete variable sets. The plugin sets the
variables in the Runner process environment.
**Alternatives considered**
One credential type per harness (`grok-env`, `copilot-env`,
`opencode-env`). This adds a type for each new harness. One generic type
with an exported allowlist keeps the same strictness with less surface.
**Roadmap alignment**
The roadmap lists Grok and OpenCode as supported harnesses. This change
lets plugin environments run them. It adds no new product concept.
**Additional context**
Grok subscription login (an auth file with refresh and writeback) is out
of scope. It still fails closed, with an error that names the xAI API
key as the supported option.
## What Changed
- `packages/plugins/sdk`: Added the `provider-env` task credential: `{
type: "provider-env", provider: "grok" | "copilot" | "opencode",
environment }`. The environment must contain exactly one complete
variable set for the provider and no other variable. Values are
non-empty, NUL-free and at most 65,536 characters, as for the other
credential types.
- `grok`: `XAI_API_KEY`
- `copilot`: `COPILOT_GITHUB_TOKEN`
- `opencode`: `OPENROUTER_API_KEY`, or `PAPERCLIP_AI_PROVIDER_URL` with
`PAPERCLIP_AI_PROVIDER_KEY`
- `packages/plugins/sdk`: Exported the allowlist as
`ENVIRONMENT_TASK_PROVIDER_CREDENTIAL_KEY_SETS` and the
`PluginEnvironmentTaskCredentialProvider` type. `claude-env` and
`codex-auth-json` do not change.
- `packages/plugins/sdk`: Added `grokEffort` (`minimal` to `xhigh`) and
`grokDisableWebSearch` (boolean) to the launch requirements `settings`,
with the types that the Runner uses.
- `server`: `preparePluginRunnerCredentials` now transfers the selected
connection's variables for the `grok`, `copilot` and `opencode`
harnesses, with the same account identity semantics as the Claude
branch. It refuses a Grok subscription, a Grok base URL override, and an
incomplete or ambiguous set. The error never contains a credential
value.
- `server`: The submit check now matches a `provider-env` credential to
the task harness. Before, it treated every non-Codex credential as
Anthropic.
- Drift test:
`server/src/__tests__/plugin-runner-credential-names.test.ts` checks the
SDK key sets against the Runner. The SDK list stays written by hand, and
the Runner keeps its own lists of forwarded names. For `grok` and
`copilot`, each name must be in `ACPX_CREDENTIAL_NAMES`, survive sidecar
admission with the session binding that the Runner mints, and reach the
agent process. The binding requirement must match the Rust sidecar's
candidate agents. For `opencode`, each name must be in the OpenCode
proxy environment set. Each name must also be in the Rust sidecar
credential keys or the Rust OpenCode provider keys. The test reads those
from the Runner source, as the Codex security test does. A provider
without a Runner route fails the test.
`OPEN_CODE_RUNNER_ENVIRONMENT_KEYS` is now exported for this test.
- Docs: Added a "Typed credentials" section to
`doc/plugins/PLUGIN_ENVIRONMENT_TASKS.md`. It also documents the ACPX
credential binding that the Runner requires with a Copilot token.
Updated `doc/plugins/PLUGIN_RUNNER_EXECUTION.md`.
## Verification
- `npx vitest run tests/environment-task-release-resume.test.ts
tests/environment-tasks.test.ts` in `packages/plugins/sdk`: 96 passed.
The tests accept each valid shape. They reject mixed sets, two sets,
extra variables, another provider's variable, empty values, NUL bytes,
oversized values, unknown providers and extra fields, on `submit` and on
`resume`. They also check that every published allowlist set parses.
- `npx vitest run
src/services/native-runtime/plugin-runner-credentials.test.ts
src/__tests__/environment-task-runtime.test.ts` in `server`: 79 passed.
The new tests cover each provider's transfer, Grok subscription refusal,
Grok routing refusal, the fail-closed cases without value leaks, harness
matching at submit, and Runner-built Grok requirements
(`runnerProviderLaunchRequirements`) that parse through the task
contract and produce a Grok launch.
- `npx vitest run src/__tests__/plugin-runner-credential-names.test.ts`
in `server`: 4 passed. I broke each list locally to confirm that the
test fails: a renamed SDK key, an SDK provider without a Runner route,
and a dropped name in the Rust sidecar keys, the Rust candidate agents,
the Rust OpenCode keys and the TypeScript OpenCode keys. Each change
failed the test.
- `node scripts/typecheck-layers.mjs` in `server` (includes
`src/__tests__`): no errors.
- `npx vitest run
server/src/services/native-runtime/plugin-runner-probe.test.ts` (from
the root): 15 passed.
`server/src/services/native-runtime/plugin-runner-task.test.ts`: passed.
- `tsc --noEmit` for `packages/plugins/sdk` and `server`: no errors.
- I did not run the full suite locally. CI supplies that coverage.
## Risks
- Low risk for existing plugins. The change only adds a credential type
and two optional settings. A plugin that does not handle `provider-env`
gets a typed value that it does not recognize. Before this change, Core
failed these runs before it called the plugin.
- A plugin must set `PAPERCLIP_ACPX_CREDENTIAL_BINDING` for a Copilot
task. Otherwise the Runner refuses the token. The new doc section shows
the value.
- An OpenCode gateway connection without a key (`auth: none`) still
fails closed, because every value must be non-empty.
> 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`) by Anthropic, 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
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
16dfa200ac |
fix(environments): clean up an unconfirmed setup sandbox and answer a provider outage with 503 (#22377)
A provider outage during an interactive custom-image setup start left a provisional sandbox with no cleanup owner, and the raw RPC error reached the HTTP error handler as a 500 crash report. - Keep the creation-cleanup envelope and create status for environmentStartInteractiveSetup errors at the worker RPC boundary. - Record an in-scope unconfirmed setup sandbox as a pending-cleanup lease that the existing sweep destroys. - Pin failed-creation cleanup (probe and teardown) to the plugin that created the sandbox. - Answer a transient provider refusal with 503 environment_provider_unavailable instead of a crash report. Co-Authored-By: Paperclip <Paperclip-Paperclip@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
414abc2dbf |
fix(execution-target): give a failed Git context probe a stable error code (#22093)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Before an agent run starts on a remote execution target (sandbox or SSH), Paperclip runs a small probe that reads the Git context of the remote workspace > - When that probe fails, it throws a plain `Error` with one fixed message and no code > - Run-failure reporting groups failures by error code, never by message. So these failures share one Sentry group with every other setup failure that has no code > - The thrown error also drops the exit facts of the probe. Nobody can see from the run why the probe failed > - This pull request gives the probe failure a stable code and a bounded reason > - The benefit is a separate, correctly named Sentry group for this failure, and run records that show why the probe failed ## Linked Issues or Issue Description **What happened?** On staging, many runs failed during setup with "Could not read execution-target Git context". The burst occurred during a sandbox provider outage. These failures had no error code. The Sentry fingerprint for run failures uses the error code, the adapter, the phase and the root error code or class name. Because the message is deliberately not in the fingerprint, these failures went into the same group as unrelated setup failures. The probe also discarded its exit code, timeout and signal, so the cause of each failure was not recorded. **Expected behavior** A failed Git context probe has a stable error code, so it gets its own Sentry group. The error message names a bounded reason (exit code, timeout, signal, or incomplete or invalid output), so the run record shows why the probe failed. The probe output is never included, because it can contain credentials and paths. **Steps to reproduce** Run `prepareGitHubExecutionEnvironment` with a remote target whose command runner returns a non-zero exit code, a timeout, a signal, or output without the probe frame. On current master the error has no `code` and no reason. ## What Changed - `packages/adapter-utils/src/execution-target.ts`: add `EXECUTION_TARGET_GIT_CONTEXT_UNAVAILABLE_CODE` (`execution_target_git_context_unavailable`). The three probe failure paths now throw an `Error` with this code. The message keeps the old prefix and adds a bounded reason: exit code, timeout, signal, or incomplete or invalid output. - The probe output is never put in the message. - An error that the command runner throws itself (for example a provider HTTP error) is not changed. It keeps its own code and status. - The success condition is not changed. - `packages/adapter-utils/src/github-launcher-environment.test.ts`: add tests for each failure reason, a test that the probe output does not leak into the message, and a test that a runner error passes through unchanged. ## Verification - `vitest run packages/adapter-utils/src/github-launcher-environment.test.ts packages/adapter-utils/src/execution-target*`: 273 tests pass, including the 6 new tests. - Red/green: on the unfixed source, 5 of the 6 new tests fail. The runner-error test passes on both, as intended, because it checks behavior that must not change. - `tsc --noEmit -p packages/adapter-utils/tsconfig.json` passes (sources and tests). - One existing test, "preserves local host credential helpers and validates worktree metadata", fails in my local sandbox on unmodified master too. It depends on the local Git configuration. CI covers it. ## Risks - Low risk. Only the error that the probe throws changes. The success path and the conditions for failure do not change. - `resultJson.failureCause` for these runs becomes `execution_target_git_context_unavailable` instead of `Error`. No code compares `failureCause` with `Error`. - New Sentry events for this failure go to a new group. The old shared group stops receiving them. > 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 - Anthropic Claude Opus 5.5 (`claude-opus-5-5`), used as an agent with tool use and code execution (shell, Git, Vitest). ## 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c41145e72a |
fix: wait on pending questions and quiet provider holds (#22363)
## Thinking Path > - Paperclip manages agents and the tasks they work on. > - Recovery should continue unfinished work when it is eligible. > - An active unanswered question is a persisted reason to wait for a person. > - Treating a later Retry as an answer makes the recovery sweep repeatedly request continuations that admission refuses. > - Provider-limit holds also produce one cancellation toast per task, even though provider work never started. > - This PR aligns recovery with persisted interaction status and presents these waits accurately. ## Linked Issues or Issue Description Refs: #20466. This addresses the question blocker presentation and automatic recovery loop; it preserves the existing interaction-resolution policy. Related work: #19420 schedules provider quota retries, and #21570 handles notices and reply ownership in agent chats. This change concerns assigned-task reconciliation, task/inbox status, and per-run cancellation toasts. **What happened?** The assigned-work sweep ignored pending interactions whenever a newer run carried `explicitUserContinuation`. Continuation admission still refused the pending question, so repeated sweeps recorded unsuccessful continuation attempts. The task could meanwhile show an older provider error as its current blocker. Separately, each pre-dispatch provider-limit hold generated a cancellation toast, and the one-hour fallback was described as a known reset and promised start time. **Expected behavior** Wait quietly while the question remains active under the shared interaction eligibility rules, then react to the existing resolution notification. Dismissed or historical ordinary questions remain answerable without blocking work; governed requests keep their gates. Show the current question on task and inbox surfaces. Keep provider failure history, suppress cancellation toasts for expected provider holds, and describe scheduled availability checks without promising the provider will accept work. **Steps to reproduce** 1. Leave an `ask_user_questions` interaction pending with `supersedeOnUserComment: false`. 2. Create a later failed/interrupted explicit Retry and run assigned-work reconciliation repeatedly. 3. Observe that the question remains pending while the sweep attempts fresh continuations. 4. Separately, let an agent with recent provider rate-limit evidence receive automatic task wakes without a reported reset time. ## What Changed - Remove inferred question supersession from both assigned-work fact loading and candidate selection. Use the existing active-interaction predicate consistently in those reads, fresh-continuation admission, and the task projection. Cover dismissed/historical ordinary questions, retained governed gates, repeated checks, idle workers, and the existing resolution notification. - Add the `question` interruption action, load active pending question IDs alongside approvals in one company-scoped query, and show that blocker on tasks and inbox rows. Preserve a supported manual Retry after a failed attempt, suppress duplicate actions for saved input, and keep other current user gates authoritative. This preserves the existing issue-detail SQL statement budget. Historical run failures remain intact. Refresh the shared source SDK input pin. - Suppress cancellation toasts specifically for cancelled `provider_limit_wait` runs. Label provider retry deadlines as availability rechecks, retain relative-time formatting, and record successful scheduling as an informational lifecycle event. - Document the wait contract in the continuation architecture guide. ## Verification - Demonstrated failing regressions before the implementation: continuation loop, task projection, task notice, cancellation toast, provider deadline wording, and deadline formatting. - Initial focused Vitest qualification: 642 tests passed across 14 files, using: ```sh pnpm exec vitest run \ server/src/__tests__/{assigned-work-invariant,assigned-work-recheck-idle,heartbeat-provider-limit-wait,task-interruption-query}.test.ts \ server/src/services/{task-interruption-presentation,execution-projection,fresh-continuation-fallback,issue-thread-interactions}.test.ts \ server/src/services/recovery/assigned-work-invariant.test.ts \ ui/src/{components/ExecutionBlockerNotice.test.tsx,context/LiveUpdatesProvider.test.ts,context/LiveUpdatesProvider.hook.test.tsx,lib/provider-limit-message.test.ts,pages/Inbox.test.tsx} ``` - `pnpm --filter @paperclipai/shared typecheck` — passed. - Review follow-up: 157 tests passed in `assigned-work-invariant`, `task-interruption-query`, and `fresh-continuation-fallback`; 575 passed in `task-interruption-query`, `assigned-work-recheck-idle`, `task-interruption-presentation`, `issue-question-context`, `issue-thread-interactions`, and `explicit-native-continuation` (the query file overlaps). The strengthened final dismissed/historical/governed projection regression also passed separately. - Final query-consolidation verification: 157 tests passed across five files, including the unchanged 64-statement issue-detail census and mixed approval/question batches: ```sh pnpm exec vitest run \ server/src/__tests__/{issue-detail-statements,task-interruption-query,assigned-work-invariant,assigned-work-recheck-idle}.test.ts \ server/src/services/task-interruption-presentation.test.ts ``` - `pnpm --filter @paperclipai/server typecheck` — passed, including test layers. - Manual-recovery follow-up: 204 tests passed across seven projection/recovery/notice suites, and all 104 Inbox tests passed. The lost-runner integration still starts exactly one run from a manual Retry and leaves the question unanswered. The saved-decision census verifies one decision batch query for a 41-task list, with at most three statements referencing interactions; the overall 64-statement issue-detail limit remains unchanged. - `pnpm --filter @paperclipai/ui typecheck` — passed. - `pnpm --filter @paperclipai/ui build` — passed. - `node tests/runner-e2e/source-sdk-public-inputs.mjs $(git rev-parse HEAD) --check` — passed. - `pnpm verify` — exit 2: broader CI is required for changed global inputs. Focused tests and package checks supply local evidence; broad CI remains required. - `git diff --check` and a local secret/instance-data scan — passed. - Final CI on `1c16fe7c0d8`: [trusted CI workflow](https://github.com/paperclipai/paperclip/actions/runs/44650155842) passed, including all server shards, native-server verification, build, canary, e2e, release registry, and serialized suites. All PR checks are complete, with no failures; the branch is conflict-free. - Greptile reviewed the latest revision, `1c16fe7c0d8`, at 5/5 with no actionable findings or unresolved review threads. The focused tests cover genuine provider failures, live work and terminal tasks, unchanged task locks/retry delivery, preservation of historical failures, and question resolution waking the affected task while other active pending questions remain quiet. Review regressions also cover dismissed/historical ordinary questions retaining Retry and governed requests retaining their gates. No live task was retried or answered for validation. ## Risks - An active pending question now consistently blocks automatic assigned-work recovery. Shared interaction eligibility determines when ordinary conversation input becomes deferred or historical; governed requests retain their authority. Automatic recovery no longer infers that a newer Retry resolved an active question. - Manual Retry keeps its existing admission policy and recovery checks. The question notice preserves that supported action after a failed attempt without changing approval or credential authority; pending saved input prevents duplicate actions. - The shared interruption action gains `question`; the task and inbox consumers are updated together. The pending-question query returns only task IDs and uses the existing company/task/status index. - Provider cooldown policy, quotas, credentials, routing, cancellation history, and durable retry timing are unchanged. The actual provider can still return a rate limit at the recheck. - No migration is required. Existing large owner modules receive small localized changes; no code file crosses 1,000 lines. ## Model Used OpenAI `gpt-6.1-sol` through the Codex harness in T3 Code, xhigh reasoning effort, with code execution and 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 linked existing issues or described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links - [x] My branch name describes the change and contains no internal 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> |
||
|
|
19a7381398 |
feat: restore personal archiving in task views (#22358)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - People use Tasks to see shared work and manage the work that needs their attention. > - The old inbox already let each person archive a task and undo that action. > - The combined Tasks surface needs the same controls in Unread and in task table rows. > - The existing inbox archive rules determine when new activity brings a task back. > - This pull request adds an Archived view so people can find and restore their archived tasks. ## Linked Issues or Issue Description **What existing behavior does this improve?** Personal task archiving in Tasks. Related work includes the combined Inbox and Tasks surface (#15100), the Coordinator workspace (#17983), moving Mine into Tasks (#19363), and the existing inbox archive rules (#9931). **Subsystem affected** Cross-cutting. The UI and task list API reuse the existing inbox archive state. **Current behavior** Mine has an archive action. Unread and the task table have no equivalent action. The Tasks menu has no dedicated view for restoring archived tasks. **Proposed behavior** Add Archive and Undo to the task views. Let people restore tasks from Archived. Keep archived tasks available in All tasks. **Reason and benefit** People can clear their personal lists and still find the original task. **Breaking changes** The task list API adds an optional archive filter and viewer archive field. Existing callers use the same response and filters unless they opt in. ## What Changed - Reuse the current inbox archive and restore actions, activity rules, and authorization. - Add Archive and Restore to task table rows, Archive and Undo to Unread, and a personal Archived view. - Give each archived task its own Undo control, including when people archive tasks quickly. - Add tests for the archive list, account isolation, new activity, row actions, and Undo. - Document the archive flow and API filter. Refresh the generated SDK source input registry. ## Verification - Passed 287 focused tests in 12 Vitest files. These cover the task views, row actions, archive cache, and PostgreSQL routes. - Passed local server and UI typechecks. The source input registry check also passed. - Reproduced a missing Undo action when archiving two tasks in a row. After the fix, the 158 task and inbox tests and the 2 toast tests passed. - On macOS with Chrome, archived a task from Mine and restored it using Undo. Archived another task from All tasks, reloaded Archived, restored it, and verified its Todo status and return to Mine. - A human tester also verified Archive, Undo, and Restore in the local browser. - On commit `c5526fd9b1`, GitHub's [verification](https://github.com/paperclipai/paperclip/actions/runs/44630156078/job/135950130662) and [browser tests](https://github.com/paperclipai/paperclip/actions/runs/44630156078/job/135946228919) passed. A targeted retry passed after the first attempt hit a watchdog self-test failure and two cancelled jobs. - [Greptile scored 5/5](https://github.com/paperclipai/paperclip/pull/22358#issuecomment-7024083610) on the same commit. Both review threads are resolved. ## Risks - An incorrect visibility rule could hide a task from a personal list. The archived filter uses the same activity predicate as Mine. The PostgreSQL test covers isolation between people and resurfacing after a reply. - The archive state is already stored per person and company. No database migration is required. ## Model Used - OpenAI Codex, GPT-6, with shell, code editing, and browser verification tools. The serving model ID and context size were unavailable in this session. ## 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> |
||
|
|
28043f8b93 |
Measure database and projection costs in runtime tool discovery (#22347)
## Thinking Path > - Paperclip starts agent turns with instructions for the connections the agent can use. > - The gateway reads the connected-tool catalog during prompt preparation. > - A single discovery span currently covers both database waits and descriptor construction. > - Maintainers need to distinguish these costs before changing catalog reads. > - This change records the transaction, both queries, availability checks, and descriptor construction. ## Linked Issues or Issue Description **Subsystem affected** — Runtime tool discovery and run preparation. **Problem or motivation** — The existing catalog span cannot explain time spent before a remote turn starts. **Proposed solution** — Measure the existing read in place. Record the number of entries and connections returned. **Alternatives considered** — A local microbenchmark cannot reproduce a hosted database or a deployed catalog's sizes. A change to the query would confound the measurement. **Roadmap alignment** — This adds diagnostic detail to an existing operation. Related work includes #14864, which bounded catalog memory use. **Additional context** — The PostgreSQL reads share one read-only snapshot. ## What Changed - Add a transaction span with children for the entry read and the matched-connection read. - Attach the two returned row counts to that transaction. - Time availability checks and descriptor construction under the existing catalog discovery span. - Document which preparation timings can also reach the native run event table. ## Verification - Ran the gateway listing-memory, discovery HTTP, and execution timing context suites with local PostgreSQL. All 30 tests passed. - Checked the parentage and row counts with a real OpenTelemetry exporter in memory. - Ran the standing-instruction integration suite and measured the catalog from two staging application containers with read-only database sessions. ## Risks Each recorded catalog operation adds up to five spans. The existing per-phase bound applies. Only the OTel transaction span includes the aggregate row counts. With or without OTel, the existing native preparation timing path can also persist a run event for each new phase that takes at least 50 ms, subject to its normal caps. The executor defers those writes. The database query, tool eligibility, and authorization contracts stay the same. ## Model Used OpenAI Codex directed and qualified the work. GPT-6.2 Sol implemented the instrumentation and regression test. ## 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 |
||
|
|
b7177db6aa |
fix(telemetry): report a Paperclip runner agent's underlying harness as adapter_type (#22324)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The server sends product telemetry. Two events describe agent work:
`agent.task_run` and `agent.task_completed`.
> - Each event has an `adapter_type` dimension. The generated telemetry
contract gives this dimension a fixed enum.
> - A Paperclip runner agent stores `paperclip_runner` as its adapter
type. The enum does not have this value.
> - The collector and Cloud direct delivery change a value that is not
in the enum to `other`.
> - Thus, as more agents use the runner, the adapter breakdown in
analytics becomes mostly `other`. The data is not lost, but it is in one
bucket.
> - This pull request makes a runner agent report the harness that it
runs, for example `claude_local` or `codex_local`.
> - The benefit is that the adapter breakdown shows the real harness
again.
## Linked Issues or Issue Description
Refs #8818 (this PR added the generated telemetry contract and its
`adapter_type` enum).
I did not find an existing issue. This is the bug description:
**What happened?**
`agent.task_run` and `agent.task_completed` send the stored
`agents.adapter_type`. For a Paperclip runner agent, this value is
`paperclip_runner`. The `adapter_type` enum in
`packages/shared/src/telemetry/generated/paperclip-telemetry.ts` does
not include `paperclip_runner`. The telemetry normalizer changes the
value to `other`. In analytics, almost all runner agent events show
`adapter_type = other`.
**Expected behavior**
A runner agent reports the harness that it runs. The server already
resolves this harness with `agentHarnessType()` from
`@paperclipai/shared`. For example, a runner agent with the Claude ACP
configuration must report `claude_local`.
**Steps to reproduce**
1. Create a Paperclip runner agent (`adapterType: "paperclip_runner"`).
2. Let the agent complete a heartbeat run, or let it set a task to
`done`.
3. Look at the `agent.task_run` or `agent.task_completed` event.
`adapter_type` is `paperclip_runner` before delivery, and `other` after
normalization.
**Paperclip version or commit**
`master` at
|
||
|
|
deacaf727c |
feat(connections): guided AWS role setup with a per-connection CloudFormation template (#22233)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The AWS connector (#22195) lets agents use AWS with credentials minted per connection. Its role method stores no AWS keys > - That method needs the customer to create an IAM role that trusts exactly one Paperclip connection, but setup only offered the generic form and a doc > - The connect API also refused the draft step this method needs, so the role method could not be set up through the UI at all > - This pull request adds a guided setup screen. Paperclip saves a draft, hands the user a prompt for their own agent that creates the role, takes back the role ARN the agent reports, and tests the same draft. CloudFormation and IAM steps are there under "Or do it by hand" > - The benefit is that a person can connect AWS without stored keys and without typing account details, using a template AWS has validated ## Linked Issues or Issue Description Refs #22195. **Subsystem affected** Connections (AWS connector setup), UI, tool-access API. **Problem or motivation** The AWS role method must save a connection before AWS can trust it. The API rejected `saveDraft` for every method except custom MCP servers, so the UI could not complete this flow. There was also no screen that showed the issuer, the subject, the trust policy or a template. **Proposed solution** - The connect API accepts `saveDraft` for methods that declare `credentialMinter`. - `GET /tool-connections/:id/aws-setup` returns the setup values and a CloudFormation template generated for that connection. - A new `AwsRoleSetup` step runs between saving the draft and testing it. The role is named after the connection and CloudFormation fills in the account, so the first form no longer asks for a role ARN; the user pastes it back once the role exists. **Alternatives considered** - A one-click CloudFormation quick-create link. Rejected: AWS accepts quick-create templates only from Amazon S3, so Paperclip would need to host a public template bucket. The screen offers a download and a console link instead. - Instructions in a doc only. Rejected: too many hand-copied values. - Asking for the role ARN up front. Rejected: the role does not exist yet, so users had to invent an ARN and then match it exactly. - Letting the user's agent report the role ARN to Paperclip itself, through a short-lived link. Not done here: it needs a new unauthenticated endpoint (and a Paperclip Cloud front-door change). The user pastes the ARN instead. ## What Changed - `packages/shared`: - The `saveDraft` validation allows methods with minted credentials. - New `AwsConnectionSetup` type. - `server/src/services/connectors/aws/setup.ts` builds the setup values: - The issuer, audience and connection subject. - The provider host and the trust policy. - A CloudFormation template with an optional identity provider (`CreateIdentityProvider`), a role named `paperclip-<connection id>`, `AccessPolicyArn` (`ReadOnlyAccess` by default for read-only connections) and `AWSMCPSignInOAuthAccessPolicy`. The account comes from CloudFormation, so the template needs no edits. - The service method `getAwsSetup` and the route `GET /api/tool-connections/{connectionId}/aws-setup`: - The route requires `connections:configure`. - It returns 422 for a connection that is not an AWS role connection. - It reports whether the issuer key is published and any role ARN already saved. - It returns `available: false` (`address_changed`) when the instance address changed after the draft was saved, since a role set up for the old address could never pass the test. - It is registered in OpenAPI. - UI: - The AWS form no longer shows a Role ARN field (it is hidden with an empty default). - `AwsRoleSetup.tsx` shows, by default, only "Set it up with your agent" (a copyable prompt that checks the AWS account, deploys the template with `aws cloudformation deploy`, and reports the role ARN) and a field to paste that ARN. "Or do it by hand" reveals the CloudFormation steps (download, console link, parameter notes, IAM acknowledgement) and the IAM console / AWS CLI steps with copyable values; the CLI commands read the account ID themselves. - It shows an access-key message when AWS cannot reach the instance, and asks the user to save again when the instance address changed. - Failed tests appear in place. AWS error codes show the server's own plain message, because the shared error copy replaces every 502 with "temporarily unavailable". - `useAwsRoleSetupStep` owns the AWS sequence; `ConnectionSetupFlow` only asks it for request options, hands back results and renders its step: - The first Connect for `aws-role` saves a draft and opens the AWS step. - "Test connection" resumes the same draft with the pasted role ARN. - Back keeps the draft, so a later Connect updates it and does not create a second one. Returning to an unfinished draft reopens the step. - Docs: the `doc/connections/AWS.md` setup section and the plan's phase table. The SDK public input pins are refreshed. ## Verification - `server/src/__tests__/aws-mcp-connector.test.ts` covers a new API-level case through the real route validation: - Saving an `aws-role` draft over HTTP works without a role ARN, and stores the keys the screen uses to reopen it. - `aws-setup` returns the issuer, subject and the connection's role name. - The template's trust condition keys equal `<issuer host>:aud` and `<issuer host>:sub`. - The template provider URL equals the issuer. - After an address change it returns `address_changed`, and saving the draft again records the new address. - An access-key connection returns 422. - No response field looks like a secret. - `ui/src/features/connections/AwsRoleSetup.test.tsx` covers: - Only the agent setup shows by default; Test connection stays off until a valid role ARN is pasted, then sends it. - A saved role ARN is filled in. - The by-hand steps and CLI commands; the agent prompt for read-only and full access. - The template download (filename and object URL cleanup). - The unreachable-instance message. - The in-place error and the address-changed message. - The AWS message mapping. - `ui/src/pages/apps/AppsConnect.test.tsx` covers the full two-step flow: the form has no Role ARN field, the first Connect sends `saveDraft: true` with no role ARN and does not finish, the AWS step loads the setup, and "Test connection" resumes `aws-draft` with the pasted role ARN and finishes. A second test reopens the step for a returning draft. - Red/green: - Removing the API change fails the API test. - Removing the draft-first wiring fails the flow test. - Totals: server AWS, OpenAPI and connector tests (75), shared `app-definitions` (42), UI connections and apps pages (1108). Typecheck is clean for shared, server, UI (except Storybook's generated catalog, which this worktree has not built) and all four server test-tree layers. - Browser, on a real dev server with an HTTPS public address: - AWS appears in Connectors with its logo. - The form has only region and access level. Connect saves the draft (reusing an earlier one) and shows only the agent prompt and the role ARN field; "Or do it by hand" reveals the CloudFormation and IAM steps. - The copied prompt names the connection's role and stack, and the template. - Test connection with a pasted role ARN showed AWS's refusal in place (no such role, placeholder issuer), as expected. An earlier run found the generic 502 copy problem, which is fixed and re-checked. - AWS CloudFormation `validate-template` (dev account, read-only) accepts the current generated template (role named after the connection) and reports `CAPABILITY_NAMED_IAM`. The screen tells the user to acknowledge it. - Not run: an agent actually running the prompt and creating a stack in AWS, and Paperclip Cloud staging. ## Risks - The feature is still behind `enableAwsConnector` (off by default). No migration. - The template creates IAM resources in the customer's account, and the customer must acknowledge that. The role trusts only this connection's subject. - If the customer already has an identity provider for the issuer and leaves `CreateIdentityProvider` at true, AWS fails the stack with a clear error. The screen explains the parameter. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use (shell, file edits, the in-app browser against a local dev server, AWS CLI `validate-template` in the dev account, an exploration subagent). ## 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> |
||
|
|
575ef12575 |
feat(responsibilities): file company skills under responsibilities (#22275)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - A responsibility shows the skills of the agents doing its work. People cannot say which skills a responsibility needs. > - The maintainer chose to file skills under responsibilities like projects, tasks and routines. > - Agents also need to set a skill's catalog details without rewriting its SKILL.md. > - This pull request lets people and agents file, move and remove company skills under a responsibility, and adds `update_skill_details`. > - The benefit is that a responsibility lists the skills it needs, beside the skills its agents already hold. ## Linked Issues or Issue Description Refs #22253, #22261 and #22274; this pull request is stacked on them. **Subsystem affected** Database (`responsibility_links`), shared types and validators, server responsibility service and routes, Dashboard versions, native runner tools, and the responsibility page UI. **Problem or motivation** Skills under a responsibility are only computed from the agents doing its work. A person cannot record that "Hiring needs interviewing", and an agent cannot file a skill when it maps work for a person. **Proposed solution** Add a nullable `skill_id` to `responsibility_links` and allow it as the one target of a link. Show filed and computed skills together. Let the file, unfile, lookup and link routes and tools take skills. Keep filed skills in Dashboard versions so undo covers them. Add a small live tool for a skill's tagline and categories. **Alternatives considered** Keeping skills computed only, and giving the skill to the agent that runs the responsibility, was the other option. It was not chosen. Extending `update_skill` would change its scenario contract, whose mock needs `markdown`, so the details tool is separate. ## What Changed - Review fixes: the default responsibility view's Skills "+" adds an existing skill, removes a filed one, or opens an agent's skills page. A newest Dashboard version without a skill list is upgraded in place, so the first skill filed after it is undone. Undo files again, or removes, only skills the restoring person can see. A read scope without a skill condition sees no filed skill. `update_skill_details` with only `skillId` is a no-op, as its schema allows. - Migration `0499`: add `responsibility_links.skill_id` (FK to `company_skills`, on delete cascade). Widen the single-target check to four targets. Add a unique `(responsibility_id, skill_id)` index and a `skill_id` index. The migration is idempotent and online-compatible (NOT VALID then VALIDATE, and the indexes are built CONCURRENTLY). It is listed in `MIGRATIONS_WITH_TOP_LEVEL_STATEMENTS`. - Shared: `ResponsibilityLink.skillId`; `ResponsibilitySkillSummary.linkId` and `computed`; `skillId` in the link and lookup schemas; `skill` in `RESPONSIBILITY_FILE_ITEM_KINDS`; optional `skillIds` in Dashboard snapshot links. - Server: filing checks the reader's skill visibility (`skillAccessService`). The detail merges filed and computed skills into one card each. Lookup accepts `skillId`. Dashboard capture, restore and summary include filed skills. A version without `skillIds` leaves filed skills as they are when it is restored. - Tools: `file_under_responsibility`, `remove_from_responsibility` and `find_responsibilities_for` accept `kind: "skill"`. `get_responsibility` returns `linkId` and `computed` for each skill. Add `update_skill_details` (tagline and categories). - UI: the responsibility page has "Add existing skill". A filed skill shows "Filed here" and a remove button. Computed skills keep their holders. ## Verification - Server: the `responsibilit*` tests (new: file, find, move and unfile a skill; one card for a skill that is both filed and computed; undo of a filed skill from the Dashboard history), `skill-tools.test.ts` (new `update_skill_details` cases), `responsibility-tools`, `routine-tools`, `routines-routes`, `paperclip-runner-tool-authority`, `runner-api` and `openapi-routes`: 24 files, 2723 tests passed. - UI: responsibility page and component tests (16 files, 158 tests, including a new filed-skill test) pass. `pnpm --filter @paperclipai/ui typecheck` passed. - `@paperclipai/db` `check:migrations` passes and reports the override. The snapshot drift test passes. `tsc` passes for `db`, `shared` and the server layers. - Runner: catalog and semantic-tool tests (317) pass. All generator checks pass. ## Risks - The migration changes a check constraint on `responsibility_links`. The replacement accepts every row that the old check accepted. It is swapped as NOT VALID and then validated. The previous release never sets `skill_id`. - Deleting a company skill removes its links (cascade). - Filed skills follow the reader's skill visibility. A skill the reader may not see is not listed. ## Model Used Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
b7319eb581 |
feat(routines): let agents list and change their person's routines in plain terms (#22274)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Routines are recurring work that an agent runs on a schedule, webhook or request. People file them under their responsibilities. > - #22253 and #22261 let agents read and change areas and responsibilities. Agents still have no dedicated routine tools, and they can change only routines assigned to themselves. > - When a person says "move my weekly digest to Monday mornings" or "map my routines to my responsibilities", the agent must use the generic API, write cron, and it is refused for the person's routines. > - This pull request adds `list_routines` and `update_routine`. It also lets an agent change routines that the person its run works for is responsible for. > - The benefit is that an agent can find routines under no responsibility, file them, and change their schedule in plain terms. Each change is a routine revision the person can restore. ## Linked Issues or Issue Description Refs #22261 (phase 2; this pull request is stacked on it), #22253 (phase 1). **Subsystem affected** Server (routine routes, native runner tool authority), the native runner tool catalog, and the `paperclip` skill. **Problem or motivation** An agent can list and change only its own routines through the generic API. It cannot change the schedule of a routine its person is responsible for. It must write cron expressions, and it cannot find the routines that are filed under no responsibility. **Proposed solution** Make the existing scenario operation `list_routines` live, with filters for words, status, agent, project, responsible person, a responsibility and "unfiled". Add `update_routine` for the title, instructions, agent, project, status, priority, a plain `schedule`, and filing under a responsibility. Let an agent manage a routine when the person its run works for is responsible for it. Handing the routine to another agent needs that person to have `tasks:assign`. **Alternatives considered** A new `routines` permission grant would add a setting with no current need. Routine revisions already give an undo path, so this change adds no new history. ## What Changed - `list_routines` is now live (it was a scenario-only mock) and keeps its scenario mock. - Add `update_routine`. A `schedule` such as `{ frequency: "weekly", dayOfWeek: "monday", time: "09:00", timezone }` maps to the routine's schedule trigger through the existing routine-offer cadence helpers. `schedule: null` turns the schedule off. `fileUnder` files the routine under a responsibility. - Add `server/src/services/routine-tools.ts`. It calls the routine routes with the run token. Fields and schedule go in one `PATCH /routines/:id` (one transaction and revision, guarded by `baseRevisionId`); filing follows, and if it fails after the routine changed the tool reports what was saved. Each part reports its own undo: the routine revision, or the Dashboard history for filing. - `PATCH /routines/:id` takes `schedule` (`{ cronExpression, timezone? }` or `null`) and replaces the schedule under the routine row lock, so racing changes leave one schedule. Without a zone it keeps the current schedule's, else uses the person's saved time zone, else answers 422. - `GET /companies/:companyId/routines` filters `q`, `status`, `assigneeAgentId`, `responsibleUserId`, `responsibilityId` and `unfiled=true` in SQL. - In `routes/routines.ts`, an agent may manage routines assigned to itself or routines its person is responsible for. On a routine the agent does not run, taking it from another agent (or handing it on), turning it on, changing its schedule (also through the trigger routes), starting a run, or restoring a revision requires that person's `tasks:assign`, as for a person. The person must have directed the run (see #22261). `routine.updated` activity records `onBehalfOfUserId`. - The routine and responsibility routes share one rule, `agentPersonInCompany` in `routes/agent-person-authz.ts`. - The catalog keeps each live action's `requiredClaims` (`list_routines` is `routines:read`). - The routine tools stay visible when Responsibilities is off. Only `responsibilityId`, `unfiled` and `fileUnder` need it. - Update `search_api` tool pointers, the routines reference, the skill section, the chat directive, the operation-groups spec and the pinned counts. ## Verification - Server: `routine-tools.test.ts` (new), `routines-routes.test.ts` (new: an agent changes its person's routine, hands it off only with `tasks:assign`, and is refused for another person's routine), the `responsibilit*` tests, `paperclip-runner-tool-authority` and `runner-api`: all pass. The first test in `routines-routes.test.ts` (Fireflies) times out at 15 s in my sandbox on a cold import, with or without this change. It passes with `--testTimeout=60000`. - Server `node scripts/typecheck-layers.mjs`: passed. - Runner: catalog, semantic-tool, eval, scenario and permission-policy tests (316) pass. All generator checks pass. ## Risks - Medium-low. Agents get write access to their person's routines. The route still checks the company, the routine revision guard and `tasks:assign` for a hand-off. The person can restore any earlier routine revision. - `list_routines` changes from a scenario-only mock to a live tool, so the reconciled catalog counts change. ## Model Used Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
c0aa7751f8 |
feat(responsibilities): let agents change areas and responsibilities for their person, with undo (#22261)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - People keep their areas and responsibilities in Paperclip (experimental, `enableResponsibilities`). #22253 lets agents read them. > - Agents can still only propose. They cannot rename or archive an area, change an active responsibility, let one go, or move work between responsibilities in one step. > - A person who says "file my weekly routines under Sales" must then do it by hand. > - The maintainer chose this rule: an agent may make each change that its person could make, the person can undo it from the Dashboard history, and a permanent delete still needs the person's yes on a card. > - This pull request adds eight change tools and the server rules behind them. > - The benefit is that an agent maps work to responsibilities for the person, and the person keeps control through undo and the delete card. ## Linked Issues or Issue Description Refs #22253 (phase 1; this pull request is stacked on it). **Subsystem affected** Server (responsibility and area routes, Dashboard versions, native runner tool authority), shared validators and Dashboard types, the native runner tool catalog, the `paperclip` skill, and the Dashboard history UI. **Problem or motivation** An agent that works for a person can only propose areas and responsibilities. It cannot change active ones, archive or delete them, or move filed work in one step. Unfiling needs link IDs. There is no way for the person to undo an agent's change. **Proposed solution** When an agent acts for the person its run works for (`onBehalfOfUserId`) and that person directed the run (the run's own task is one they made, such as their chat, or their own message woke it; parent tasks do not count), apply that person's own rights: their own responsibilities, or anyone's for a company owner or admin; areas for any active member. Save each such change as a version of the person's Dashboard, so the existing history and Undo line show it under the agent's name. Make a permanent delete wait for an accepted confirmation card that the agent posted. Add `file` and `unfile` routes that take items by kind and ID, with an optional move. **Alternatives considered** One card for every change, or propose-only. The maintainer chose "act for me, with undo". A separate undo journal would need a new table and a new UI; Dashboard versions already have both. A new version cause needs a check-constraint migration; this change uses `change_set` with no `interactionId` instead. ## What Changed - Add tools `create_area`, `update_area`, `delete_area`, `create_responsibility`, `update_responsibility`, `delete_responsibility`, `file_under_responsibility` and `remove_from_responsibility`. They are standard-mode only and hidden while Responsibilities is off. - Add the writer rule for agents in `routes/agent-person-authz.ts` (`agentPersonInCompany`, `agentActsForResponsibilityOwner`), used by `routes/responsibilities.ts` and `routes/responsibility-areas.ts`. The person must have directed the run: a person can name anyone as a task's responsible person, and a run can also work for a routine's person or the company default, so those runs do not borrow that person's rights. An agent with no such person keeps the old propose-only rules. - The response names only the version of the responsibility's owner (for area changes, the acting person's), and `X-Paperclip-Dashboard-Owner` says whose history holds it; tools return `dashboardOwnerUserId`. A change Undo cannot reverse (the name, description, order or un-archiving of an area other people's proposed or active responsibilities share) saves no version and is not reported as undoable. - `/file` without `moveFrom` follows the `/links` rule, so `create_responsibility` with `fileItems` works for a proposal. - A title-only create is allowed for an acting agent. It is active by default and records the agent in `proposedByAgentId`. - Add `responsibility-agent-changes.ts`. In one transaction that holds each affected owner's Dashboard lock, it saves the dashboard before the change (when a person changed it by hand), runs the change on services bound to that transaction, and saves the result as a `change_set` version by that agent. The response names the version in `X-Paperclip-Dashboard-Version`. The tools say Undo only when a version was saved. - Dashboard snapshots now also hold each responsibility's filed items, description, "run by" agent, evidence, health override and note, and each area's description (optional fields). Restore puts them back. Older versions still restore as before. A matching older version is upgraded in place, so the first change after it compares and undoes in full. - Create and update accept `areaTitle`. The server finds or makes that area in the same transaction, so a refused change leaves no area. Agent creates reuse a live responsibility with the same title under a lock, so retries and parallel calls make no copies. - Add `POST /api/responsibilities/:id/file` (`items`, optional `moveFrom`: an ID or `all`) and `POST /api/responsibilities/:id/unfile` (`items`), each in one transaction. - Agent deletes need `confirmationId`: an accepted `request_confirmation` card that this agent posted, with target key `responsibility-delete:<id>` or `responsibility-area-delete:<id>`. Someone who may manage the owner must accept it, on the card or by a verified chat reply. The tools post the card (named after the item), return `awaiting_confirmation`, and delete on the next call after acceptance. - `DELETE /api/responsibility-areas/:id` accepts `moveResponsibilitiesTo`. Area changes and deletes save versions for everyone whose Dashboard shows the area. - Agent activity details now include `onBehalfOfUserId`. The Dashboard history shows "<agent>, for you" for these versions. `ResponsibilityDashboardVersionSummary` now has `interactionId`. - Update the OpenAPI registry and metadata, the `search_api` tool pointers, the skill, the API reference, the chat directive, the operation-groups spec, and the pinned counts and SDK source pins. ## Verification - Server: `vitest run` of the `responsibilit*` tests, `responsibility-tools.test.ts`, `openapi-routes`, `runner-api*`, `paperclip-runner-tool-authority` and `task-markdown` all pass. New tests cover these cases: acting-agent create, update and undo; file, move and undo; the rule for a person who may not manage the owner; delete only after an accepted card, including a verified chat reply; area delete with move and a version for the other owner; undo of a health override, an area description and an un-archived empty area; upgrade of an older version; an area by title that a refused change rolls back; parallel creates. - UI: `DashboardEditModule.test.tsx` and `responsibility-dashboard.test.ts` passed. `pnpm --filter @paperclipai/ui typecheck` passed. - Server `node scripts/typecheck-layers.mjs` passed. - Runner: catalog, semantic-tool, eval, protocol-action and permission-policy tests (284) passed. All generator checks pass. - I did not run the browser e2e suite locally. ## Risks - Medium. Agents that work for a person can now change and archive that person's responsibilities and areas without a card. Every change is a Dashboard version that the person can restore, and a delete still needs the card. - Undo restores titles, sentences, areas, order, status, filed items, description and the "run by" agent. It does not restore a bar or metric change; those stay in the metric history. - A restore of a version from before this change does not touch filed items, which matches the earlier behavior. - Undo of a rename or archive of an area that other people also use keeps its name, as the existing restore rule does for shared areas. - Manual edits do not take the Dashboard lock. A person's edit that commits while an agent's change is open can appear in that agent's version. - Changes to proposed or let-go responsibilities are not on a Dashboard, so they cannot be undone there. The tools say so. ## Model Used Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ffcd49f6aa |
feat(responsibilities): let agents read a person's areas and responsibilities (#22253)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - People keep their areas and responsibilities in Paperclip (experimental, `enableResponsibilities`). Agents chat with them about this work. > - Agents have no dedicated tool to read a person's responsibilities. The only path is the generic `search_api` and `call_api` fallback. > - That path needs the person's user ID, and nothing in a chat tells the agent that responsibilities exist. When the feature is off, every route returns a 404 that looks like "nothing there". > - So a chief-of-staff agent asked the person "what are your responsibilities, or where are they written down?" when Paperclip already had them. > - This pull request adds three read tools, makes the owner default to the person the run works for, and tells agents in chats how to use the tools or that the feature is off. > - The benefit is that an agent reads and maps a person's responsibilities itself. This is phase 1 of 4. Later pull requests add the change tools for areas, responsibilities, routines and skills. ## Linked Issues or Issue Description **Subsystem affected** Server (responsibility routes, native runner tool authority, chat prompt), native runner tool catalog, and the `paperclip` skill. **Problem or motivation** An agent in a chat cannot find a person's responsibilities. It has no dedicated tool. The list route requires `ownerUserId` from an agent, and the chat does not give the agent that ID. The chat prompt does not mention responsibilities. When the experiment is off, the 404 does not tell the agent that the feature is off. The agent then asks the person to list their responsibilities again. **Proposed solution** Add three optional native tools: `list_responsibilities`, `get_responsibility` and `find_responsibilities_for`. They call the existing routes with the run's agent token, so all route checks and the activity log stay the same. The owner defaults to the person the run works for. The routes return a `responsibilities_disabled` code while the feature is off. The tools are hidden while the feature is off, and the chat prompt then says that the feature is off. **Alternatives considered** Better `search_api` guidance alone still needs the user ID and many calls. A new read service in the tool authority would copy the route permission rules. The tools use the routes instead. ## What Changed - Add `list_responsibilities` (areas with their responsibilities, responsibilities with no area, totals, and company work filed under no responsibility), `get_responsibility` (one responsibility with its filed items, link IDs, skills and latest status report), and `find_responsibilities_for` (where a project, task or routine is filed; a task can be a `PAP-12` identifier). - Add `server/src/services/responsibility-tools.ts`. It calls the routes over HTTP with the run token and returns compact results with page links. - When an agent sends no `ownerUserId`, the responsibility list, create, summary, automation and dashboard routes use the person the run works for (`onBehalfOfUserId`). A run that works for no person still gets a 422 with a clear message. - The nine "not enabled" checks now throw one shared error. The 404 and its message do not change. The body now also has `code: "responsibilities_disabled"` and a remediation line. One `RESPONSIBILITIES_OFF_GUIDANCE` text is the remediation, the tool error and the chat prompt note. - `list_responsibilities` with `areaId` counts only that area. Archived areas are listed only on request. When only proposals are hidden, the tool says so. - `services/paperclip-api-loopback.ts` holds the tools' authenticated API call; the project tools use it too. - Show the tools only while the instance has Responsibilities on. A hidden tool that is called by name returns "Areas and responsibilities are turned off". - In standing chats, add an "Areas and responsibilities" prompt block: use the tools before you ask the person, or say that the feature is off. - `search_api` results for these routes now name the dedicated tools. - Add an "Areas and responsibilities" section to `skills/paperclip/SKILL.md` and to `references/api-reference.md`. Add one line to the chief-of-staff persona. - Register the tools in the runner catalogs. Regenerate the semantic contracts, the action catalog, protocol coverage, the operation-groups spec and the capability inventory. Update the pinned counts. ## Verification - `pnpm --filter @paperclipai/paperclip-runner exec vitest run src/catalog src/semantic-tools src/tools src/eval/workflow-evals.test.ts src/protocol-actions src/evals/native-execution.test.ts src/drivers/acpx/permission-policy.test.ts`: 276 passed. - All runner generator checks pass: protocol manifest, capability contract, capability inventory, protocol coverage, semantic contracts, semantic action catalog, operation groups, replay goldens, workflow traceability. - Server: `vitest run` of `responsibilit*` route tests, `responsibility-tools.test.ts` (new), `task-markdown.test.ts`, `task-context*`, `paperclip-runner-tool-authority.test.ts`, `runner-api.test.ts`, onboarding first-task tests and `user-facing-wording-guidance.test.ts`: 20 files, 2620 tests passed. - `node scripts/typecheck-layers.mjs` for the server: passed. - New tests cover these items: the owner default for an agent and the 422 without a person, the `responsibilities_disabled` code on every route, the tool projections, an identifier lookup, the "turned off" mapping, the tool visibility switch, and the chat prompt block. ## Risks - Low risk. The routes keep their permission checks. Agents can still only read and propose in this phase. - An agent that sends no `ownerUserId` now gets the responsible person's list instead of a 422. Agents that name an owner see no change. - The chat prompt gets one more short block in standing chats. - The flag is pinned when a turn opens. If an admin changes it during a turn, the tool list changes on the next turn. The routes always check the current setting. ## Model Used Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
53fedd653b |
fix(connections): split GitHub Copilot into its own connector (#22238)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The Connectors catalog lets people give agents tools and AI accounts. > - GitHub showed repository access and GitHub Copilot authentication on one card. > - The card had an extra "Connect Copilot" button. Saved Copilot accounts showed in the GitHub account list. > - These are two different products. People must find each one by its own name. > - This pull request makes GitHub Copilot a separate connector. GitHub keeps repository and MCP access only. > - The benefit is a clear catalog. Each card opens its own setup, and saved accounts show on the correct card. ## Linked Issues or Issue Description **What existing behavior does this improve?** Discovery and setup of the GitHub and GitHub Copilot connectors. **Current behavior** The GitHub card says "Connect GitHub repository access or authenticate GitHub Copilot agents." It shows a "Connect Copilot" button next to its own Connect button. Saved Copilot accounts show in the GitHub account list. Agent connection search returns Copilot as a method of GitHub. The Copilot setup link that search gives to agents opens the GitHub tool setup. **Proposed behavior** GitHub and GitHub Copilot are two cards. GitHub says "Give agents access to GitHub repositories, issues, and pull requests." GitHub Copilot has its own logo and opens Copilot token setup. Saved Copilot accounts, including accounts saved before this change, show on the GitHub Copilot card. **Reason and benefit** People do not have to know that Copilot is behind the GitHub card. The catalog names the two products. The Copilot runtime keeps the same provider identity, token storage, grants, and model discovery. **Additional context** This follows the same pattern as the GitHub Code Review Bot split in #14750. Copilot setup was added in #15705. ## What Changed - Add a `github-copilot` app definition with the existing `copilot-token` method. Remove that method from `github`. Restore the GitHub description and the `developer` category. - Add the GitHub Octicons Copilot mark (MIT license, from `primer/octicons`) as light and dark brand assets. - Map the `github` AI provider to the `github-copilot` catalog entry in `aiConnectionCatalogSlug`. New Copilot accounts save under a "GitHub Copilot" application. - Remove the "Connect Copilot" button from the GitHub card. - Show saved AI accounts on the card for their provider. This includes Copilot accounts that were saved under the GitHub application. The connection page and its reconnect link use the same rule. - Redirect old `/apps/connect?source=github&method=copilot-token` links to `source=github-copilot`. Keep the other query values. - Keep the "My GitHub account" identity wording on the Copilot access step. - In connection search and connection requests, file AI accounts under their catalog entry. Accept the `github` provider for the `github-copilot` service. Copilot authentication recovery cards now open GitHub Copilot setup, not GitHub tool setup. - Keep older Copilot accounts and requests working. An older account saved under the GitHub application reconnects through GitHub Copilot, and an older Copilot draft resumes through GitHub Copilot. A recovery request saved with the `github` service name can complete. A Copilot request declined before this change stays declined in its continuation. Adoption accepts the `github` provider binding for a `github-copilot` request. - Move the rule that finds an AI account's catalog entry (`aiConnectionSourceSlug`) into `@paperclipai/shared`, so the UI and server use one copy. - Use the Copilot logo for Copilot in the AI account picker and account details. - Update the GitHub Copilot connection doc and the GitHub connections Storybook story. The GitHub and GitHub Copilot setup stories open **Change** before checking "Connect GitHub as", because that heading sits in the collapsed access section. ## Verification - New and updated tests fail on `master` and pass with this change: - `pnpm exec vitest run packages/shared/src/app-definitions.test.ts` - `pnpm exec vitest run ui/src/pages/apps/Browse.test.tsx ui/src/pages/apps/AppsConnect.test.tsx ui/src/pages/apps/AppDetail.test.tsx ui/src/pages/apps/app-connect-policy.test.ts ui/src/pages/apps/Connections.test.tsx` - `pnpm exec vitest run server/src/__tests__/connection-intents-service.test.ts server/src/__tests__/ai-connections.test.ts` - `pnpm exec vitest run ui/src/features/connections/ConnectionSetupFlow.oauth.test.ts` - Older-account tests cover reconnect, draft resume, completion of a request saved with `github`, a request declined before the split, and Copilot adoption. Each test fails without its fix. - The play functions of all 8 stories in `github-connections.stories.tsx` pass when rendered with `composeStories` in jsdom. - Brand checks: `node scripts/check-app-brand-assets.mjs`, `ui/src/lib/app-brand-assets.test.ts`, and `ui/src/pages/apps/AppLogo.brand-assets.test.tsx`. - Typecheck: `@paperclipai/shared`, `@paperclipai/ui`, and `@paperclipai/server`. - Manual check in `pnpm dev:once` with a local company: 1. Open Connectors and search for "GitHub". Two cards show: "GitHub" and "GitHub Copilot". GitHub has no "Connect Copilot" button. 2. Seed one GitHub tool account and one Copilot account under the GitHub application, as older installs have them. The GitHub tool account shows on GitHub. The Copilot account shows on GitHub Copilot. 3. Click Connect on GitHub Copilot. The "Connect GitHub Copilot" page opens with the Copilot logo and the token field. 4. Open `/apps/connect?source=github&method=copilot-token`. The page redirects to `source=github-copilot`. 5. Open GitHub setup. It offers repository access only. 6. Check the catalog in light and dark themes. ## Risks - Low risk. There is no database migration. Existing Copilot accounts keep their application and stored source. The UI and connection search group them by their AI provider. - New Copilot accounts save under a new "GitHub Copilot" application and record `github-copilot` as their source. Code that finds GitHub repository identities by `sourceTemplateKey === "github"` no longer sees new Copilot accounts. These are AI accounts, so this is the intended separation. - A pending Copilot recovery card from before this change keeps the `github` service slug. The server still resolves it to GitHub Copilot, and the card can complete. - Search for "github" now returns two results: GitHub and GitHub Copilot. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) through Claude Code, with tool use (shell, file edits, test runs, and a headless browser for the manual check). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1c67687998 | feat(runner): start a released Runner again as the next run (#22288) | ||
|
|
170e1b0c07 |
feat(runner): pin Codex 0.170.0 and Agent SDK 0.3.328 so Fable 5.2 and GPT-6.2 run (#22278)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Paperclip Runner runs Claude and Codex agents from one shared provider pack. The pack pins an exact Claude Agent SDK (which bundles Claude Code) and an exact Codex CLI. > - #22222 added Claude Fable 5.2 (minimum Claude Code 2.1.321) and GPT-6.2 Sol and Astra (minimum Codex 0.169.1). The pack still bundles Claude Code 2.1.286 and Codex 0.160.0. > - Because of this, Paperclip Runner stops these models with a named version error, and native remote Codex accepts only `>=0.149.0 <0.161.0`. > - This pull request moves the provider pack to Agent SDK 0.3.328 (Claude Code 2.1.328) and Codex 0.170.0. It moves every constant that depends on these pins, and the remote Codex window to `<0.171.0`. > - The benefit is that Fable 5.2 and GPT-6.2 run on Paperclip Runner after a sandbox image with this pack is promoted. ## Linked Issues or Issue Description Refs #22222 (adds the models and the version floors; this pull request makes them runnable on Paperclip Runner). Refs #18488 (moves only the Codex pin to 0.166.0 and the window to `<0.167.0`; it is not updated since November 1 and has conflicts with `master`). Refs #18486 (GPT-6.1 Terra needs Codex 0.165.0; Codex 0.170.0 satisfies it). **Overlap with #18488.** #18488 changes the same Codex pin locations. This pull request uses a newer pin (0.170.0) and also moves the Claude runtime. If this pull request merges first, #18488 has no remaining change. I did not change the #18488 branch. ## What Changed - Claude runtime: `@anthropic-ai/claude-agent-sdk` 0.3.286 → 0.3.328 (Claude Code 2.1.286 → 2.1.328). This changes the root `pnpm.overrides`, `pnpm-workspace.yaml`, the ACPX `claude` profile, and the qualified Claude runtime in `installation-integrity.ts`, with new executable digests for Linux x64, Linux ARM64, macOS ARM64, and macOS x64. - Codex runtime: `@openai/codex` 0.160.0 → 0.170.0. This changes the runner dependency, the `codex-acp@1.6.2>@openai/codex` override, the `codex-acp` patch dependency line, the ACPX `codex` profile, and the qualified Linux x64 runtime with its new executable digest. - The ACP bridges do not change: `claude-agent-acp` 0.73.0 and the patched `codex-acp` 1.6.2. Their `commandDigest` values and profile versions do not change. - Generated declarations: `generated-profiles.ts` and `generated_acpx_profiles.rs` are regenerated with `generate:acpx-profiles`. - Remote native Codex window: `REMOTE_CODEX_MAXIMUM_VERSION_EXCLUSIVE` 0.161.0 → 0.171.0. The minimum stays at 0.149.0. Images with Codex 0.149.0 through 0.170.x are accepted. - Codex company observability: the qualified-version check moves to `codex-cli 0.170.0`. The `otel` configuration keys that Paperclip writes (`exporter`, `trace_exporter`, `metrics_exporter`) are present in the 0.170.0 configuration schema. The `OtelExporterKind`, `OtelHttpProtocol`, and `OtelTlsConfig` definitions are identical to 0.160.0. - Daytona runner image probes (`Dockerfile`, `Dockerfile.release`) expect `codex-cli 0.170.0` and `2.1.328 (Claude Code)`. The remote npm install spec in `server/src/adapters/registry.ts` is `@openai/codex@0.170.0`. - Tests: fixtures and assertions that mirror the pins use the new versions. The window tests accept 0.161.0 through 0.170.99 and reject 0.171.0. The ACPX gate tests now show that Fable 5.2 and GPT-6.2 are admitted. A new test mocks an older bundled runtime and keeps the named version-gap errors covered. The fallback test shows that GPT-6.2 stays on 0.170.0 and still falls back on 0.160.0. - Opt-in qualification scripts (`scripts/tests/native-cleanup-paginated-codex.mjs`, `native-provider-startup-codex.mjs`) require Codex 0.170.0. - Documentation: `docker/daytona-runner/README.md`, `doc/architecture/paperclip-runner-compatibility.md`, `doc/agent-observability.md`, `docs/deploy/environment-variables.md`, and the deferred item in `doc/adapter-model-audit-2026-11-18.md`. - `pnpm-lock.yaml` is not part of this pull request. The refresh bot regenerates it on `master`, as for the previous pin refreshes (#14942, #14993). ## Verification Sources, checked on 2026-11-19: - npm registry: `@openai/codex@0.170.0` (published 2026-11-18T03:45Z) and `@anthropic-ai/claude-agent-sdk@0.3.328` (published 2026-11-18T23:13Z, `claudeCodeVersion` 2.1.328). Both are the `latest` tags. - [Codex releases](https://github.com/openai/codex/releases) 0.161.0 through 0.170.0. The notes record no app-server protocol break. 0.169.0 keeps project configuration disabled for `codex exec` in untrusted directories; Paperclip's CLI path already uses `--skip-git-repo-check`, and the native path uses `app-server`. - [Claude Code changelog](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md) 2.1.287 through 2.1.328. See "Risks" for the headless changes that I reviewed. Digests and package shape: - I downloaded each platform archive with `npm pack`, which verifies registry integrity, and computed the SHA-256 of the executable. As a method check, the same command on the 0.3.286 Linux x64 archive gives the digest that is on `master` (`fe503f65…`). The Codex 0.160.0 archive also gives the `master` digest (`12eb3e81…`). - The extracted executables report `codex-cli 0.170.0` and `2.1.328 (Claude Code)`. - The Codex 0.170.0 Linux x64 archive no longer contains `codex-resources/zsh/bin/zsh`. Paperclip does not reference that path. - The Agent SDK 0.3.328 `optionalDependencies` have the same platform set as 0.3.286. The Codex 0.170.0 `optionalDependencies` use the same `npm:@openai/codex@<version>-<platform>` aliases. - Bridge link check: I installed `@agentclientprotocol/claude-agent-acp@0.73.0` with an override to Agent SDK 0.3.328 and imported its entry module. Node linked all of the named SDK imports, and the import completed. Real Codex qualification (no model turn, no credentials): - `PAPERCLIP_TEST_CODEX_BINARY=<installed 0.170.0 Linux x64 binary> node --import ./server/node_modules/tsx/dist/loader.mjs scripts/tests/native-cleanup-paginated-codex.mjs` passed: `green: true`, with the expected red control and paginated `thread/resume` through the real 0.170.0 `app-server`. The installed binary digest matches the pinned digest. Focused suites (Linux x64, Node 25.9.0, local `pnpm install --no-frozen-lockfile`): - `cd packages/paperclip-runner && pnpm run typecheck:typescript` passed, including `check:acpx-profiles`. - `npx tsc --noEmit` passed in `packages/adapters/codex-local` and `packages/adapters/claude-local`. - `packages/adapters/codex-local`: 625 passed. `packages/adapters/claude-local`: 419 passed, 1 skipped. - `node --test`: `acpx-codex-package-contract` 9 passed, `controlled-evals/controller` 77 passed, `scripts/acpx-patch-packaging` 26 passed, `scripts/__tests__/grok-public-install-sandbox` 27 passed. - `server`: `acpx-qualification`, `codex-runtime-compatibility`, and `codex-model-fallback` 110 passed. `native-session-executor` 1541 passed, 1 failed. The failure (`compares export process compatibility … db.transaction is not a function`) also fails on unchanged `master` on this host. - `packages/paperclip-runner` vitest (`installation-integrity`, `qualified-profiles`, `codex-security-config`, `native-execution`, `native-backend-factory`): 283 passed, 25 failed. All 25 failures are in `installation-integrity.test.ts` with "ACPX provider lifetime guardian failed to start". The same 25 tests fail on unchanged `master` on this host (master fails 30 here). Rust (toolchain 1.97.1 from `rust-toolchain.toml`, Linux x64): - `cargo test -p paperclip-runner-core --lib`: 658 passed, 2 failed, 4 ignored. `warm_run_attachment_reuses_the_provider_ingress_listener` also fails on unchanged `master` on this host. `reaping_stops_a_dead_runners_provider_and_its_escaped_tool_job` is flaky here: on this branch it passed 2 of 3 reruns. - `cargo test -p paperclip-runner-core --test acpx_warm_attachment --test native_provider_backend`: 7 and 45 passed. - The new and changed saved-session tests pass: `a_session_saved_by_the_previous_agent_runtime_is_refused_by_name`, `unrestorable_saved_sessions_keep_strict_bindings_and_name_their_class`, and `a_settled_session_saved_by_the_previous_acpx_release_continues`. `rustfmt --check` passes. - `server`: `native-session-resume.test.ts` and `acpx-qualification.test.ts` 110 passed, 2 skipped. Both new resume cases run and pass. Not run here: - `native-provider-startup-codex.mjs`, because it needs a compiled `paperclip-runnerd`. The trusted CI runner workflow covers startup and session-resume probes. - The Docker image build and any live model turn. A live Fable 5.2 and GPT-6.2 test follows the staging image rollout. ## Saved sessions from the previous release This change keeps the ACPX bridge command digests and profile versions. It changes `agentRuntimeVersion` in the `claude` and `codex` ACPX profiles. That field is part of the saved session identity. The previous release saved sessions with Agent SDK 0.3.286 or Codex 0.160.0. This build refuses those saved sessions. It does not migrate them. - **Next run (the usual case):** the saved provider descriptor names the old runtime. `rebindNativeSessionCheckpoint` does not match it, so the next run starts a fresh provider session in the same workspace with the complete handoff prompt. No run fails. The earlier provider conversation does not carry over. - **A run in flight at the deploy (settled or mid-turn):** the runner restore refuses the saved descriptor with the permanent class `provider_state_incompatible`. The server reports it as `native_provider_state_incompatible` and stops automatic retries. The runner opens no provider and keeps the saved state bytes and the workspace. The next run on the task starts a fresh provider session. - **Native Codex (`codex_app_server`) and OpenCode** sessions do not record this field, so their resume decision does not change. After a new image is promoted, native Codex resumes a saved thread with Codex 0.170.0 instead of 0.160.0. This pull request does not test that cross-version thread resume. New tests: - `acpx_provider_backend.rs`: `a_session_saved_by_the_previous_agent_runtime_is_refused_by_name` covers settled Claude and Codex sessions and a Claude turn interrupted mid-run by the deploy. `unrestorable_saved_sessions_keep_strict_bindings_and_name_their_class` has a new `agent_runtime_release` case. Each case checks the named class, that no provider session opens, and that the saved bytes do not change. - `native-session-resume.test.ts`: "a session saved by the previous Claude or Codex ACPX runtime" checks that a same-release session resumes, and that a session saved with Agent SDK 0.3.286 or Codex 0.160.0 starts fresh in the same workspace. ## Risks - Medium. Every Paperclip Runner Claude and Codex run uses the new executables. The digests, generated profiles, image probes, and window must agree. They agree locally, and CI runs the Rust and runner suites again. - Claude Code 2.1.287 through 2.1.328 change some headless defaults. I checked each one against Paperclip: - 2.1.302: `-p` and Agent SDK sessions with no permission mode start in `default` mode on third-party providers. Paperclip always sets a mode (`bypassPermissions` or `default`), so this does not apply. - 2.1.299: MCP allow rules now match only the whole server name. Paperclip already writes `mcp__<server>__*` and exact `mcp__paperclip__<tool>` rules. - 2.1.302: fork subagents are on by default in `-p` and the Agent SDK, as in the terminal. This pull request keeps the upstream default and does not set `CLAUDE_CODE_FORK_SUBAGENT=0`. Reviewers can ask to keep them off. - 2.1.299 and later: stdio MCP connections negotiate MCP protocol 2026-07-28 first and fall back to the older protocol for servers that do not answer. - Agent SDK 0.3.328 is less than one day old. If a regression appears, revert this pull request to return to 0.3.286 and Codex 0.160.0. - Sandbox images built before this change still carry Codex 0.160.0 and Claude Code 2.1.286. They stay accepted. On those images, Fable 5.2 and GPT-6.2 keep the existing named errors and fallbacks until a new image is promoted. - Until the refresh bot updates `pnpm-lock.yaml` on `master`, a local `--frozen-lockfile` install fails, as with the previous pin refreshes. > 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 - Anthropic Claude, model ID `claude-opus-5-5`, through Claude Code with tool use (shell, file edit, `gh`) and code execution. The context window and reasoning mode are not reported in this session. - The registry archives, digests, release notes, configuration schemas, and changelog were read directly. No model output was used as a source for those facts. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [ ] I have run tests locally and they pass - [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: devinfoley <139239+devinfoley@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |