mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 06:03:51 +01:00
ba1fc8884c3ee2cba900e1e804fbfc0abbd9a486
8892
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ba1fc8884c |
fix(native-runtime): fix plugin task predecessor resume and confirmed-unavailable retirement (#23772)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The native runtime executes `per_turn` plugin Runner tasks across remote sandboxes and verifies predecessor lease authority before it reads checkpoints or resumes sessions. > - Three coupled defects in predecessor resolution and retirement caused valid follow-up and retry turns to fail with `Plugin Runner retained session is not authorized (reason: predecessor_candidate_missing)`. > - First, same-run checkpoint reads called `resolvePluginTaskResume` without `inspectCheckpoint: true`, which rejected an unsettled predecessor lease before `read_state` could re-attest its status. > - Second, cross-run checkpoint recovery skipped verified backups and refused to retire a confirmed-unavailable plugin checkpoint when prior verification returned `verified`, leaving the unretired root in place to fail launch resume. > - Third, `admission_rejected` cleared `runnerTaskIdentity` on the rejected lease but kept `runnerTaskResumeFrom`, which disqualified the original predecessor lease on retry; when clearing `runnerTaskResumeFrom`, the attempted predecessor must still be recorded inside `runnerTaskAdmissionRejection` so `materializeNativeResumeRefusedContinuation` preserves automatic fresh-session continuation. > - This pull request fixes all three paths while keeping all stop-proof, scope, and retirement fences intact, and adds red-before-fix regression tests for each case. > - The benefit is that `per_turn` plugin Runner tasks recover, retire confirmed-unavailable checkpoints cleanly, and retry or continue after admission rejection without spurious authorization failures. ## Linked Issues or Issue Description **What happened?** `per_turn` plugin Runner tasks failed on same-run recovery, cross-run confirmed-unavailable checkpoint retirement, and retry after `admission_rejected` with `Plugin Runner retained session is not authorized (reason: predecessor_candidate_missing)`. **Expected behavior** 1. Same-run checkpoint reads pass `inspectCheckpoint: true` to `resolvePluginTaskResume` so `read_state` can re-attest status on the predecessor lease. 2. Cross-run follow-ups inspect verified backups and retire finished `per_turn` plugin owners (including archiving a verified suspended `plugin-runner-state.json` receipt) when the provider confirms the prior checkpoint is stopped and unavailable. 3. `admission_rejected` clears `runnerTaskResumeFrom` alongside `runnerTaskIdentity` so a subsequent retry lease still resolves the original predecessor lease, while recording the attempted `resumeFrom` inside `runnerTaskAdmissionRejection` so `materializeNativeResumeRefusedContinuation` still schedules a fresh-session continuation. **Steps to reproduce** 1. Run a same-run plugin Runner recovery (`resume_dead_runner` or disposition retry) when the predecessor lease has `runnerTaskSessionRetained: false`; `migrateRunnerdStateRoot` calls `resolvePluginTaskResume` without `inspectCheckpoint: true` and fails with `predecessor_candidate_missing`. 2. Run a cross-run `per_turn` plugin Runner follow-up when the prior root verifies via `plugin-runner-state.json` or a verified harness backup and `read_state` confirms `executionStopped: true, sessionStateAvailable: false`; the prior root is not retired and launch resume fails with `predecessor_candidate_missing`. 3. Submit a plugin Runner task on `lease2` with `resumeFrom: "task-1"` that returns `admission_rejected`, release `lease2`, and call `resolvePluginTaskResume` for `lease3` on the same run; stale `runnerTaskResumeFrom` on `lease2` disqualifies `lease1` with `predecessor_candidate_missing`. **Paperclip version or commit** `f4baaa4f48` (`master`) **Deployment mode** Self-hosted server ## What Changed - Pass `inspectCheckpoint: true` to `resolvePluginTaskResume` in `migrateRunnerdStateRoot` (`server/src/services/native-runtime/native-session-executor.ts`) before issuing same-run `read_state`, matching `recoverPluginRunnerCheckpoint` and `environment-task-runtime.ts`. - Inspect plugin checkpoints in `recoverPluginRunnerCheckpoint` when `direct === "absent" && prior === "verified"` (verified harness backup on disk). - Allow `retireFinishedPerTurnRunnerdOwner` in `migrateRunnerdStateRoot` when `pluginCheckpointUnavailableConfirmed && verification === "verified"`, preserving all existing stop-proof, lease, journal, and recovery fences. - Accept a verified suspended `plugin-runner-state.json` receipt in `readSettledRunnerdProjection` when `options.confirmedGonePluginTask` is true, and archive `plugin-runner-state.json` alongside continuity entries in `moveNativeContinuityState` when retiring a confirmed-unavailable plugin owner. - Strip `'runnerTaskResumeFrom'` alongside `'runnerTaskIdentity'` on `admission_rejected` in `executeEnvironmentTask` (`server/src/services/environment-task-runtime.ts`), record the attempted `resumeFrom` inside `runnerTaskAdmissionRejection`, and update `materializeNativeResumeRefusedContinuation` (`server/src/services/native-runtime/native-provider-capacity-retry.ts`) to read `runnerTaskAdmissionRejection.resumeFrom` with fallback to legacy `runnerTaskResumeFrom`. - Add focused red-before-fix regression tests in `server/src/services/native-runtime/native-session-executor.test.ts`, `server/src/__tests__/environment-task-authority.integration.test.ts`, and `server/src/services/native-runtime/native-resume-refused-continuation.integration.test.ts`. ## Verification - Confirmed all 5 new regression test cases failed with `predecessor_candidate_missing` or stale `runnerTaskResumeFrom` before applying the production fixes. - Ran `pnpm --dir server exec vitest run src/services/native-runtime/native-session-executor.test.ts src/services/native-runtime/native-session-root-entries.test.ts src/__tests__/environment-task-authority.integration.test.ts` — 3 test files passed (1591 passed, 7 skipped, 0 failed). - Ran `pnpm --dir server exec vitest run src/services/native-runtime/native-resume-refused-continuation.integration.test.ts` — 1 test file passed (9 passed, 0 failed). - Ran `pnpm --dir server typecheck` — passed cleanly across all layers. ## Risks - Low risk. All existing stop-proof (`remoteExecutionHasStopped`), prior lease end (`priorRemoteSandboxLeasesEnded`), released controller lease, and settled journal fences remain enforced before any confirmed-unavailable plugin checkpoint is retired. - `plugin-runner-state.json` remains in `NATIVE_SESSION_ROOT_HELD_ENTRIES` and is only accepted and archived when `confirmedGonePluginTask` is proven true and `pluginRunnerdAuthorityLifecycle` matches the exact suspended identity with no direct `runner/runner-state.json`. - `materializeNativeResumeRefusedContinuation` falls back to legacy `runnerTaskResumeFrom` for any lease written before this change. - No database schema changes or migrations are included. ## Model Used - Google DeepMind Gemini 4 Neon (Medium reasoning budget) with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
7838a12f5c |
fix(runner): upgrade Pi to 1.7.0 for the undici and minimatch security fixes (#23430)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The experimental Paperclip Runner runs Pi from a pinned, hash-verified distribution. > - That distribution pins Pi 1.0.0, which installs undici 8.10.2. > - undici 8.12.4 fixes six advisories, including GHSA-mqg3-3v4r-cm32 (high). > - Dependabot cannot do this upgrade. The pins feed `PI_DISTRIBUTION_PINS`, the closure pins and the ACPX `commandDigest`, so a Dependabot change fails CI (#22711, #18998). > - This pull request upgrades Pi to 1.7.0 by hand under `rules/acpx-profile-identity.mdc`. > - The benefit is a Pi runtime with the undici security fixes and an unchanged trust model. ## Linked Issues or Issue Description Supersedes #22711. Supersedes #18998. **What is the problem?** The Runner Pi distribution installs undici 8.10.2. undici 8.12.4 fixes GHSA-mqg3-3v4r-cm32, GHSA-7xg3-fphp-28hg, GHSA-5rm8-gv32-r954, GHSA-9v6h-8rgp-m69f, GHSA-3g9m-rv3r-w5w2 and GHSA-r4pc-4jcp-7pqc. **Why can Dependabot not fix it?** `.github/dependabot.yml` excludes `pi-distribution` on purpose. The lock, the closure pins and the profile digest must change together. **What is the fix?** Upgrade `@earendil-works/pi-coding-agent` from 1.0.0 to 1.7.0, which pins undici 8.12.4. ## What Changed - Pin `@earendil-works/pi-coding-agent` 1.7.0. Regenerate `package-lock.json` with the pinned Node 24.21.0 and its npm 11.19.0. The lock now has 126 packages and no os/cpu-specific packages. - Pi 1.6.0 and later do not ship `npm-shrinkwrap.json`. Pi pins `brace-expansion` 5.0.12 itself. So: - Remove `patches/brace-expansion@5.0.9.patch` and its setup and build plumbing. - Replace the shrinkwrap check in `verifyLockedPiPackageGraph`. Each dependency that Pi declares must install at exactly that version. Each `undici` and `brace-expansion` copy in the lock must be the reviewed release (`PI_DISTRIBUTION_PINS.undici` 8.12.4, `braceExpansion` 5.0.12). - Pi 1.7.0 (the newest Pi) pins minimatch 11.0.3. That version has GHSA-cf2h-pxjq-68xw (high), GHSA-hqmv-qgp3-jx75 and GHSA-c859-jr93-m5j4. Add an npm override to minimatch 11.0.8, the first fixed release. `PI_SECURITY_OVERRIDES` lets the verifier accept only this override, and only while Pi pins 11.0.3. A later Pi pin change fails closed and forces a new review. - Update the three `PI_DISTRIBUTION_CLOSURE_SHA256` pins. Then regenerate the ACPX profiles (TypeScript and Rust) with `generate:acpx-profiles`. - Keep profile version 37. The `commandDigest` changes with the upstream release, so saved Pi sessions start fresh. This follows the rule. - Update the version checks in `pi-installation.ts`, the Rust fixtures (`PI_ACPX_DIGEST`), the installation-integrity fixtures (the 1.0.0 digest is now the refused prior digest), the tests, the e2e qualification ID (`pi:0.0.33:1.7.0:openrouter`) and its suite-definition hashes, and `runner-pi-capabilities.md`. ## Verification - `node scripts/materialize-pi-distribution.mjs /tmp/out` passes on linux-x64. It uses the official pinned Node archive and verifies all 126 locked packages and the new closure pin. - Darwin closure pins: the lock has no platform-specific packages. So each darwin closure is the linux-x64 closure with that target's pinned Node executable. I checked this method first: it reproduces all three Pi 1.0.0 pins exactly from a linux-x64 build of master. - `PAPERCLIP_TEST_PI_RUNTIME_ROOT=<materialized runtime> node --test test/pi-native-package-contract.test.mjs`: 15/15 pass. The test runs real Pi 1.7.0 RPC through the owned ACP/MCP bridge (hello, interleaved tools, provider errors, thinking modes, warm recovery, pending cancel, path admission, aliased MCP tools). - `node --test` for the materialize, provision, build-inputs and attestation scripts: 39/39 pass. - Vitest: `pi-installation`, `pi-provision`, `native-execution`: 132 pass, 1 skipped. `tests/runner-e2e/pi-controls-evidence.test.ts`: 72/72 pass. - `generate-acpx-profiles.mjs --check` passes. - Static review against 1.0.0: `dist/core/tools/path-utils.js` is byte-identical, the tool `path` schemas are unchanged, and the extension events that we use still exist. Unknown tools still fail closed. - Not run locally: Rust tests (no cargo here) and paid live-model qualification. CI covers Rust. Pi stays a candidate profile. ## Risks - Saved Pi Runner sessions start fresh after deploy because the `commandDigest` changes. This is the expected result of an upstream upgrade. - Pi 1.0 → 1.7 has upstream behavior changes (for example, the Azure provider rename to `azure`, and new default models). The Paperclip Pi bindings do not use `azure-openai-responses`. - A darwin closure pin can be wrong only if npm installs different bytes on macOS for a platform-neutral graph. The macOS build checks the pin and fails closed. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), with tool use and code execution, in Claude Code. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
596bb8a512 |
fix(native-runtime): classify exited plugin Runner on restart reattachment (#23769)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Native remote runs use restart recovery (`reattach_remote_runner`)
to reattach to an existing Runner after a Core restart or deploy
> - For `plugin_task` Runners, `verifyPluginRunnerTaskReattachment`
threw a raw `Error("Plugin Runner is not running")` when the Runner
exited before reattachment, and `migrateRunnerdStateRoot` did not wrap
that error with `withRemoteRunnerTurnProof`
> - Without a structured `RemoteRunnerRecoveryError`, the executor never
emitted `native.remote_runner_recovery_failed` and
`requestRestartInterruptedTurnRetry` could not recognize the exited
Runner, leaving the run permanently failed
> - This pull request updates `verifyPluginRunnerTaskReattachment` to
throw structured `RemoteRunnerRecoveryError` diagnostics (distinguishing
proven `executionStopped === true` exits from `probe_failed`) and wraps
the call in `migrateRunnerdStateRoot` with `withRemoteRunnerTurnProof`
> - The benefit is that stopped `plugin_task` Runners record consistent
exit diagnostics and turn-proof evidence during restart reattachment so
recovery policy can classify and retry them accurately
## Linked Issues or Issue Description
**What happened?**
When Core restarts while a `per_turn` `plugin_task` Runner is active and
the Runner exits before `reattach_remote_runner` runs,
`verifyPluginRunnerTaskReattachment` throws a raw `Error("Plugin Runner
is not running")`. The executor does not emit
`native.remote_runner_recovery_failed`, does not attach
`providerTurnIssued: false` from the controller journal, and
`requestRestartInterruptedTurnRetry` fails to recognize the exited
Runner.
**Expected behavior**
When `status.executionStopped === true`,
`verifyPluginRunnerTaskReattachment` throws a
`RemoteRunnerRecoveryError` with `stage: "process_verification"` and
`reason: "process_not_running"`, attaches best-effort redacted
exited-runner diagnostics from `read_state` when
`status.sessionStateAvailable === true`, and `migrateRunnerdStateRoot`
wraps the error with `withRemoteRunnerTurnProof(error, scoped)`. When
the status probe returns a non-status result or a non-running phase
without `executionStopped === true`, it throws
`RemoteRunnerRecoveryError` with `reason: "probe_failed"` instead of
falsely proving exit.
**Steps to reproduce**
1. Start a native run backed by a `plugin_task` Runner with a controller
journal that proves no turn was issued.
2. Restart Core and trigger `reattach_remote_runner` after the plugin
task reports `executionStopped: true`.
3. Observe that `verifyPluginRunnerTaskReattachment` throws a raw
`Error("Plugin Runner is not running")` and
`executePaperclipNativeSession` does not emit
`native.remote_runner_recovery_failed`.
**Paperclip version or commit**
`f4baaa4f48` (`master`)
**Deployment mode**
Self-hosted server
**Installation method**
Built from source (pnpm dev / pnpm build)
## What Changed
- Updated `verifyPluginRunnerTaskReattachment` in
`server/src/services/native-runtime/plugin-runner-task.ts` to:
- Throw `RemoteRunnerRecoveryError({ stage: "process_verification",
reason: "probe_failed" })` when the status probe does not return `kind:
"status"` or reports `phase !== "running"` without `executionStopped ===
true`.
- Throw `RemoteRunnerRecoveryError({ stage: "process_verification",
reason: "process_not_running", ... })` when `status.executionStopped ===
true`, attaching best-effort redacted `describeExitedRemoteRunner` and
`describeExitedRemoteRunnerReason` diagnostics from `read_state` when
`status.sessionStateAvailable === true` and the identity matches.
- Wrapped `verifyPluginRunnerTaskReattachment(...)` in
`migrateRunnerdStateRoot`
(`server/src/services/native-runtime/native-session-executor.ts`) with
`withRemoteRunnerTurnProof(error, scoped)`, matching non-plugin sandbox
reattachment.
- Added unit tests in
`server/src/services/native-runtime/plugin-runner-task.test.ts` covering
stopped tasks with and without `sessionStateAvailable`, best-effort
`read_state` failure/mismatch, and `probe_failed` responses.
- Added an integration-style executor test in
`server/src/services/native-runtime/native-session-executor.test.ts`
verifying `providerTurnIssued: false` and
`native.remote_runner_recovery_failed` emission on
`reattach_remote_runner` for a stopped `plugin_task`.
## Verification
- Verified red-before-fix failures on both new test suites (`expected
Error: Plugin Runner is not running to be an instance of
RemoteRunnerRecoveryError`).
- `pnpm --dir server exec vitest run
src/services/native-runtime/plugin-runner-task.test.ts` — 120/120
passed.
- `pnpm --dir server exec vitest run
src/services/native-runtime/native-session-executor.test.ts -t
"classifies a stopped plugin_task on reattach_remote_runner|reattaches a
surviving plugin task through its owner"` — 6/6 passed.
- `pnpm --dir server typecheck` — passed.
## Risks
- Low risk. The change is scoped to `verifyPluginRunnerTaskReattachment`
and its `plugin_task` reattachment caller in `migrateRunnerdStateRoot`.
- Any caller or log parser that previously matched the unstructured
`"Plugin Runner is not running"` string now receives the standard
`RemoteRunnerRecoveryError`
(`runner_remote_process_identity_unavailable`) used by other remote
Runner reattachment paths. No existing tests or code in the repository
matched that string.
- Terminal phases without `executionStopped === true` report `reason:
"probe_failed"` rather than `process_not_running`, preserving the
invariant that only explicit `executionStopped === true` proves the task
and descendants stopped.
## Model Used
- Google DeepMind Gemini 4 Neon (Medium reasoning budget)
## 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>
|
||
|
|
244e20a293 |
fix(server): settle prior pending_cleanup leases and recheck stopped ownership on same-run retry (#23770)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The server environment runtime and sandbox creation ownership layer coordinate plugin-task leases across same-run retries and resumptions > - Same-run plugin-task retries can fail with `setup_failed`: `Sandbox creation has already transferred ownership` in two situations > - First, `createOwnedSandbox` has a check-then-read race when the prior lease finishes releasing with a valid termination receipt between `createdSandboxStopped` and `getLeaseById` > - Second, same-run native resumption with `nativeLeaseOwner` (without `nativeRestartRecovery`) leaves `recoverPluginTask` false, and `recoverPluginTask` in `environmentRunOrchestrator` does not retry plain `pending_cleanup` plugin leases before checking `remoteExecutionHasReleased` > - This pull request closes the `createOwnedSandbox` race, enables `recoverPluginTask` for same-run `nativeLeaseOwner` resumptions, and retries prior `pending_cleanup` plugin leases before checking termination receipts > - The benefit is reliable same-run plugin-task recovery without relaxing the invariant that no second sandbox starts without a proven remote termination receipt ## Linked Issues or Issue Description **What happened?** Same-run plugin-task retries and resumptions fail with `setup_failed`: `Failed to acquire lease for environment ... (plugin): Sandbox creation has already transferred ownership`. This occurs either when a prior lease finishes releasing with a stop receipt between `createdSandboxStopped` and `getLeaseById` in `createOwnedSandbox`, or when a prior `pending_cleanup` lease is not settled during same-run recovery. **Expected behavior** When a prior lease has already stopped with a valid termination receipt, `createOwnedSandbox` re-admits the replacement operation cleanly. When a same-run native resumption runs with `nativeLeaseOwner`, `recoverPluginTask` retries prior `pending_cleanup` plugin leases; if teardown succeeds with a stop receipt, the replacement lease acquires cleanly, and if teardown fails, recovery fails closed with `native_plugin_recovery_termination_unconfirmed` without creating a second sandbox. **Steps to reproduce** 1. Run a `paperclip_runner` task on a plugin environment so an `attached` row exists in `sandbox_creation_operations`. 2. Leave the prior lease in `pending_cleanup` (or release it with a valid termination receipt between `createdSandboxStopped` and `getLeaseById`). 3. Resume or retry the same run; before this change, acquisition fails with `Sandbox creation has already transferred ownership` or fails without retrying the `pending_cleanup` teardown. **Paperclip version or commit** `f4baaa4f48` (`master`) ## What Changed - Re-check `createdSandboxStopped(db, operation)` in `server/src/services/sandbox-creation-operations.ts` when `existing && existing.status !== "active"` after `getLeaseById`, and re-admit via `admit(operation)` when the prior sandbox is proven stopped before throwing. - Enable `recoverPluginTask` in `server/src/services/heartbeat/workspace-preparation.ts` for same-run native resumptions with `runOptions.nativeLeaseOwner` when `!restartRecovery`, `!priorVerificationLease`, and `!portablePreparationLeaseId`. - Retry prior `pending_cleanup` plugin leases in `server/src/services/environment-run-orchestrator.ts` (using an atomic `pendingCleanupInFlight` claim, `retryPendingSandboxTeardown`, and `releaseLease`) before checking `remoteExecutionHasReleased`, releasing the in-flight flag on failure and failing closed with `native_plugin_recovery_termination_unconfirmed`. - Add red-before-fix regression tests in `server/src/__tests__/plugin-runner-task.integration.test.ts` and `server/src/services/heartbeat/workspace-preparation.test.ts`. ## Verification - Verified red-before-fix failures before editing production code: - `pnpm --dir server exec vitest run src/__tests__/plugin-runner-task.integration.test.ts -t "pending_cleanup|createOwnedSandbox"` (3 failed: `pending_cleanup` teardown not attempted / `native_plugin_recovery_termination_unconfirmed`, and `createOwnedSandbox` threw `Sandbox creation has already transferred ownership`). - `pnpm --dir server exec vitest run src/services/heartbeat/workspace-preparation.test.ts -t "enables recoverPluginTask"` (1 failed: `recoverPluginTask` was `false`). - Verified green-after-fix: - `pnpm --dir server exec vitest run src/__tests__/plugin-runner-task.integration.test.ts` — 12/12 passed. - `pnpm --dir server exec vitest run src/services/heartbeat/workspace-preparation.test.ts -t "enables recoverPluginTask|retired inherited runner|same-run"` — 4/4 passed. - `pnpm --dir server typecheck` — passed across all layers. ## Risks - Low risk. No database schema or API contract changes. - Preserves the fail-closed termination invariant: no second sandbox is created unless every prior lease has a proven `hasRemoteTerminationReceipt`, and concurrent cleanup attempts are fenced by `pendingCleanupAttemptId` / `pendingCleanupInFlight`. ## Model Used - Google DeepMind Gemini 4 Neon (Medium reasoning budget) with tool use and local code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
686215ecdb |
fix(native-runtime): wait for prior lease release and read same-lease plugin checkpoint (#23768)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The native runtime coordinates per-turn and plugin-task runner state across consecutive runs in `server/src/services/native-runtime/native-session-executor.ts`. > - A committed per-turn plugin run can finish while its async environment lease cleanup is still running, so a follow-up run hits `retirement_refused=prior_lease_active`, quarantines the scoped runner root, and fails. > - A same-run plugin-task retry that reuses the same environment lease without restart recovery also skips `read_state` when local runner authority is absent, which triggers `authority_indeterminate` and quarantines the root. > - This pull request adds a bounded wait for prior lease teardown before refusing `prior_lease_active`, skips quarantine when the prior lease stays active, and reads the plugin checkpoint on same-lease retries when local authority is absent. > - The benefit is that follow-up runs retire finished per-turn owners cleanly instead of poisoning the scoped runner root, and same-lease plugin retries verify their checkpoint instead of failing with `authority_indeterminate`. ## Linked Issues or Issue Description **What happened?** When a per-turn plugin run commits its terminal result and its async environment lease teardown is still in flight, a follow-up run fails with `runner_state_identity_mismatch: prior_owner_terminal_state_indeterminate; retirement_refused=prior_lease_active` and quarantines the scoped runner state root. On a same-run plugin-task retry that reuses the same environment lease without restart recovery, `migrateRunnerdStateRoot` skips reading the plugin runner checkpoint when local runner authority is absent, which causes `runner_state_identity_mismatch: authority_indeterminate` and quarantines the scoped root. **Expected behavior** Follow-up runs wait briefly for an in-flight prior lease release to finish and then retire the finished per-turn owner cleanly. If the prior lease remains active after the bounded wait, the run still refuses with `retirement_refused=prior_lease_active` without retiring into `continuity-breaks` and without quarantining the scoped root. Same-run plugin-task retries on the same lease read and verify the plugin checkpoint via `read_state` when local runner authority is absent and unclaimed bootstrap retry does not apply. **Steps to reproduce** 1. Commit a per-turn plugin run with a bound stop receipt while its `environment_leases` row is still `status: "active"` and `releasedAt: null`. 2. Start a follow-up run on a replacement lease before async lease teardown marks the prior lease released. 3. Observe `migrateRunnerdStateRoot` refuse with `retirement_refused=prior_lease_active` and move the scoped state root into `quarantine/`. 4. Start a same-run plugin-task retry reusing `identity.environmentLeaseId` without `restartRecovery` and without a local `runner/runner-state.json`. 5. Observe `migrateRunnerdStateRoot` throw `runner_state_identity_mismatch: authority_indeterminate` and quarantine the root. **Paperclip version or commit** `master` (`f4baaa4f48`) ## What Changed - Added `priorLeaseReleaseWait` (`5_000 ms` timeout, `100 ms` poll interval), `isPriorRemoteSandboxLeaseEnded`, and `waitForPriorRemoteSandboxLeasesToEnd` in `server/src/services/native-runtime/native-session-executor.ts`. - Updated `migrateRunnerdStateRoot` to wait for in-flight prior remote sandbox lease release when `retireFinishedPerTurnRunnerdOwner` returns `prior_lease_active`, and to retry retirement once if the prior lease ends during the wait. - Updated `migrateRunnerdStateRoot` to skip quarantining `scoped` when retirement still refuses with `prior_lease_active`, matching the existing non-quarantine behavior for `"active"` and `"unavailable"`. - Updated `migrateRunnerdStateRoot` to call `read_state` and `savePluginRunnerCheckpoint` on same-run, same-lease plugin-task retries without `restartRecovery` when `admitUnclaimedNativeBootstrapRetry` does not apply and `runnerdAuthorityLifecycle` is `"absent"`. - Kept this minimal bugfix inside `server/src/services/native-runtime/native-session-executor.ts` (which already exceeds 1,000 lines) because it modifies existing state migration and lease-retirement checks directly in their owning module without introducing a new subsystem. - Added red-then-green regression tests in `server/src/services/native-runtime/native-session-executor.test.ts` covering in-flight prior lease release, persistent unreleased prior lease (no retirement and no quarantine), and same-lease plugin checkpoint verification and mismatch rejection. ## Verification - Verified all 4 new regression tests failed before the fix (`retirement_refused=prior_lease_active`, `scoped` moved to quarantine, and `authority_indeterminate`). - Ran focused tests after the fix: - `pnpm --dir server exec vitest run src/services/native-runtime/native-session-executor.test.ts -t "handles unconfirmed plugin checkpoint status on replacement lease|retires a finished per-turn plugin owner|waits briefly for a stopped per-turn prior lease|admits only an authorized same-run plugin checkpoint|reads same-lease plugin checkpoint instead of quarantining|reattaches a surviving plugin task"` (27 passed, including existing `stopped-lease-unreleased`). - Ran server typecheck: - `pnpm --dir server typecheck` (passed). ## Risks - Low risk. The bounded wait applies only when `retireFinishedPerTurnRunnerdOwner` refuses with `prior_lease_active`, exits early when the prior lease holds the same `providerLeaseId` as the current run or no prior leases exist, and re-runs the full retirement proof before retiring. Same-lease `read_state` runs only after unclaimed bootstrap retry checks and only when local runner authority is `"absent"`, preserving fail-closed identity verification via `savePluginRunnerCheckpoint`. ## Model Used - Google DeepMind Gemini 4 Neon (Medium reasoning budget) with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
f5457565de |
fix(heartbeat): retry setup on retryable remote_incomplete workspace failures (#23764)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Before a run starts its provider, Paperclip prepares the task workspace through a workspace provider plugin using a deterministic `operationId` > - A workspace provider can fail preparation with the closed retryable reason `remote_incomplete` when a remote storage or runtime request does not finish > - Setup recorded `remote_incomplete` as a generic `setup_failed` with no bounded retry, and release recovery immediately marked the task `blocked` without retrying the same workspace or showing the workspace failure reason in the escalation notice body > - This pull request gives a fresh pre-dispatch `remote_incomplete` answer its own transient setup code, `workspace_storage_incomplete`, routes it through the bounded bootstrap retry budget (deferring Sentry reporting until the retry decision), and forwards saved `workspaceProviderFailure` details into immediate execution-path escalation notices > - The benefit is that a task retries the same workspace automatically across transient remote storage/runtime failures instead of immediately blocking for a person ## Linked Issues or Issue Description Refs #23362, #19249 **What happened?** When a workspace provider returned the closed retryable reason `remote_incomplete` (`"Workspace storage operation is incomplete; retry the same workspace"`) during workspace bootstrap (`executionRecovery: { kind: "bootstrap", providerWorkStarted: false }`), `failRunSetup` recorded `errorCode: "setup_failed"` and scheduled no retry. Immediately after, `releaseIssueExecution` treated `setup_failed` as non-retryable continuation failure and marked the task `blocked` with a generic notice that omitted the workspace failure reason. **Expected behavior** When a legacy run fails before provider dispatch with a retryable `remote_incomplete` workspace provider answer, setup must classify it as `workspace_storage_incomplete` and schedule a bounded bootstrap retry of the same workspace (matching `workspace_storage_pending` and `plugin_worker_unavailable`). Sentry must report only when no retry is scheduled or retries are exhausted, and immediate execution-path escalation notices must include the bounded `workspaceProviderFailure` message when present. **Steps to reproduce** 1. Start a legacy run whose workspace preparation calls a workspace provider plugin. 2. Have the provider reject preparation with `PluginWorkspaceOperationError("remote_incomplete")`. 3. Before this fix, `failRunSetup` writes `errorCode: "setup_failed"`, schedules no bounded retry, and `releaseIssueExecution` immediately blocks the task. **Paperclip version or commit** Reproduced on `master` (`01ecbadbf1`). **Deployment mode** Self-hosted server and managed plugin workspace environments (`authenticated` and `local_trusted`). ## What Changed - `server/src/services/workspace-provider-failure.ts`: add `WORKSPACE_STORAGE_INCOMPLETE_CODE` (`workspace_storage_incomplete`) and `findWorkspaceStorageIncompleteFailure` matching `kind === "provider" && reason === "remote_incomplete"`. - `server/src/services/heartbeat/run-completion.ts`: map a fresh pre-dispatch legacy `remote_incomplete` failure (with no native session or runner instance) to `workspace_storage_incomplete`, route it through `scheduleBoundedRetryForRun` (keeping accepted interaction retries owned by the interaction lane), and defer Sentry reporting via `workspaceStorageIncompleteRetry`. - `server/src/services/failed-preparation-retry.ts`, `server/src/services/heartbeat/retries.ts`, `server/src/services/legacy-execution-recovery.ts`, `server/src/services/recovery/service.ts`, `server/src/services/agent-task-run-telemetry.ts`: handle `workspace_storage_incomplete` alongside `workspace_storage_pending`. - `server/src/services/recovery/stranded-notice.ts` & `server/src/services/heartbeat.ts`: add a stranded escalation notice for `workspace_storage_incomplete` and pass `workspaceProviderFailure: readWorkspaceProviderFailure(input.runRow.resultJson)` into `buildImmediateExecutionPathRecoveryNoticeSeed`. - `server/src/services/run-failure-diagnostics.ts` & `server/src/services/run-failure-report.ts`: add `workspaceStorageIncompleteRetry` deferred Sentry reporting handshake. - Add red-then-green regression tests in `run-completion.test.ts`, `workspace-provider-failure.test.ts`, `run-failure-report-sandbox-resume.test.ts`, and `heartbeat-retry-scheduling.test.ts`. ## Verification - Red before the fix: - `pnpm --dir server exec vitest run src/services/heartbeat/run-completion.test.ts -t "incomplete workspace storage"` failed on the `fresh` scenario with `errorCode: "setup_failed"` instead of `"workspace_storage_incomplete"`. - Green after the fix: - Focused `run-completion.test.ts`, `run-failure-report-sandbox-resume.test.ts`, `workspace-provider-failure.test.ts`, `agent-task-run-telemetry.test.ts`, `heartbeat-retry-scheduling.test.ts` (`bootstrap retries across restart`), and `pnpm --dir server typecheck` all pass. ## Risks - Low risk. No database schema, API route, or plugin wire protocol changes. - Retry applies only before provider dispatch on a legacy run with no native session or runner instance, bounded by the existing bootstrap retry budget (2 retries). Started and native runs keep `setup_failed` with no automatic retry. - Every workspace preparation call carries a deterministic `operationId` derived from workspace ID, generation, and operation payload, and `remote_incomplete` is explicitly marked `retryable: true` for the same workspace. ## Model Used - Google DeepMind Gemini 4 Neon (Medium reasoning budget), via Antigravity with tool use (code search, file edits, local test execution, and GitHub CLI). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
638530f273 |
fix(cli): support all release channels in update (#11795)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The managed CLI lets operators follow a release channel during updates > - Paperclip publishes stable, beta, nightly, and canary channels > - The update command only let users select stable or canary > - A default update also changed recorded beta and nightly installs to stable > - This pull request adds all four channels to the update command and update notice > - The benefit is that each managed install stays on the channel that the operator selected ## Linked Issues or Issue Description **What happened?** `paperclipai update` only accepted `--latest` and `--canary`. It did not accept `--beta` or `--nightly`. A default update mapped every recorded channel except canary to `latest`. The update notice used the same two-channel rule. **Expected behavior** The command must accept all four published channel selectors. A default update must use the moving channel in the install manifest. The update notice must check the same channel. **Steps to reproduce** 1. Record `beta` or `nightly` as the managed install channel. 2. Run `paperclipai update` without a channel flag. 3. Observe that the command resolves `paperclipai@latest` instead of the recorded channel. **Paperclip version or commit** Commit `e1ce7a553c280ef3d2b9ed99e0149afc23b14275`. **Deployment mode** This bug is not specific to a deployment mode. **Installation method** Managed CLI install. **Additional context** The managed update workflow was added in #10045. I found no duplicate issue or pull request for this channel gap. ## What Changed - Added `--beta` and `--nightly` to `paperclipai update` and `paperclipai upgrade`. - Expanded the install manifest channel type and kept the recorded moving channel during a default update. - Made update notices use the recorded channel and made the notice cache channel-aware. - Added regression tests and updated the channel, CLI, and installation documents. ## Verification - `pnpm exec vitest run cli/src/__tests__/update-command.test.ts cli/src/__tests__/update-notice.test.ts` — 2 files and 18 tests passed. - `pnpm --filter paperclipai typecheck` passed. - `pnpm --filter paperclipai build` passed. - `pnpm paperclipai update --help` showed `--latest`, `--beta`, `--nightly`, and `--canary`. ## Risks - Low risk. The change adds accepted manifest values and command flags. Existing latest, canary, and pinned installs keep their current behavior. - Old notice cache files have no channel field. They remain valid for the latest channel and refresh for other channels. > 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 - OpenAI Codex, GPT-5 family. The runtime does not expose the exact deployment ID or context window. The agent used reasoning, repository tools, shell execution, and 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 - [x] I will address all Greptile and reviewer comments before requesting merge Co-authored-by: Dev Agent <dev@paperclip.ing> Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com> |
||
|
|
f4baaa4f48 |
fix(pi-local): respect message roles in transcripts (#11781)
## Thinking Path > - Paperclip manages AI agents and shows their run transcripts > - The Pi local adapter converts Pi JSON stdout events into transcript entries > - Pi emits `message_end` events for user, assistant, and tool-result messages > - The parser marked text from every `message_end` event as assistant output > - This made the wake payload look like assistant output and repeated tool results > - This pull request maps user messages to user entries and ignores other non-assistant messages > - The benefit is correct speaker attribution without a change to assistant output ## Linked Issues or Issue Description Fixes: #11780 ## What Changed - Read `message.role` before creating transcript entries. - Render user messages as user entries. - Ignore tool-result and unsupported roles in `message_end`. - Add regression tests for user, assistant, tool-result, and unsupported roles. ## Verification - `pnpm exec vitest run packages/adapters/pi-local/src/ui/parse-stdout.test.ts --config packages/adapters/pi-local/vitest.config.ts` — 4 tests passed. - `pnpm --filter @paperclipai/adapter-pi-local typecheck` — passed. - `pnpm --filter @paperclipai/adapter-pi-local build` — passed. - `pnpm -r typecheck` — passed. - `pnpm build` — passed. - `pnpm test:run` — 4,498 tests passed, 30 failed, and 5 skipped. The failures are in unrelated server suites on macOS. They cover `/tmp` and `/private/tmp` path differences, workspace runtime checks, and test port allocation. The Pi parser regression tests passed again after the full run. ## Risks Low risk. This change only affects Pi `message_end` transcript classification. Assistant text and thinking output stay the same. > 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 OpenAI Codex with a GPT-5-based model. The session used reasoning, tool use, and code execution. The exact model ID and context window were not exposed to the 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 - [ ] 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 |
||
|
|
655d6c9d8e |
fix(cli): make -C/--company-id optional on client commands enforced via resolveCommandContext (#11601)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The `paperclipai` CLI is how humans and other agents drive Paperclip
from a terminal or script
> - Many `client/*` command files declare `-C, --company-id` with
`.requiredOption(...)`, so commander aborts argument parsing before the
command's action ever runs
> - Every one of those same actions calls `resolveCommandContext(opts, {
requireCompany: true })`, which already resolves the company id from
`--company-id` -> `PAPERCLIP_COMPANY_ID` -> the context profile, and
throws a clear error only when all three are empty
> - So a command like `agent list` fails immediately on a bare parse
error even when the caller has `PAPERCLIP_COMPANY_ID` exported or a
context profile set, while a sibling command like `issue list` (no
`requiredOption`) works fine from the same environment — same resolver,
inconsistent enforcement point
> - This pull request replaces `.requiredOption("-C, --company-id <id>",
...)` with `.option(...)` at every site backed by
`resolveCommandContext(..., { requireCompany: true })`, leaving
`requireCompany: true` untouched so the resolver still enforces the
requirement, just with its existing, more informative error message
> - The benefit is that `--company-id` behaves consistently across every
client command: env var and context-profile fallback always work, and
the error message when nothing is set comes from one place instead of
commander's generic "required option not specified"
## Linked Issues or Issue Description
No public GitHub issue exists for this yet, so following the Enhancement
proposal template inline:
**What existing behavior does this improve?**
The `-C, --company-id` option on CLI client commands under
`cli/src/commands/client/`.
**Subsystem affected**
Unsure / cross-cutting within the CLI — this is not one of the listed
subsystems (server/, ui/, packages/db, packages/shared,
packages/adapters, packages/plugins); it is
`cli/src/commands/client/**`.
**Current behavior**
28 commands across
`cli/src/commands/client/{activity,agent,approval,company,goal,plugin,project,secrets,token}.ts`
declare `-C, --company-id` via commander's `.requiredOption(...)`.
Commander enforces that flag at argument-parse time and exits with a
generic `error: required option '-C, --company-id <id>' not specified`
before the command's action function runs — even though every one of
those actions calls `resolveCommandContext(opts, { requireCompany: true
})`, which is fully capable of resolving the company id from
`PAPERCLIP_COMPANY_ID` or the context profile. Other commands in the
same CLI (e.g. `issue list`) use `.option(...)` for the same flag and
already work from env/profile. The result is an inconsistent, confusing
failure mode depending on which command you call.
**Proposed behavior**
All 28 sites use `.option("-C, --company-id <id>", ...)` instead of
`.requiredOption(...)`. `requireCompany: true` stays in
`resolveCommandContext`, so a company id is still required end-to-end —
it can now come from `--company-id`, `PAPERCLIP_COMPANY_ID`, or the
context profile, uniformly, with one shared, descriptive error message
when none of the three are set.
**Breaking changes**
None for correctly-configured callers. A caller that relied on
commander's parse-time rejection (rather than the resolver's `Company ID
is required...` message) would see a different error message, but the
exit-code behavior (non-zero, no company id resolved) is unchanged. No
response shape, output format, or successful-path behavior changes.
## What Changed
- Replaced `.requiredOption("-C, --company-id <id>", ...)` with
`.option("-C, --company-id <id>", ...)` at all 28 call sites across
`cli/src/commands/client/activity.ts`, `agent.ts`, `approval.ts`,
`company.ts`, `goal.ts`, `plugin.ts`, `project.ts`, `secrets.ts`, and
`token.ts`.
- Left `resolveCommandContext(opts, { requireCompany: true })` unchanged
everywhere — enforcement still happens there, with its existing error
message.
- Added `cli/src/__tests__/company-id-option.test.ts`, a regression test
modelled on `auth-command-registration.test.ts` that registers every
affected command family (`company`, `issue`, `agent`, `approval`,
`activity`, `dashboard`, `feedback`, `goal`, `plugin`, `project`,
`secrets`, `token`), walks the full command tree, and asserts
`--company-id` is never `mandatory` (commander's `.requiredOption`
discriminator) and never declared more than once on the same command.
## Verification
```
$ grep -rn 'requiredOption("-C' cli/src/commands/client/
# exit code 1, no matches
```
```
$ cd cli && pnpm exec vitest run src/__tests__/company-id-option.test.ts
Test Files 1 passed (1)
Tests 2 passed (2)
```
Red on the unpatched tree (reverting only the fix files reproduces 9+
offending commands):
```
$ git stash push -- cli/src/commands/client/*.ts
$ pnpm exec vitest run src/__tests__/company-id-option.test.ts
❯ … 1 failed
AssertionError: --company-id must never be mandatory; offending commands: …
$ git stash pop
```
```
$ pnpm -C cli build
# green (tsc --noEmit at the repo root reports ~139 pre-existing errors in
# server/src/** from a missing built @paperclipai/plugin-sdk dist, present
# identically on the unpatched tree and unrelated to this diff;
# cli/src/commands/client/** itself has zero new type errors)
```
Behavioral check via `cli/src/index.ts`:
```
$ PAPERCLIP_COMPANY_ID=test-co-123 PAPERCLIP_API_KEY=fake pnpm exec tsx src/index.ts agent list --json
API error 401: Unauthorized
# past argument parsing, into an HTTP/auth error — this is the intended fix
$ pnpm exec tsx src/index.ts agent list --json --context /tmp/pc-empty-context.json
Company ID is required. Pass --company-id, set PAPERCLIP_COMPANY_ID, or set context profile companyId via `paperclipai context set`.
```
## Risks
Low risk. This only relaxes a commander-level parse constraint; the
underlying requirement (`requireCompany: true`) is untouched, so every
affected command still refuses to proceed without a resolvable company
id. The main behavioral shift is the error message and the point at
which the error surfaces (resolver instead of commander), which is
strictly more informative. No API, schema, or persisted-data changes.
## Model Used
Claude (Anthropic), Claude Opus, extended thinking / chain-of-thought
reasoning enabled, with tool use (repo grep/read/edit, test execution)
throughout implementation and 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
- [ ] 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
## Related PRs found during duplicate search
- #4276 (`feat(cli): unify issue flag matrix (A+B) — -C optional +
per-subcommand guards`) — open, overlapping intent (also makes `-C`
optional) but scoped to `issue create` only plus a separate flag-hint
feature; does not touch the other 27 sites this PR fixes. Not a
duplicate.
- #2538 (`Refine CLI company commands behavior, tests`) — open, touches
`company.ts` but for import-adapter validation, unrelated to
`--company-id` enforcement. Not a duplicate.
No exact duplicate of this PR's scope (making `--company-id` a
non-mandatory option across all 28 client-command call sites while
keeping resolver-level enforcement) was found in the open or closed PR
list.
---------
Co-authored-by: dzianisv <dzianisv@gmail.com>
Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com>
|
||
|
|
314bc70c1f |
docs: company-creator: resolve the import command from the checkout (#10849)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The company-creator skill generates portable company packages that
users import into Paperclip
> - Step 6 of the skill tells the author to document the import command
in the package README
> - The documented command `paperclipai company import --from <path>`
does not work, because the CLI takes the source as a positional argument
> - Every generated README therefore ships a getting-started command
that fails on first use
> - This pull request makes the skill resolve the import entrypoint from
the checkout before it writes the README
> - The benefit is that the instruction cannot drift again, because the
skill reads the current interface instead of repeating a memorised one
## Linked Issues or Issue Description
No public issue exists for this. The problem is described below,
following the bug report template.
**What happened.** The company-creator skill tells the author to
document importing with `paperclipai company import --from <path>`. That
command fails. `cli/src/commands/client/company.ts:1401` declares
`.argument("<fromPathOrUrl>")`, and the import block declares no
`--from` option. The source is positional.
**Expected behavior.** The command written into a generated README runs
successfully.
**Steps to reproduce.**
1. Run `grep -n "company import"
.agents/skills/company-creator/SKILL.md`. The result shows the `--from`
form.
2. Run `grep -n 'command("import"' -A 12
cli/src/commands/client/company.ts`. The result shows a positional
`<fromPathOrUrl>` argument and no `--from` option.
3. Generate a company package with the skill. The README contains a
getting-started command that fails.
**Paperclip version or commit.** `master` @ `d5b9f6c`.
**Related pull requests.** These change import behaviour. None of them
corrects the skill's documented invocation, so this pull request is not
a duplicate.
Refs #10237, Refs #10245, Refs #10246, Refs #10248, Refs #7289, Refs
#4137
## What Changed
- Step 6 now tells the author to resolve the import entrypoint from the
checkout before writing the README. It greps the CLI command first, and
falls back to the `openapi.ts` HTTP route if no CLI command exists.
- The step records the currently correct positional form as an example.
- The step documents that `--include` must be passed explicitly. An
incomplete include set imports a subset and still returns success, so a
package can land with zero projects, tasks and skills and look correct.
## Verification
- Run `grep -n 'command("import"' -A 12
cli/src/commands/client/company.ts`. The output shows the positional
`<fromPathOrUrl>` argument and the supported `--include` values. This
confirms the new example.
- Run `grep -c 'company import --from'
.agents/skills/company-creator/SKILL.md`. The output is `0`. This
confirms the broken form is gone.
- This pull request changes documentation only. It touches no runtime
code path.
## Risks
Low risk. The change is Markdown only. There is no code change, no
migration, and no behavioural shift. The worst case is that the example
ages again. The new resolve-from-the-checkout instruction is designed to
prevent exactly that, because it tells the author to read the current
interface instead of copying a remembered one.
## Model Used
Claude Opus 5 (`claude-opus-5`), used through Claude Code with extended
thinking and tool use (shell commands and file edits). The corrected
invocation was derived by reading `cli/src/commands/client/company.ts`
in this checkout, not from model memory.
## 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 — not run. This pull
request changes one Markdown file and no code path.
- [ ] I have added or updated tests where applicable — no test applies
to a documentation string.
- [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 — not yet confirmed on this
commit.
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups —
currently 4/5, pending this description update.
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: emircbngl <259049573+emircbngl@users.noreply.github.com>
Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com>
|
||
|
|
73c43fd443 |
test(issues): guard the blockerAttention early-warning against cancelled-child noise (#10375)
## Thinking Path > - Paperclip orchestrates AI agents in companies where no human watches the board continuously. > - `blockerAttention` is the early-warning system for blocked issues: it distinguishes a blocked issue that has a live path from one that is blocked in prose only, with no first-class blocker and therefore no wake path. > - The graph it walks is `explicit blockedBy edges ∪ non-terminal direct children`. > - #7577 correctly made cancelled direct children terminal, because a cancelled child is neither a dependency nor a source of liveness — before that fix a cancelled child pinned its parent to `needs_attention` forever, since a cancelled issue never becomes `done`. > - Two contract branches around that behaviour had no assertion in the suite, so nothing pins the signal's two ends: the pure early-warning case (blocked, zero edges) and the cancelled-child edge count in isolation. > - This PR adds those two guards. It is test-only; no behaviour changes. ## Linked Issues or Issue Description Refs #7578 (the cancelled-child defect fixed by #7577). **Issue this addresses:** the regression test added in #7577 asserts the parent is `covered`, but that parent also has two live explicit blockers holding the state up. If the cancelled-child filter regressed, the counts would change while the *state* could still look plausible in other shapes, and the case the feature exists for — a blocked issue with **no** blocker edges at all — has no assertion anywhere in the file. `unresolvedBlockerCount: 0` appears in no test today. Related PRs found while searching (neither overlaps; both touch blocker relations, not `blockerAttention` classification): #8251 (blocker summaries for legacy child blockers), #10316 (reject `done` while first-class blockers remain open). ## What Changed Two tests in `server/src/__tests__/issue-blocker-attention.test.ts`: - **`flags a blocked issue that has no blocker edges at all`** — a blocked, agent-assigned issue with no relations and no children must report `needs_attention` / `attention_required` with all four counts at 0. This is the text-only-blocked case the signal is built to catch, and it was unasserted. - **`keeps a blocked parent attention-needed when its only child was cancelled`** — a blocked parent whose sole child is `cancelled` must report `unresolvedBlockerCount: 0` and stay `needs_attention`. This pins the cancelled-child edge count on its own, without live explicit blockers masking it. No production code touched. ## Verification - `node_modules/.bin/vitest run server/src/__tests__/issue-blocker-attention.test.ts` on this branch → **26 passed**. - Control run, to prove the guards bite: reverted the #7577 filter in `listIssueBlockerAttentionMap` back to `ne(issues.status, "done")` → **2 failed / 24 passed**, both cancelled-child tests: - `ignores cancelled direct children …`: `unresolvedBlockerCount` 3 instead of 2, state `needs_attention` instead of `covered` - `keeps a blocked parent attention-needed when its only child was cancelled`: `unresolvedBlockerCount` 1 instead of 0 Restored the filter → 26 passed again. - The zero-edge test passes both before and after that revert, as intended: it is the negative control that proves the fix does not blind the detector. ## Risks - Test-only; no runtime behaviour changes, no schema or API surface touched. - The new tests use the file's existing `createCompany` / `insertIssue` helpers and fresh issue prefixes (`PBE`, `PBF`), so they do not interact with sibling cases. ## Model Used - Claude Opus 5 (1M context) via Claude Code CLI, tool-enabled; used for repository inspection, test authoring, and local vitest execution including the revert-based control run. ## 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 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 (not applicable; test-only change) - [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: AURDVIN Dev Agent <juan@rial.ch> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com>canary/v2026.1204.0-canary.888200 |
||
|
|
def3ac2e7e |
test: cover create-time issue blocker links (#10320)
## Thinking Path > - Paperclip is the control plane people use to coordinate AI-agent work. > - Issue dependencies are first-class board mechanics that must survive issue creation. > - The service layer already persists `blockedByIssueIds` transactionally and decorates create responses after #8901. > - The public create route did not have an end-to-end regression proving that contract. > - Without route-level coverage, a validator or route mapping regression could again return success while silently dropping dependency data. > - This pull request exercises the real HTTP and database path for create-time blockers. > - The benefit is an executable contract that prevents successful creates from silently losing blocker links. ## Linked Issues or Issue Description Refs #8901 Bug regression: - What happened: an issue create request containing `blockedByIssueIds` could report success while its response omitted the requested blocker relation. - Expected behavior: a successful create persists the blocker edge and returns it immediately; a subsequent read returns the same edge. - Steps to verify: create a blocker, create a blocked issue with the blocker's ID, then inspect both the `201` response and a fresh issue read. - Paperclip version/commit: regression coverage added on current `master`. - Deployment mode: local trusted integration-test environment. Related public work: - #8901 implemented create-response relation summaries. - #4099 covers blocker readback shape more broadly. ## What Changed - Added an embedded-Postgres route regression that creates an issue with `blockedByIssueIds`. - Asserted both the `201` create response and a subsequent `GET` contain the persisted blocker summary. ## Verification - `pnpm exec vitest run server/src/__tests__/issue-create-deduplication-routes.test.ts` — 9/9 passed. - `pnpm -r typecheck` — passed. - `pnpm build` — passed. - `pnpm test:run` — 2,823 passed, 1 skipped, 2 unrelated failures in `workspace-runtime.test.ts` caused by local auto-port adoption/collision behavior (`EADDRINUSE`). - `bin/ci` is absent; the repository-documented gates above were used. ## Risks Low risk. This changes test coverage only. The test uses the existing embedded-Postgres harness and does not alter production behavior. > `ROADMAP.md` contains no matching blocker/create-contract work. This is regression coverage for an existing behavior, not a new core feature. ## Model Used OpenAI Codex, GPT-5, with reasoning and repository-aware shell/code execution tools. The serving context-window size is managed by the runtime. ## 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 Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com> |
||
|
|
8702344284 |
Coalesce dynamic parser transcript recomputations (#9926)
## Thinking Path > - Paperclip renders agent run logs into human-readable transcripts in the board UI > - External adapters parse stdout inside a sandboxed Web Worker > - Worker parsing is asynchronous, while the transcript builder consumes cached results synchronously > - Each completed line currently notifies the registry independently and rebuilds the complete transcript > - Large JSONL runs therefore trigger thousands of redundant React updates and full-log reparses > - This pull request batches completed-line notifications to one per animation frame > - The benefit is bounded UI recomputation without changing adapter output or parser semantics ## Linked Issues or Issue Description Refs #8806. That PR fixes the worker startup failure that exposed this downstream performance problem. **What happened:** Once an external parser Worker is active, each parsed JSONL line calls the registry notifier. A captured OMP run contained 3,577 lines, so one burst could request 3,577 full transcript recomputations. **Expected behavior:** Parsed line results should populate the cache immediately, while transcript recomputation should happen at most once per browser animation frame. **Steps to reproduce:** Load an external-adapter run with thousands of JSONL stdout lines, let the Worker resolve the parse requests in one burst, and count calls to the dynamic-parser result notifier. **Version/deployment:** Reproduced against Paperclip 2026.720.0, local `paperclipai onboard` deployment, Chrome on Fedora/WSL. ## What Changed - Schedule dynamic parser result notification with `requestAnimationFrame`. - Keep a single pending frame so additional Worker results reuse it. - Add a 3,577-line regression test proving one notifier call per frame instead of one per line. ## Verification - `pnpm exec vitest run ui/src/adapters/dynamic-loader.test.ts` — 1 passed. - `pnpm --filter @paperclipai/ui typecheck` — passed. - `pnpm --filter @paperclipai/ui build` — passed (existing CSS/font/chunk-size warnings only). - Browser replay after the companion worker fix: the 3,577-line OMP run stabilized as 22 Nice transcript entries with no raw `message_update`/`toolcall_delta` rows. ## Risks - Low risk: cached parse results are unchanged; only registry notification timing changes. - Visible transcript updates may arrive up to one animation frame later. - Browsers throttle animation frames in hidden tabs, but no hidden-tab render is useful; cached results render when the tab becomes visible. > This is a tightly scoped UI performance fix. ROADMAP.md contains no overlapping planned work. ## Model Used - `sub2api-codex/gpt-5.6-sol`, tool-assisted coding and browser execution with high-reasoning workflow; context-window size was not independently verified. ## 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 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 |
||
|
|
e53cce2257 |
fix: accept nested git worktree folders for local adapters (#7957)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Local adapters such as `codex_local` need workspace validation before launching agent runs. > - The validator became too strict by requiring `.git` metadata directly inside the adapter cwd. > - Git itself treats subdirectories of a repository as valid worktree paths, and Codex can operate from those nested folders. > - Paperclip project folders can be configured as subdirectories inside a larger Git worktree. > - This pull request aligns Paperclip validation with Git's own worktree detection. > - The benefit is fewer false `workspace_validation_failed` errors while still rejecting folders outside any Git worktree. ## Linked Issues or Issue Description - Fixes: #7956 ## What Changed - Replace direct `cwd/.git` metadata checking with `git -C <cwd> rev-parse --is-inside-work-tree`. - Add regression coverage for a workspace-linked issue whose adapter cwd is nested inside a parent Git worktree. - Clean up the temporary Git fixture created by that regression test. - Preserve rejection behavior for folders that are not inside any Git worktree. ## Verification - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/heartbeat-workspace-session.test.ts` - `pnpm --filter @paperclipai/server typecheck` Local validation results: - `heartbeat-workspace-session.test.ts`: 107 tests passed. - Server typecheck passed. ## Risks - Low risk. This changes validation from a stricter direct `.git` file check to Git's own worktree detection. - Requires `git` to be available for git-sensitive local adapter validation. These adapters already require Git-compatible workspaces. - Still fails closed for missing, invalid, or non-git workspace paths. > 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 Codex, GPT-5.5, with repository inspection, shell execution, local runtime validation, and focused 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 run tests locally and they pass - [x] I have added or updated tests where applicable - [x] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: zocomputer <help@zocomputer.com> Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com> |
||
|
|
42a800f0cc |
chore: fix typo cleanup across docs and worker warning (#4305)
Closes #4304 ## Thinking Path > - Paperclip is a control plane for AI-agent companies, so small wording issues in docs and operator-facing logs still shape day-to-day usability. > - This branch only touches low-level text in documentation and one server warning string. > - The problem here is narrow: several obvious typos remained in user-facing docs and a worker parse warning. > - These should be corrected without changing product behavior, API contracts, or control-plane invariants. > - This pull request applies five isolated typo fixes, keeping each file change minimal and reviewable. > - The benefit is cleaner documentation and a more polished warning message with essentially no functional risk. ## What Changed - Fixed `entreprenuer` -> `entrepreneur` in `README.md`. - Fixed `entreprenuer` -> `entrepreneur` in `cli/README.md`. - Fixed `browseable` -> `browsable` in `doc/CLIPHUB.md`. - Fixed `clonable` -> `cloneable` in `doc/plans/2026-02-16-module-system.md`. - Fixed `unparseable` -> `unparsable` in the worker parse warning string in `server/src/services/plugin-worker-manager.ts`. ## Verification - Ran `pnpm -r typecheck`. - Re-checked the touched files with `typos` review workflow. ## Risks - Low risk. These are text-only changes; the only non-doc edit is a log-message wording correction with no behavior change. ## Model Used - OpenAI Codex, GPT-5-based coding agent in the Codex CLI environment; exact deployed model ID/context window not exposed in-session; used terminal tool execution, repository inspection, and patch application. ## 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 run tests locally and they pass - [x] I have added or updated tests where applicable - [x] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com> |
||
|
|
f1016573d1 |
feat: inject X-Paperclip-Run-Id header for agent coordination (#1190) (#1199)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents run through adapters. The HTTP adapter sends each run to a remote endpoint > - The request body already contains `runId`. The request headers do not > - A downstream service cannot correlate a request with a run unless it parses the body > - A header that callers can set is not safe to trust. The adapter must own it > - This pull request adds an `x-paperclip-run-id` header to every HTTP adapter request > - It removes any `x-paperclip-run-id` header set in the adapter config, whatever its case > - The benefit is that a downstream service can trust the header to identify the run ## Linked Issues or Issue Description Refs: #1190 #1190 asks for a full agent coordination layer. This pull request covers only the part that fits V1: pass the existing `runId` to the remote service as a header. The other parts of #1190 (vector store, message bus, graph runtime) are out of scope. Related pull requests: #15914 and #13754 validate the inbound `X-Paperclip-Run-Id` header on the server. This pull request sets the outbound header on HTTP adapter requests. It does not duplicate them. ## What Changed - `server/src/adapters/http/execute.ts`: send `x-paperclip-run-id` with the value of `ctx.runId`. - `server/src/adapters/http/execute.ts`: remove any `x-paperclip-run-id` key from `config.headers` before the request is built. The match ignores case. The server value is the only one sent. - `server/src/adapters/http/execute.test.ts`: add four tests. They cover the injected value, an empty `runId`, a configured header that must not override the value, and a configured header with different case. - This branch now includes the current upstream `master`. The adapter sends requests through `guardedHttpAdapterFetch`, so the tests mock that function. ## Verification Run from the repository root: ```sh pnpm --filter @paperclipai/server exec vitest run src/adapters/http/execute.test.ts ``` Expected result: 7 tests pass (3 existing, 4 new). Manual check: configure an HTTP adapter agent with `headers: { "X-Paperclip-Run-Id": "spoofed" }`. Start a run. The remote endpoint receives one `x-paperclip-run-id` header with the real run ID. ## Risks - Behavior change: a config that set `x-paperclip-run-id` itself now loses that value. The adapter replaces it with the real run ID. This is intended. - The header is sent to every HTTP adapter endpoint. The run ID is an internal identifier, and it is already in the request body, so no new data is shared. - An empty `runId` is sent as an empty header. It is not omitted. `runId` is a required string, so this case is a boundary only. - Low risk overall. The change is limited to one function and does not touch the database, the API, or the UI. ## Model Used Claude Sonnet 5.5 (`claude-sonnet-5-5`) in Claude Code, with tool use and code execution. It fixed the tests after the merge with upstream and rewrote this description. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>canary/v2026.1204.0-canary.887700 |
||
|
|
0960dd464d |
perf(chat): eliminate activity_log seq scans, chat load waterfalls, and transcript storms (#23750)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Persistent agent chat pages (`/:companyPrefix/chats/:agentRef`) are a primary surface for collaborating with an agent across many tasks and turns. > - Opening an active agent chat page was slow: multiple endpoints scanned the full `activity_log` table, the page bypassed the single-request chat bootstrap, the native transcript hook aborted and retried historical run fetches across multiple waves, and pending task questions triggered N+1 per-task interaction requests. > - These bottlenecks blocked the initial chat reveal for several seconds and saturated server and database capacity during page open. > - This pull request eliminates the `activity_log` sequential scans with index-backed predicates (no schema migrations), batches pending-question interaction hydration, defers completed saved-reply run transcripts in persistent agent chats, stabilizes per-run transcript lifecycles, and enables parallel chat resolution and chat-bootstrap adoption on agent chat pages. > - The benefit is dramatically faster agent chat page loads with far fewer HTTP requests, zero `activity_log` full-table scans on hot chat paths, and no schema migrations. ## Linked Issues or Issue Description Related: #18461, #20355, #21650, #21671. **What happened?** Opening a persistent agent chat page with accumulated history and active tasks took multiple seconds before the conversation became visible and triggered dozens of concurrent API requests: 1. `decisionHistoryService.list` (`handledForBySource`) scanned all rows of `activity_log` because `(details ->> 'handledForUserId') IS NOT NULL` alone did not bind the second key of `activity_log_company_handled_for_created_idx`, and `decisions` used `NOT IN (SELECT id FROM issues ...)` which planned a full-company privacy subquery even when no settled decisions existed. 2. `activityService.forIssue` scanned all rows of `activity_log` because the `project.created` and `company.skill_created` branches omitted `entity_type`, preventing index scans. 3. `attentionService.taskQuestions` executed steady-state write transactions in `decision-retention` and unnecessary plan-document reads on read paths, and `CoordinatorChatPendingQuestion` mounted an `AttentionInteractionResolver` per question that fired one `GET /api/issues/:taskId/interactions` request per pending question. 4. `TaskChatThread` disabled saved-reply transcript deferral in `conversationMode`, fetching `/events` (and legacy `/log` fallbacks) for every historical completed run in the comment window, while `useNativeRunTranscripts` used a single shared `AbortController` that aborted and restarted in-flight sibling reads whenever run membership or live-stream state changed. 5. `AgentChat` waited serially for the agent roster and session before fetching the chat by `:agentRef`, `IssueDetail` skipped `startIssueChatBootstrap` for conversations, and the HTML preload plugin omitted the `AgentChat` chunk on `/chats/:ref` hard loads. **Expected behavior** Opening an agent chat page resolves the conversation and its first-frame data in parallel via `chat-bootstrap`, avoids sequential scans on `activity_log`, avoids fetching completed run transcripts when a saved reply is already visible, avoids aborting sibling in-flight transcript reads, and renders pending task questions without per-task N+1 interaction requests. **Steps to reproduce** 1. Create a company with a persistent agent chat that has 20+ historical replies from completed native runs, several hundred tasks assigned to that agent, pending `ask_user_questions` interactions across multiple tasks, and a large `activity_log` table. 2. Open `/:companyPrefix/chats/:agentRef` directly or from the sidebar and inspect the network waterfall and PostgreSQL query plans for `/activity`, `/decision-receipts`, `/pending-questions`, and `/heartbeat-runs/:id/events`. 3. Observe full-table `Seq Scan` plans on `activity_log`, bypassed `chat-bootstrap`, repeated aborted `/events` requests, and N+1 `/issues/:taskId/interactions` calls. **Paperclip version or commit** Reproduced on `ca21075837` (rebased onto `a3719da3ca`, final head `2995820afe`). ## What Changed - **Eliminate `activity_log` sequential scans (zero migrations)**: - `server/src/services/activity.ts`, `server/src/routes/activity.ts`, `server/src/routes/issues.ts`: Scope `forIssue` secondary branches by their canonical `entity_type` (`project` for `project.created`, `company_skill` for `company.skill_created`) and accept `companyId` from routes so PostgreSQL uses `BitmapOr` index scans instead of a full-table `Seq Scan`. - `server/src/services/decision-history.ts`: Add `(details ->> 'handledForUserId') >= ''` alongside `IS NOT NULL` in `handledForBySource` so PostgreSQL binds the partial index `activity_log_company_handled_for_created_idx`; replace `decision_target_issues.issue_id NOT IN (...)` with correlated `NOT EXISTS (...)`; add a `LIMIT 1` index probe before planning the full `decisions` privacy query when no settled decisions exist. - `server/src/services/conversation-decision-receipts.ts`, `server/src/routes/issues.ts`: Reuse the route's already-authorized conversation record instead of re-querying `source()`. - **Batch pending-question hydration and avoid steady-state retention writes**: - `packages/shared/src/types/attention.ts`, `server/src/services/issue-thread-interactions.ts`, `server/src/services/attention.ts`: Add optional `interaction?: IssueThreadInteraction | null` on `AttentionItem`, batch-hydrate interactions in `issueThreadInteractionService.listByIds` (grouping by `issueId` for acceptance readiness and skipping only `z.ZodError` legacy payloads), restrict `planDocumentMap` to actual plan confirmation interactions, and parallelize `decisionQueueItems` and `decisionTriage` reads in `enrichAttentionItems`. - `server/src/services/decision-retention.ts`: Add a read-only fast path in `syncItems` so steady-state reads skip opening a write transaction when retention rows are already current, while still syncing and bumping versions whenever `activityAt` changes. - `ui/src/components/AttentionInteractionResolver.tsx`, `ui/src/components/coordinator/CoordinatorChatPendingQuestions.tsx`: Accept optional `initialInteraction` so inline pending-question cards render immediately without N+1 `GET /issues/:taskId/interactions` requests while still honoring cache updates after mutations. - **Remove agent chat load waterfalls and transcript abort storms**: - `ui/src/components/TaskChatThread.tsx`, `ui/src/lib/run-answer-visibility.ts`: Defer completed `succeeded` run transcripts that already have a visible saved reply in `conversationMode` while preserving immediate hydration for live, failed, yielded, pending-interaction, and unanswered runs; precompute visible-answer lookups in linear time (`O(comments + runs)`) instead of quadratic scans. - `ui/src/components/transcript/useNativeRunTranscripts.ts`: Manage `AbortController`s and poll timers per run instead of one shared controller so adding sibling runs or transitioning stream health never aborts in-flight reads or refetches already-hydrated terminal runs; clear aborted in-flight tracking cleanly so expanding compact history refetches immediately. - `ui/src/pages/AgentChat.tsx`, `ui/src/pages/IssueDetail.tsx`, `ui/src/lib/vite-issue-detail-preload.ts`: Start `agentChatsApi.get` by `:agentRef` in parallel with roster/session reads on cold loads, enable `startIssueChatBootstrap` for conversations with an existing issue ID, and preload the `AgentChat` chunk alongside `IssueDetail` on `/chats/:ref` hard loads. - **Tests & SDK pin**: - Added/updated tests in `server/src/__tests__/activity-service.test.ts`, `server/src/__tests__/activity-routes.test.ts`, `server/src/__tests__/decision-history.test.ts`, `server/src/__tests__/issue-thread-interaction-routes.test.ts`, `ui/src/components/AttentionInteractionResolver.initial.test.tsx`, `ui/src/components/TaskChatThread.test.tsx`, `ui/src/components/transcript/useNativeRunTranscripts.test.tsx`, `ui/src/components/transcript/useNativeRunTranscripts.streaming.test.tsx`, and `ui/src/lib/vite-issue-detail-preload.test.ts`. - Updated `tests/runner-e2e/source-sdk-public-inputs.json` for `packages/shared/src/types/attention.ts`. ## Verification Local disposable PostgreSQL 18.1 benchmark (`200,000` `activity_log` rows, `455` tasks, `82` interactions, alternating baseline/treatment samples, `ANALYZE` run, positional `.values()` output equality verified on both empty and populated `handledForUserId` sets): | Caller/query | Before median | After median | Samples/spread | Complete output/contract check | Scope | | --- | --- | --- | --- | --- | --- | | `activityService.forIssue(50)` | `53.66 ms` (`50.78 ms` SQL exec, `11,147` buffers, `Seq Scan`) | `1.84 ms` (`0.31 ms` SQL exec, `23` buffers, `BitmapOr` index scans) | 7 alternating samples (before `48.03–62.79 ms`, after `1.34–3.18 ms`, `29.2x` speedup) | Pass (50 positional rows equal) | SQL | | `decisionHistory.handledForBySource` (40 ids, 0 rows) | `13.71 ms` (`11,193` buffers, `Seq Scan`) | `0.73 ms` (`2` buffers, `Bitmap Index Scan` on partial index) | 7 alternating samples (before `11.56–15.45 ms`, after `0.64–0.99 ms`, `18.8x` speedup) | Pass (empty + populated non-empty positional rows equal) | SQL | | `decisionHistory.handledForBySource` (40 ids, 1 matching row) | `40.35 ms` SQL exec (`11,193` buffers, `Seq Scan`) | `0.04 ms` SQL exec (`2` buffers, `Bitmap Index Scan` on partial index) | `EXPLAIN (ANALYZE, BUFFERS)` | Pass (1 positional row equal) | SQL | CI and reviews on final head `2995820afe`: - **GitHub Actions CI (`ci / verify`)**: **PASS** (all 86 check runs completed with 0 failures; `mergeStateStatus: CLEAN`). - **Greptile Review**: **5/5** (`SUCCESS`, 0 unresolved findings). - **Ponytail Paperclip Review**: **5/5** ("No actionable defects found in the reviewed paths. Verdict: Ship."). - **Feynman Nuclear Review**: **4/5** ("no confirmed defect in the new commits"). Tests and builds also verified locally: - `pnpm --filter @paperclipai/shared build` — pass - `cd server && node scripts/typecheck-layers.mjs` — pass (all 7 layers) - `pnpm --filter @paperclipai/ui typecheck` & `pnpm --filter @paperclipai/ui build` — pass - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/approval-queue-seeding-work.test.ts src/__tests__/decision-history.test.ts` — pass (28/28 and 14/14 on real embedded PostgreSQL) - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/activity-service.test.ts src/__tests__/openapi-routes.test.ts` — pass - Focused UI suites (`TaskChatThread.test.tsx`, `useNativeRunTranscripts.test.tsx`, `useNativeRunTranscripts.streaming.test.tsx`, `AttentionInteractionResolver.initial.test.tsx`, `AttentionInteractionResolver.replace.test.ts`, `IssueDetail.agentChatPanel.test.tsx`, `vite-issue-detail-preload.test.ts`) — pass ## Risks - **No schema migrations**: All SQL improvements use existing indexes. - **Completed chat run transcripts**: Persistent agent chats now defer completed `succeeded` runs that already have a visible saved reply, matching compact task behavior. Live, failed, yielded, pending-interaction, placeholder, progress-only, and hash-targeted runs still hydrate immediately. - **Inline interaction hydration**: `AttentionInteractionResolver` uses `initialInteraction` when provided and valid, skipping the mount-time `listInteractions` read; mutations and live updates continue to update/invalidate `queryKeys.issues.interactions(issueId)` and `["issues", "pending-questions"]`. Unparseable legacy interaction rows (`z.ZodError`) are omitted from the batch map and fall back cleanly to the per-issue read. - **Synthetic local proof vs production**: Local PostgreSQL benchmarks prove query plan and buffer reductions on synthetic data (`200k` rows); deployed latency improvements depend on production dataset size and cache warmth. ## Model Used Google Antigravity (Gemini) with tool use, terminal execution, and local embedded PostgreSQL profiling. ## 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>canary/v2026.1204.0-canary.887600 |
||
|
|
c349b060db |
fix(runner): stop polling plugin task status during active per-turn runs (#23758)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - An environment plugin can run `paperclip_runner` tasks in a remote computer or sandbox > - After a task starts, the Paperclip Runner Protocol (PRP) WebSocket checks if the Runner is alive and gives it a reconnect window across network or service restarts > - Warm plugin tasks stop polling the plugin `status` operation once the task enters the `running` phase, as added in #17390 > - Per-turn plugin tasks, such as Google Antigravity runs, still polled `status` every 500 ms for the full run and failed the run after a 15-second `status` outage > - When the plugin host or Launcher restarted for more than 15 seconds while the Runner and its PRP connection stayed healthy, every active per-turn run failed as `native_provider_terminal_failed` > - This pull request stops continuous `status` polling once a per-turn plugin task is running, and checks `status` only on PRP reconnect, close quiescence, or stop settlement > - The benefit is that active per-turn runs survive temporary plugin `status` outages and do not send recurring database and RPC status polls during a turn ## Linked Issues or Issue Description Refs #17029, #17390 **What happened?** Active per-turn `paperclip_runner` tasks in a plugin environment continued to call `environmentTask` with `{ kind: "status" }` every 500 ms after the task reached `phase: "running"` and authenticated over PRP. When `status` calls failed for 15 seconds (for example during a plugin worker or Launcher rollout) while the Runner and its PRP WebSocket stayed alive, `createPluginRunnerTaskOwner` rejected `registration.failure` with `Plugin Runner operation failed; reconcile the saved task`. The session transport closed with `notification_transport_failed` (`recoverable: false`), which failed the run as `native_provider_terminal_failed` and stopped the healthy Runner. **Expected behavior** Once a per-turn plugin Runner task reaches `phase: "running"`, PRP owns live failure detection, just as it does for warm plugin tasks. Temporary `status` outages during an active turn must not fail a healthy PRP session, and Core must not poll `status` every 500 ms throughout the turn. **Steps to reproduce** 1. Start a `per_turn` native Runner session through `createPluginRunnerTaskOwner` (for example an ACPX `antigravity` or `codex` per-turn session). 2. Wait for `registration.ready()` so the Runner task is in `phase: "running"` and PRP ingress is connected. 3. Make the plugin `status` operation fail for more than 15 seconds while PRP ingress stays healthy. 4. Before this fix, `registration.failure` rejects with `Plugin Runner operation failed; reconcile the saved task` and terminates the active turn. **Paperclip version or commit** Reproduced on `master` (`a6f7bcced3`). **Deployment mode** Self-hosted server and managed plugin sandbox environments (`authenticated` and `local_trusted`). ## What Changed - Stop the startup `readStatus()` loop in `createPluginRunnerTaskOwner` as soon as a per-turn task reaches `phase: "running"`, matching warm tasks so PRP owns live failure detection. - Deduplicate `stop` dispatch (`sendStopOnce()`) and status probing (`probeStatusOnce()` / `pollUntilStopped()`) across startup abort, `child.kill()`, `checkpoint()`, reconnect probing, and close quiescence so `stop` is sent once and status settlement follows one policy. - Check `status` once without failing the run on PRP reconnect attempts, including the first post-authentication redial (`connecting` after authentication resets `attempt` to zero) and later `reconnecting` attempts. A crashed sandbox Runner (`executionStopped: true`) resolves `completion` immediately without waiting out the reconnect grace, while a transient `status` error lets PRP reconnect continue. - Poll `status` on `quiesce()` when `runner.suspend` commits the Runner exit (guarding `outbound?.quiesce?.()` for partial test ingress handles), so `transport.close()` observes natural process exit immediately without waiting for `waitForProcess` or `adoptedRunner.isAlive()` to time out. - Update `doc/plugins/PLUGIN_RUNNER_EXECUTION.md` and add unit, setup-probe, and real `paperclip-runnerd` two-turn regressions. ## Verification - Red before the fix: - `pnpm --dir server exec vitest run src/services/native-runtime/plugin-runner-task.test.ts` failed in `does not poll Launcher status or fail an active per-turn task during a mid-turn status outage` with `Error: Plugin Runner operation failed; reconcile the saved task`. - `pnpm --dir server exec vitest run src/services/native-runtime/plugin-runner-task-warm.integration.test.ts` failed in `keeps a real per-turn plugin Runner session quiet during an active turn and settles cleanly on close` with 27 mid-turn `status` calls instead of 0. - Green after the fix: - `pnpm --dir server exec vitest run src/services/native-runtime/plugin-runner-task.test.ts` (115 passed, including real `connectRunnerPrpIngress` post-auth disconnect/crash and startup abort deduplication) - `pnpm exec vitest run server/src/services/native-runtime/plugin-runner-probe.test.ts` (15 passed) - `pnpm --dir server exec vitest run src/services/native-runtime/plugin-runner-task-warm.integration.test.ts` (2 passed, including real `paperclip-runnerd` two-turn per-turn execution and session resume) - `pnpm --dir server exec vitest run src/__tests__/plugin-runner-task.integration.test.ts src/__tests__/environment-task-authority.integration.test.ts src/__tests__/antigravity-plugin-task-credential-writeback.test.ts src/services/native-runtime/antigravity-run-start.test.ts` (39 passed) - `pnpm --dir server typecheck` (passed across all layers) ## Risks - Low risk. No database schema, API route, or plugin wire protocol changes. - Startup before `phase: "running"` still enforces the 15-second `readStatus()` deadline, and `checkpoint()` / `child.kill()` still require `executionStopped: true` before `complete` releases task grants. - If a sandbox Runner crashes mid-turn while PRP is connected, WebSocket close triggers a post-authentication reconnect attempt (`connecting`, then `reconnecting`), which checks `status` once per reconnect cycle and resolves `completion` immediately when `executionStopped: true` is reported. ## Model Used - Google DeepMind Gemini 4 Carbon (Medium reasoning budget), via Antigravity with tool use (code search, file edits, local test execution, and GitHub CLI). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |
||
|
|
cfe5042378 |
fix(opencode): fix API key env/secret resolution and support Antigravity connector (#23387)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Agent setup, environment testing, and managed AI connections pass
provider API keys into the OpenCode adapter and Paperclip Runner
> - OpenCode setup failed with `Secret not found` when a user supplied a
direct Gemini API key alongside a stale or auto-selected secret binding,
and the OpenCode runtime reported `GOOGLE_GENERATIVE_AI_API_KEY` missing
because Paperclip only passed `GEMINI_API_KEY` and limited OpenCode to
OpenRouter credentials
> - Users need reliable direct provider API keys and Google/Antigravity
API-key connectors across legacy OpenCode, native Paperclip Runner, and
Plugin Runner environments without exposing raw keys to child tool
shells
> - This pull request strips probe-overridden secret references
(including symmetric Google key aliases) before secret resolution,
prioritizes pasted API keys in setup, routes direct OpenCode provider
credentials through a runner-owned loopback proxy, and enables API-key
AI connections (including the Google / Antigravity connector) for
`opencode_local`
> - The benefit is that OpenCode agents test and run reliably with
direct provider keys or connected Google/Antigravity API keys without
false `Secret not found`, missing `GOOGLE_GENERATIVE_AI_API_KEY` errors,
or raw key leaks into child environments
## Linked Issues or Issue Description
- Fixes: #23359
- Refs #23370 (related community fix by @dev-787 for the initial Gemini
API key issue)
## What Changed
- **Server test-environment secret stripping and inheritance
(`server/src/routes/agents.ts`)**: Strip any credential key supplied in
`testCredentials` (including the symmetric `GEMINI_API_KEY` /
`GOOGLE_GENERATIVE_AI_API_KEY` pair and `hermes_gateway` `apiKey`) from
both `adapterConfig` and resolved environment `envVars` before secret
persistence normalization and runtime resolution. Scope `opencode_local`
inheritable credential groups from `@paperclipai/shared`
(`OPENCODE_PROVIDER_CREDENTIAL_ENV_KEYS`), skip inheritance when the
child supplies any OpenCode credential, and isolate multi-provider
parents to one matching provider group.
- **UI setup credential precedence (`ui/src/lib/provider-credential.ts`,
`ui/src/components/new-agent/NewAgentSetup.tsx`)**: Prefer an explicitly
entered raw API key over an auto-selected organization or personal
secret, and clear stale provider secret bindings and Google alias keys
when switching credentials or providers.
- **OpenCode direct provider keys and Gemini aliasing
(`packages/adapters/opencode-local/`, `packages/adapter-utils/`)**:
Mirror non-empty `GEMINI_API_KEY` into `GOOGLE_GENERATIVE_AI_API_KEY`
during OpenCode runtime config preparation and model discovery while
preserving blank managed isolation. Register `google`, `xai`, `groq`,
and `opencode` API key names in `api-billing-type`.
- **Runner-owned loopback credential proxy and allowlist parity
(`packages/paperclip-runner/`, `packages/plugins/sdk/`,
`packages/shared/`)**: Export canonical
`OPENCODE_PROVIDER_CREDENTIAL_ENV_KEYS` and
`OPENCODE_CREDENTIAL_ENV_KEYS` from `@paperclipai/shared`. Route direct
OpenCode provider API keys (`google`, `anthropic`, `openai`, `xai`,
`groq`, `opencode`) through a runner-owned loopback proxy
(`packages/paperclip-runner/src/drivers/opencode/provider-proxy.ts`)
with per-session bearer tokens, model-pinned endpoint allowlists, native
upstream auth header injection, request secret redaction, and redirect
refusal so raw keys never enter `opencode serve` child environments or
`opencode.json`. Allow direct provider keys across TypeScript, Rust, and
Plugin SDK allowlists, reserve `GOOGLE_API_KEY` and `GROK_API_KEY` in
TS/Rust configured-environment projections, strip ambient provider keys
(including `OPENROUTER_API_KEY`) from sanitized OpenCode runner
environments unless explicitly supplied, and redact provider keys in
output custody.
- **Antigravity / multi-provider API-key AI connections for OpenCode
(`packages/shared/`, `server/src/services/`,
`ui/src/components/ai-connections/`)**: Enable `api_key` AI connections
for `google` (Antigravity catalog slug), `anthropic`, `openai`, and
`xai` on `opencode_local` (keeping OAuth `subscription` methods
excluded), enforce provider-to-model prefix compatibility, mirror
`GEMINI_API_KEY` to `GOOGLE_GENERATIVE_AI_API_KEY` in
`prepareManagedAiRuntime`, isolate project config with
`OPENCODE_DISABLE_PROJECT_CONFIG=true`, and scope child-auth override
detection in `agent-ai-connection-default.ts` to non-empty OpenCode
credentials (supporting plain values, `secret_ref.secretId`, and
`user_secret_ref.key`).
- **Tests and pinned input registry**: Added unit, route, cross-layer
allowlist parity, and pinned `opencode@1.18.34` `bash`-tool credential
isolation tests across `adapter-utils`, `adapter-opencode-local`,
`paperclip-runner`, `server`, and `ui`, and synchronized
`tests/runner-e2e/source-sdk-public-inputs.json`.
## Verification
- `@paperclipai/adapter-utils`: `src/api-billing-type.test.ts` (17/17
tests), `typecheck`, `build` — passed
- `@paperclipai/adapter-opencode-local`:
`src/server/runtime-config.test.ts`, `src/server/models.test.ts`,
`typecheck`, `build` — passed
- `@paperclipai/shared`: full suite (123/123 files, 1426/1426 tests),
`typecheck`, `build` — passed
- `@paperclipai/paperclip-runner`: `typecheck:typescript`,
`build:typescript`, `check:package-boundaries`,
`opencode-server-driver.test.ts` (101/101 including pinned
`opencode@1.18.34` `bash`-tool test), `output-custody.test.ts` (13/13),
`configured-environment.test.ts` (35/35),
`antigravity-credentials.test.ts` (11/11), and
`durable-prp-control-plane.test.ts` — passed
- `@paperclipai/server`: `typecheck` and targeted suites
(`ai-connections.test.ts` 170/170, `agent-hire-ai-connections.test.ts`
84/84, `agent-test-environment-routes.test.ts` 72/72,
`agent-hire-auth-inheritance-routes.test.ts` 29/29,
`plugin-runner-credentials.test.ts` 43/43,
`plugin-runner-credential-names.test.ts` 6/6 cross-layer TS/Rust parity,
`opencode-local-adapter-environment.test.ts` 4/4,
`ai-auth-failure.test.ts` 32/32, `ai-provider-routing.test.ts` 21/21,
`antigravity-runner-credentials.test.ts`) — passed
- `@paperclipai/ui`: `typecheck`, `provider-credential.test.ts`,
`AiConnectionSelect.test.tsx` (20/20 tests) — passed
- `@paperclipai/plugin-sdk`: `build`, `environment-tasks.test.ts`,
`environment-task-release-resume.test.ts` (104/104) — passed on
`03dc341957`
- `@paperclipai/paperclip-runner`: `provider-traffic.test.ts` &
`provider-traffic-proxy.test.ts` alongside OpenCode/Antigravity/custody
suites (169/169) — passed on `03dc341957`
- `node tests/runner-e2e/source-sdk-public-inputs.mjs
|
||
|
|
01ecbadbf1 |
fix(server): stop reporting uploads the client abandoned mid-body (#23756)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The server accepts file uploads (issue attachments, images, company
imports) through multer
> - A client can close the connection before the upload body ends
(closed tab, lost network, cancelled upload)
> - multer then rejects with a plain `Error: Request aborted` or `Error:
Request closed`
> - The error handler only knew Node's own `aborted`/ECONNRESET
disconnect error, so it reported these as server crashes (500) to Sentry
> - This pull request treats multer's disconnect errors as a client
disconnect when the request stream really stopped early
> - The benefit is that cancelled uploads no longer create false crash
reports, and real server errors stay visible
## Linked Issues or Issue Description
**What happened?**
A hosted production server sent `Error: Request aborted` to Sentry from
`multer/lib/make-middleware.js` (`req.on('aborted')`). The error was
handled, had no code, and came from a client that dropped a multipart
upload.
**Steps to reproduce**
1. Start a multipart upload to a route that uses multer.
2. Send part of the file.
3. Close the connection before the body ends.
**Expected behavior**
The server ends the response with 499 and does not send a crash report.
**Actual behavior**
The error handler calls `reportCrash` and answers 500.
No public issue exists. I searched open and closed PRs for related fixes
and found none. Related earlier work: #19037 (AbortError after client
disconnect).
## What Changed
- `server/src/middleware/error-handler.ts`: add
`isMultipartClientDisconnect`. It matches a plain `Error` with the
message `Request aborted` or `Request closed`, no error code, and
`req.readableAborted === true`. The handler answers 499 and skips the
error sinks for this case.
- `server/src/__tests__/error-handler-client-abort.test.ts`: add a test
with a real multer route. The client sends part of a multipart body and
then drops the connection. Add a test that the same error text from a
connected request is still reported as 500.
## Verification
- `cd server && npx vitest run
src/__tests__/error-handler-client-abort.test.ts
src/__tests__/error-handler.test.ts`: 24 passed.
- Red before the fix: the new abandoned-upload test failed with
`captureException` called once with `Error: Request aborted`, the same
error as the production report.
- Green after the fix. I ran the abort suite 3 more times and it passed
each time.
- I did not run the full server typecheck locally. CI runs it.
## Risks
- Low risk. The match needs the exact multer messages, no error code,
and a request stream that stopped before its end. A route that throws
the same text while the client is still connected is still reported
(covered by a test).
> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used as a coding agent
with tool use (shell, code execution) in Claude Code.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
7d2b1d5362 |
fix(responsibilities): use configured plugin workers for task wakeups (#23705)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Responsibility actions create tasks and wake their assigned agents. > - Plugin execution needs the server's configured plugin worker manager. > - Five responsibility route groups constructed heartbeat services without that manager. > - The task could be created successfully, then fail during environment setup. > - This pull request gives those routes the existing configured heartbeat service so the first run can start. ## Linked Issues or Issue Description **What happened?** Starting a responsibility bar conversation created a task, but its first run failed during sandbox setup. Delegation, dashboard conversations, automation conversations, and status update requests used the same incomplete heartbeat construction. Background recovery could later start the task through a configured service. **Expected behavior** The first wake uses the application's configured plugin workers, so it can acquire the assigned execution environment. **Steps to reproduce** 1. Enable Responsibilities and configure an agent to use a plugin-backed execution environment. 2. Start a responsibility bar conversation with that agent. 3. Observe that task creation succeeds but sandbox setup fails because the heartbeat service has no plugin worker manager. **Paperclip version or commit** Reproduced against master at `0f36a88f41e36e93e50f146196353840e2def341` with an application-level regression test. All five wakeup cases failed before the fix. **Deployment mode** A server with a plugin-backed execution environment. The regression test uses the normal application factory, a disposable local Postgres database, and a configured plugin worker manager. No duplicate public issue or pull request was found in the pre-change search. ## What Changed - Pass the existing worker-enabled heartbeat service to the five responsibility route groups. - Keep the automation route's plugin worker manager for its routine service. - Add application-level coverage for all five wakeup paths and the disabled-feature gate. The tests use the real route registration and database services, and intercept execution before provider work starts. ## Verification - Red: all five application wakeup cases failed on the original route wiring because the worker manager was missing. - Green: 109 tests passed across the application wakeup, responsibilities, bars, dashboard, automation conversations, and status report suites. - Server typecheck: after fixing an optional-input type error in the test fixture, `node scripts/typecheck-layers.mjs` from `server/` passed all source and test layers. The Runner TypeScript build and plugin SDK prerequisites also passed. - `node scripts/check-test-budget.mjs --files server/src/__tests__/responsibility-app-wakeups.test.ts`: passed. - `node scripts/check-module-boundaries.mjs`: passed. - `git diff --cached --check` and a Gitleaks scan of the staged diff: passed. - The first `pnpm verify` selection was invalidated by the fixture type fix. The final `pnpm verify --explain` passed and selected 2,008 test files conservatively for this application change. Local validation used the six focused suites above. Required CI supplies the broader test, typecheck, build, Runner, and E2E coverage. - [Greptile review](https://github.com/paperclipai/paperclip/pull/23705#issuecomment-7402767043): 5/5 on `10035ffae203942ee93a5ee65879cd55a2130d4b`, with no inline comments or unresolved review threads. [CI run 47276399658](https://github.com/paperclipai/paperclip/actions/runs/47276399658) completed successfully on that same commit: typecheck, build, Runner checks, all general and serialized test shards, and all 16 E2E shards passed. Both required checks (`ci / verify` and `ci / e2e`) passed. The branch has no merge conflicts with master. All 71 checks have settled with no blocking results. The external Superagent Security Scan completed with a neutral conclusion; Socket and Snyk checks passed. GitHub reports the pull request as clean and mergeable. ## Risks Low risk. The change reuses a heartbeat service that already has the server's plugin worker manager. Route authorization and feature gates keep their current behavior. No schema migration or configuration change is required. Live provider execution and a Cloud rollout are outside this PR's local verification; the tests verify the application-to-execution dependency boundary. The code and regression tests describe the corrected internal wiring, so no user documentation change is needed. ## Model Used OpenAI Codex, `gpt-6.1-sol`, with xhigh reasoning effort and repository 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 - [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>canary/v2026.1204.0-canary.887200 |
||
|
|
a6f7bcced3 |
fix(native): release a superseded failed run's foreign owner after the bounded wait (#23696)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Native runs keep a finalization claim. The expired-owner pass (`native-failed-run-owner-release.ts`) settles the claim of a run that already failed, after it proves the old owner stopped. > - A run can fail while its controller on another server still holds that claim. The pass cannot verify a controller in another process space. It holds the task for the board and names the old run. > - When the task has moved on to a newer run, nothing ends that hold. Restart recovery stops at `issue_execution_lock_changed`. Operator containment accepts only the local reason. The active hold also removes the pass's only wake. > - This pull request lets the expired-owner pass release such an owner after the existing bounded wait, with its existing proofs. It also resolves the hold that names the old run. > - The benefit is that the task is not blocked indefinitely. Automatic continuation and the user's Retry work again. ## Linked Issues or Issue Description Refs #19131 (related: it retires `retryable_failure` sources only after a committed successor. It does not cover an `observed` claim whose successor also failed.) **What happened?** A native run failed while its controller on another server still held its finalization claim (phase `observed`). A newer run of the same task started after it. Then: - the expired-owner pass could not verify the foreign controller, so it opened a board-owned `native_restart_recovery_blocked` hold that names the old run; - restart recovery checked the old run every minute and returned `issue_execution_lock_changed` with no write; - operator containment accepts only the local `controller_process_space_unverified` reason, not the remote one; - `nextAbandonedNativeOwnerReleaseAt` excludes rows with an active hold, so the pass had no wake for this row. The user's Retry was refused with `previous_execution_unverified`, and assigned-work wakes were refused every cycle. The task stayed blocked for more than 9 hours. **Expected behavior** An unverifiable lapsed controller is system uncertainty, not a person's decision. When a newer run has taken over the task, the old claim must settle after the bounded wait, and the task must continue on its normal paths. **Steps to reproduce** 1. Make a native run fail while its coordinator stays `observed` with a lease owner from another process space. 2. Clear the task's execution lock and start a newer run of the same task. 3. Run `releaseAbandonedNativeOwners`. It opens the board hold. 4. Before this change: `nextAbandonedNativeOwnerReleaseAt` returns `null`, and later passes never settle the claim or the hold. ## What Changed All changes are in `native-failed-run-owner-release.ts`, in the existing `expired_owner` release: - For a foreign-space owner, the pass now releases the claim when all of these are true: the task's lock is not on the run, a newer run of the task exists, the lease lapsed at least `NATIVE_NAMESPACE_UNVERIFIED_WAIT_MS` ago, the run has no recorded process (PID or group), and the owner is not a finalizer/cleanup owner. Otherwise it keeps the old behavior (surface the board hold, return). - The existing proofs still apply: settled environment lease, no pending Stop, `runProcessMayBeLive` (in-process executions, live controller lease, recorded process), and no accepted result. Only the foreign controller probe is skipped, because a foreign PID is not local evidence. This is the same bounded-wait policy restart recovery uses for unverifiable controllers. - The settlement uses the existing write path: `terminal_failure`, activity entry `native.failed_run_owner_released` (now with `supersededByRunId`), and settlement notifications. It records `successorRunId` and `supersededByRunId`, and resolves (`cancelled`) the board hold whose fingerprint is `native-controller-space:<runId>:…`. - `nextAbandonedNativeOwnerReleaseAt` now also wakes the pass at `leaseExpiresAt + NATIVE_NAMESPACE_UNVERIFIED_WAIT_MS` for such an attended owner. - The first revision changed restart recovery and `native-superseded-retry.ts`. After review, those changes are removed. ## Verification - New `server/src/services/native-runtime/native-superseded-failed-owner.integration.test.ts` (embedded Postgres, real owner-release pass): - Before the fix (master code): `releases the old owner and its hold once the bounded wait has passed` failed. `nextAbandonedNativeOwnerReleaseAt` returned `null` after the hold was raised. - After the fix: 7/7 pass. The claim goes to `terminal_failure` with `successorRunId`. The run keeps `failed` and `native_session_interrupted`. The lock stays `null`. No active hold remains. One activity entry is written, and a later pass does not raise the hold again. - Safety cases (pass before and after): the claim and the hold stay unchanged within the bounded wait, with no newer run, with a recorded run process, with a live run controller lease, while this server executes the run, and while the task's lock is on the run. - Neighbouring suites: `native-failed-run-owner-release.test.ts`, `execution-control-work.test.ts`, `native-restart-recovery-isolation.test.ts` (63 passed with the new file). `heartbeat-native-restart-suspension`, `task-interruption-automatic-path`, `execution-projection`, `native-runner-restart-recovery.integration` (421 passed, 22 skipped). - I did not run the full server typecheck locally because of the sandbox memory limit. CI runs it. ## Risks - Scope: only a foreign-space owner of a run that already ended, when a newer run of the same task exists and the run has no recorded process. Other cases keep their behavior. - Safety: the old controller's stop is still not verified. This follows the existing bounded-wait policy for unverifiable controllers. A newer run already holds the task, so this changes no isolation decision. The release does not start a turn and does not change the task's lock. - Load: one extra indexed query in the release-time calculation. A due row that still cannot be released (for example, an accepted result) makes the pass check at the normal reconciliation interval. - Unchanged: the separate defect where the finish call of a run is not captured (`native_finalization_missing` with `reportedWorkDisposition: yielded`). ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code execution in a Paperclip agent workspace. ## 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 - [ ] 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>canary/v2026.1204.0-canary.887100 |
||
|
|
e2e2265085 |
feat(plugins): tell a task side panel plugin when the person closes its tab (#23747)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Plugins can show an agent detail tab in the task side panel, next to a task > - The board mounts only the active side panel tab, and it unmounts a plugin view in the same way when the person switches tabs and when the person closes the tab > - Thus a plugin that shows a live view in a task panel tab cannot know when the person is done with it, and it cannot release the view > - A component callback does not solve this, because a background tab is not mounted when the person clicks its close control > - This pull request adds an optional declarative `taskSidePanel.closePath`, symmetric with the existing `availabilityPath` > - The benefit is that a plugin can release a live view when the person closes its tab, and plugins that do not declare the path see no change ## Linked Issues or Issue Description Refs #17796 (added plugin panels in task side panels). Related: #23609. **Subsystem affected** Plugin UI slots: `detailTab` slots with a `taskSidePanel` declaration, and the task side panel in the board UI. **Problem or motivation** A plugin panel in the task side panel gets no signal when the person closes its tab. The board unmounts the view on a close and on a tab switch in the same way, so the plugin cannot tell the two apart. A plugin that holds a live view for the panel cannot release it when the person closes the tab. **Proposed solution** Add an optional `closePath` to `taskSidePanel`. When the person closes the tab, the board sends a fire-and-forget POST to that plugin route, with the same agent, run and task as the availability request. The manifest must declare the path as a board POST route scoped to agent `:entityId`. **Alternatives considered** A callback on the mounted plugin component. It does not work for a background tab, because only the active tab is mounted. **Roadmap alignment** This extends the plugin system. It adds no product-specific behaviour to the control plane. ## What Changed - `taskSidePanel` accepts an optional `closePath`. It uses the same path rules as `availabilityPath`: a plugin-relative path with one `:entityId` segment. - Manifest validation requires a declared `POST` API route at `closePath` with `auth: "board"`, no transport, and `companyResolution: { from: "agent", param: "entityId" }`. These are the same rules as the `GET` availability route. - When the person closes a plugin panel tab in the task side panel, the board sends `POST /plugins/<pluginId>/api<closePath>?runId=<run>&issueId=<task>`, with `:entityId` replaced by the panel's agent. The board leaves out `runId` when the task has no active run. This applies to the active tab and to background tabs. - The board does not wait for the request. A failed request does not block the close, and the board logs a console warning. - The board sends no request on a tab switch, when the panel unmounts, when the person leaves the task, or when the board removes a panel that is no longer available. - A slot without `closePath` behaves as before. - The plugin SDK README and the plugin spec document the new field. A plugin declares: ```ts ui: { slots: [{ type: "detailTab", id: "screen", displayName: "Live view", exportName: "LiveView", entityTypes: ["agent"], taskSidePanel: { availabilityPath: "/agents/:entityId/view/availability", closePath: "/agents/:entityId/view/close", }, }] }, apiRoutes: [ { routeKey: "view.availability", method: "GET", path: "/agents/:entityId/view/availability", auth: "board", capability: "api.routes.register", companyResolution: { from: "agent", param: "entityId" } }, { routeKey: "view.close", method: "POST", path: "/agents/:entityId/view/close", auth: "board", capability: "api.routes.register", companyResolution: { from: "agent", param: "entityId" } }, ], ``` ## Verification - `packages/shared`: `npx vitest run src/validators/plugin.test.ts` passes (85 tests). New cases accept a valid close route and a close path equal to the availability path. They reject unsafe paths, a missing POST route, the wrong method (`GET`, `DELETE`), non-board auth, a non-agent company resolution, and the wrong agent parameter. - `ui`: `npx vitest run src/components/task-side-panel/TaskSidePanel.pluginClose.test.tsx` passes (6 tests). The tests render the task side panel and check that a close of the active tab and of a background tab sends exactly one POST to the correct URL. They also check that a tab switch, an unmount, a removal of an unavailable panel, and a slot without `closePath` send nothing, and that an idle task omits `runId` and a failed request still closes the tab. - Red check: with the board call removed, the three close tests fail. - `ui`: `npx vitest run src/hooks/useTaskPluginPanels.test.tsx` passes (56 tests). - `tsc --noEmit` passes for `packages/shared` and for `ui` source files. ## Risks - Low risk. The field is optional, and slots without it keep their current behaviour. - A plugin receives a close POST only for a person's close of the tab. The plugin must treat the request as a hint, because the request can fail or arrive late. - Existing manifests continue to validate. The availability route error message has the same text as before. > 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`, run in Claude Code with tool use (file edits, shell, test runs) 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 - [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>canary/v2026.1204.0-canary.887000 |
||
|
|
a3719da3ca |
fix(ui): prioritize recent composer assignees (#23744)
## Thinking Path > - Paperclip helps people manage work with agents. > - People pick a recipient in the new-task and task reply composers. > - The picker puts people before agents. Frequently used recipients can be far down the list. > - The composer can use its saved assignee history to put recent recipients at the top. > - This change shows up to five recent choices, then puts the other agents before the other people. ## Linked Issues or Issue Description **What existing behavior does this improve?** The assignee list in the task composer. **Subsystem affected** UI board. **Current behavior** Open the assignee picker in a task composer. The list can show people before all agents. It has no top list of mixed agent and human selections. **Proposed behavior** Show the five most recent available choices first in newest-first order. Show the other agents, then the other people. Put No assignee at the end of the list and include it in search. **Reason and benefit** People can find recipients they use often and reach other agents sooner. Related composer UI changes are #15050 and #14250. ## What Changed - Read company-specific assignee history in the shared composer picker. - Record each explicit picker selection, including reselection of the current assignee. Reset run settings only when the assignee changes. - Keep the saved recent-agent fallback for older browser history. - Test recency order, the five-choice limit, company boundaries, search, reselection, and reopening with 268 choices in the new-task and reply composers. Bound option reads in each step. ## Verification - The new regression test failed on the old order and passed with the fix. - Ran the composer, run settings, assignee, and recent selection test files with Vitest. All 205 tests passed. - Ran `pnpm --filter @paperclipai/ui typecheck`. It passed. - Ran `pnpm test:e2e tests/e2e/new-task-picker-touch.spec.ts --workers=1`. All three Chromium tests passed. ## Risks Low risk. This changes the order of existing options. The history uses the browser's existing storage. The regression test checks that a missing assignee does not reduce the five-choice limit. ## Model Used OpenAI Codex, GPT-6, with shell and GitHub tooling. ## 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>canary/v2026.1204.0-canary.886900 |
||
|
|
70d780107d |
fix(ui): stop re-sorting Recents sidebar items to the top on click (#23404)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The sidebar includes a Recents list that mixes recent tasks, agent chats, and projects. > - Opening an existing task or project from Recents currently writes `Date.now()` as its timestamp and jumps that item to the top. > - That breaks spatial stability when a person clicks through items in Recents, because every click re-sorts the list. > - This pull request stops passive opens and clicks from changing an existing item's recency timestamp, seeds unseen items from their latest activity timestamp, and records explicit user activity when a person takes action on a task. > - The benefit is a predictable Recents list that orders items by recent activity without shifting on click. ## Linked Issues or Issue Description **What happened?** When a person clicked an existing task or project in the sidebar Recents list, opening that item stamped it with `Date.now()` and moved it to the top of Recents. Clicking through several recent items constantly re-sorted the sidebar. **Expected behavior** Recents sorts items with the most recent activity at the top, and clicking or passively opening an existing item keeps the list order unchanged. Only real activity (such as creating, editing, commenting, approving/rejecting, or responding to an interaction on a task, or server-side updates on chats and projects) moves an item to the top. **Steps to reproduce** 1. Open the Coordinator workspace with at least two tasks or projects in the sidebar Recents list. 2. Click an older item lower in Recents. 3. Observe that the clicked item jumps to the top of Recents even though no activity occurred. **Paperclip version or commit** Reproduced on `master` (`b63445c8f1`). **Deployment mode** Local dev (source checkout). Related PRs: #22219, #22024. ## What Changed - Updated `recordRecentTask` in `ui/src/lib/recent-tasks.ts` so passive opens never change an existing entry's `recordedAt`, and unseen passive opens seed chronologically from `lastActivityAt` or `updatedAt` (falling back below existing history when no valid timestamp exists). - Removed visit-time `Date.now()` bumping in `ui/src/pages/IssueDetail.tsx` and centralized explicit local activity updates (`recordLocalTaskActivity`) across task edits, comments, approvals (captured at mutation start), interaction responses, and isolated re-issues for both Streamlined and Coordinator modes. - Enabled immediate recent-task recording on task creation in `ui/src/components/NewIssueDialog.tsx` when Coordinator mode is enabled (previously gated only on Streamlined mode). - Extracted `recordProjectRecentVisit` and `buildCoordinatorRecents` in `ui/src/components/CoordinatorSidebar.tsx` so revisiting a project keeps its existing entry unchanged, unseen projects seed from `project.updatedAt`, real project updates advance its sort time via `Math.max`, and memo inputs remain referentially stable. - Updated `DESIGN.md` and `doc/PRODUCT.md` to document activity-based Recents ordering without click-driven re-sorting. - Added and updated unit and component tests in `ui/src/lib/recent-tasks.test.ts`, `ui/src/components/CoordinatorSidebar.recents.test.ts` (including a linear-scan read-budget check across 450 items), and `ui/src/pages/IssueDetail.mobile.test.tsx`. ## Verification Tested on rebased commit `79f028344b56ec41092ad458b956c3fd02be0fe0`: - `pnpm --filter @paperclipai/ui typecheck` — passed (0 errors). - `pnpm --filter @paperclipai/ui exec vitest run src/lib/recent-tasks.test.ts src/hooks/useRecentTasks.test.tsx src/hooks/useRecentTaskOpenWarmup.test.tsx src/components/CoordinatorSidebar.recents.test.ts src/pages/IssueDetail.mobile.test.tsx` — passed (5 files, 68 tests). - `pnpm check:token-gates` — passed (all 4 token gates clean). - Broad typecheck, build, and full test coverage will be verified by GitHub CI on this PR. ## Risks - Low risk. Changes are scoped to client-side Recents ordering, state recording, and documentation. No database migrations, API schema changes, or permission changes. - Users who relied on clicking an old task solely to pin it at the top of Recents can use the existing sidebar pin control or take action on the task. ## Model Used - Antigravity (Google DeepMind agentic assistant) with code inspection, file editing, shell execution, Vitest, TypeScript, and GitHub CLI 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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing>canary/v2026.1204.0-canary.886800 |
||
|
|
c5a705ce92 |
fix(trust): enforce low-trust sourceTrust quarantine on native comments and documents (#23621)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The low-trust review preset isolates untrusted agent runs and marks their raw outputs with `sourceTrust` quarantine metadata so higher-trust agents do not ingest raw output without promotion > - HTTP route writes tagged low-trust comments and documents with `sourceTrust`, but internal native completion replies, finalizer recoveries, continuation summary updates, and non-Muse native runner tool writes (`report_progress`, `write_document`) persisted `sourceTrust: null` > - Higher-trust non-Muse native runner reads (`list_documents`, `read_document`) also bypassed document quarantine redaction > - This pull request resolves `sourceTrust` centrally in `issueService.addComment` and `documentService.upsertIssueDocument` whenever an agent writes without an explicit `sourceTrust` value, removes the `museRuntime` gate on native runner `report_progress` and `write_document` writes, and redacts quarantined documents on higher-trust non-Muse native runner reads > - The benefit is that raw outputs from low-trust native runs retain quarantine metadata across all comment and document write paths and stay redacted from higher-trust agents until promoted ## Linked Issues or Issue Description **What happened?** When an agent running under the `low_trust_review` preset completed a native run or called native runner tools (`report_progress`, `write_document`), its comments and documents were saved with `sourceTrust: null`. Because `sourceTrust` was null, higher-trust agents could read the raw low-trust output directly through ordinary comment and document access without promotion. **Expected behavior** All agent-authored comments and documents produced under `low_trust_review`—including native run completion replies, recovered finalizer replies, continuation summary updates, and non-Muse native runner `report_progress` / `write_document` writes—must persist `sourceTrust` with `preset: "low_trust_review"` and `disposition: "quarantined"`, and higher-trust agents must receive the quarantined redaction placeholder instead of the raw body. **Steps to reproduce** 1. Configure an agent with `trustPreset: "low_trust_review"` and a valid `trustBoundary`. 2. Run a native task on that agent so it writes a completion reply, calls `report_progress` or `write_document`, or refreshes `continuation-summary`. 3. Read the resulting comment or document as a standard-trust agent via `get_task_history`, `list_documents`, `read_document`, or ordinary comment reads. 4. Before this fix, `sourceTrust` is `null` and the raw body is returned unredacted. **Paperclip version or commit** `master` (`ce204a223a`) ## What Changed - **`server/src/services/issues.ts`**: Updated `issueService.addComment` to select `projectId` and `executionPolicy` on the target issue and resolve `sourceTrust` via `resolveActorSourceTrustForIssue` whenever `actor.agentId` is set and `options?.sourceTrust === undefined`. This covers native run completion replies (`run-completion.ts`), recovered finalizer replies (`native-run-finalizer.ts`), status decision committer comments (`status-decision-committer.ts`), and internal agent comment writes. - **`server/src/services/documents.ts`**: Updated `documentService.upsertIssueDocument` to select `projectId` and `executionPolicy` on the target issue and resolve `sourceTrust` via `resolveActorSourceTrustForIssue` whenever `input.createdByAgentId` is set and `input.sourceTrust === undefined`. This covers continuation summary refreshes (`issue-continuation-summary.ts`), native plan writes (`native-session-executor.ts`), and internal agent document writes. - **`server/src/services/native-runtime/paperclip-runner-tool-authority.ts`**: Removed the `this.binding.museRuntime` guard on `resolveActorSourceTrustForIssue` in `report_progress` and `write_document` so all `paperclip_runner` runs tag writes consistently, and added higher-trust quarantine redaction (`redactQuarantinedBodyForHigherTrust`) for non-Muse `list_documents` and `read_document` reads. - **`server/src/__tests__/source-trust.test.ts`**: Added red-green regression tests covering `addComment` without explicit `sourceTrust`, `upsertIssueDocument` without explicit `sourceTrust`, and non-Muse `PaperclipRunnerToolAuthority` `report_progress` / `write_document` writes read by a higher-trust agent via `get_task_history`, `list_documents`, and `read_document`. ## Verification - Confirmed the new regression tests failed before the fix (`sourceTrust` received `null` on `addComment` and `upsertIssueDocument`). - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/source-trust.test.ts` — 10/10 passed. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/low-trust-red-team-routes.test.ts` — 14/14 passed. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/issue-continuation-summary.test.ts` — 8/8 passed. - `pnpm --filter @paperclipai/server typecheck` — passed with 0 errors. - `pnpm verify` exited 2 (broad CI coverage required); CI will run the full required check matrix on this PR. ## Risks - Low risk. Standard-trust agent writes continue to resolve to `sourceTrust: null` (unchanged behavior). - Callers that already pass an explicit `sourceTrust` value (such as promotion flows or HTTP routes) keep their explicit value without extra work. - Only newly inserted comments and agent-authored document upserts without an explicit `sourceTrust` perform the policy lookup inside the existing transaction. ## Model Used - Google Gemini (Antigravity agentic coding assistant) with tool use and local code/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 mergecanary/v2026.1204.0-canary.886700 |
||
|
|
ca21075837 |
test(server): fold tiny purge suites into the agent lifecycle owner suite (#23719)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - The agent lifecycle module owns agent purge and company deletion.
> - The repository test budget rule asks to add a narrow database case
to the owning suite, not to a small standalone file.
> - Two small test files each start their own embedded Postgres for a
few purge cases only.
> - This pull request moves those cases into the agent lifecycle owner
suite and deletes the two small files.
> - The benefit is two fewer test workers and two fewer database setups
in CI, with the same assertions kept.
## Linked Issues or Issue Description
No public GitHub issue exists for this change. The problem is described
here, using the enhancement template labels.
**What existing behavior does this improve?**
The layout of the agent lifecycle test suites and their CI setup cost.
**Subsystem affected**
server/ — REST API & orchestration services (agent lifecycle and company
deletion tests).
**Current behavior**
Two test files each boot an own embedded Postgres for a few purge cases:
- `server/src/services/agent-cost-history-deletion.test.ts` (61 lines)
covers the `agent_cost_history_retained` purge guard.
- `server/src/services/case-deletion.test.ts` (69 lines) covers company
deletion with retained case handoffs and the
`agent_case_history_retained` purge guard.
Each file pays a separate Vitest worker import and a separate embedded
database start. The `rules/test-budget.mdc` rule says: do not keep a
standalone embedded-Postgres file for one narrow regression case; add
the case to the owning service suite. The owner suite
`server/src/modules/agent-lifecycle/__tests__/lifecycle.test.ts` already
imports the same production modules (`createAgentLifecycle`,
`deleteCompany`) and uses the same database fixture.
**Proposed behavior**
The owner suite holds these cases inside two nested describe blocks. The
two small files no longer exist. No assertion changed.
**Reason and benefit**
CI runs two fewer standalone database files in the general server lane.
The moved cases reuse the database the owner suite already started. The
historical duration manifest recorded about 6 s and 8 s per file at its
recorded revision; these weights are scheduling estimates, not measured
savings for this change.
**Breaking changes**
None. Test code only.
## What Changed
- Moved 4 purge cost-history cases (cost event by run, cost event by
agent, finance event by run, and the positive purge case) into the owner
suite under `describe("agent purge with retained cost history")`.
- Moved 3 company-deletion-with-case-handoff cases (an `it.each` over
three handoff states, an `it.each` over source and target roles, and the
unrelated-agent purge case; 6 test registrations in total) into the
owner suite under `describe("deletion with retained case handoffs")`.
- Deleted `server/src/services/agent-cost-history-deletion.test.ts` and
`server/src/services/case-deletion.test.ts`.
- Added the `cases`, `caseAccessSources`, `caseHandoffs`, `costEvents`,
and `financeEvents` table imports to the owner suite.
- Net change: 131 deleted and 102 added test lines. No production line
changed.
The owner suite is a test file and was already longer than 1,000 lines
before this change. Extending the designated owner suite is the remedy
the test budget rule names for these files.
## Verification
Commands run on this branch (head `01bc9384`), local sandbox, Node
v25.9.0:
- `cd server && ../../node_modules/.bin/vitest run
src/modules/agent-lifecycle/__tests__/lifecycle.test.ts` — 1 file
passed, 86 tests passed, all 10 moved registrations included.
- Intended-failure control 1: the `agent_cost_history_retained` guard in
`server/src/services/agent-deletion.ts` was disabled for a moment. The 3
moved cost-history cases failed on their expected 409 conflict. The
positive purge case still passed. The file was then restored with `git
checkout` and the diff was checked clean.
- Intended-failure control 2: the `agent_case_history_retained` guard
was disabled the same way. The 2 moved handoff purge cases failed on
their expected 409 conflict. The other matched cases still passed. The
file was restored the same way.
- `node scripts/check-test-budget.mjs --files
server/src/modules/agent-lifecycle/__tests__/lifecycle.test.ts` — PASS.
- The full owner suite was run again after the restorations: 86 tests
passed.
Not run locally: the repository typecheck and the full test suite. The
runner build dependency for the typecheck did not fit the free disk of
this sandbox. The required CI checks passed on the PR head `01bc9384`:
68 checks succeeded (typecheck, build, all 20 general server test
shards, chat and workspaces-b shards, runner support, Greptile). Six
conditional lanes were skipped as not applicable. Three independent bot
reviews scored the change 5/5 with no findings.
## Risks
- Low risk. Test files only; no production code changed.
- The moved cases now share the database instance the owner suite
starts. Each moved case still creates its own rows with fresh
identifiers, and the controls above show each case still fails at its
own guard.
- The general server shard durations manifest still lists the two
deleted files. The manifest is regenerated from CI runs by
`scripts/ci/refresh-test-durations.mjs`; stale entries do not route
work.
## Model Used
GLM 5.3 (z-ai/glm-5.3; exact model ID `openrouter/z-ai/glm-5.3`), run by
the Paperclip Test Gardener agent, with tool use and code execution. No
extended thinking mode.
## 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
canary/v2026.1204.0-canary.886600
nightly/v2026.1204.0-nightly.0
|
||
|
|
597992d955 |
fix(ui): open the chat side drawer on the chat's task list (#23702)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Agent Chat lets a person talk to one agent. The chat header has a
button that toggles the right side drawer.
> - In a new chat, the button did nothing. The desktop panel did not
show content until the chat was saved by the first message.
> - In the coordinator workspace, the drawer opened on an empty
launcher. It did not show the tasks from the chat.
> - The user expects the button to open a list of the tasks that the
chat created or that its agent worked on.
> - This pull request makes the drawer open on that task list in both
cases.
> - The benefit is that the header button always does something useful
in a chat.
## Linked Issues or Issue Description
**What happened?**
In the chat view, the button in the top right toggles the right side
drawer. In a new chat, a click on the button does nothing. In the
coordinator workspace, the drawer opens empty.
**What did you expect to happen?**
The button opens the drawer with a list of the tasks that the chat
created or worked on.
**Steps to reproduce**
1. Turn on Agent Chat.
2. Open a chat with an agent that has no saved conversation.
3. Click the drawer button in the top right of the header.
4. The drawer does not open.
## What Changed
- `IssueDetail.tsx`: For an unsaved chat on desktop, the panel now shows
a read-only task list. The full side panel still needs a saved issue,
because its Properties tab writes to the issue.
- `AgentWorkPanels.tsx`: Add `AgentChatDraftTasksPanel`. It shows the
agent's tasks. In the coordinator workspace, it shows the empty list of
tasks from the conversation.
- `TaskSidePanel.tsx`: In the coordinator workspace, a saved chat now
opens on its Tasks tab ("Tasks from this conversation") and not on the
empty launcher. Other tasks keep the empty, on-demand panel.
- Add `IssueDetail.agentChatPanel.test.tsx` with four desktop tests: a
saved chat, an unsaved chat, a saved coordinator chat, and an unsaved
coordinator chat.
## Verification
- `cd ui && npx vitest run src/pages/IssueDetail.agentChatPanel.test.tsx
src/pages/IssueDetail.mobile.test.tsx`: 7 tests pass.
- Red-green: before the fix, the unsaved-chat test failed because the
drawer stayed hidden. The coordinator test failed when I removed the
`TaskSidePanel.tsx` change.
- `pnpm verify`: 4,214 tests pass in 260 of 261 selected files. One
test, `codemirror-single-instance.test.ts`, timed out at 5 s under load.
It walks `node_modules` and does not touch this change. It passes alone
(10/10).
- `npx tsc --noEmit -p ui`: no errors in changed files. The only errors
come from Storybook feature-map files that need generated indexes. Those
indexes are not in git.
- I did not do a manual browser check. The local preflight build did not
finish in time.
## Risks
- Low risk. The change applies only to Agent Chat routes.
- In the coordinator workspace, a chat's drawer now opens on Tasks and
not on the launcher. The user can still open other tabs from the
launcher.
- The unsaved-chat task list in the classic workspace shows all the
agent's tasks. That is the same list as the saved chat's default Tasks
tab.
## 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
- [ ] 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: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1204.0-canary.886500
|
||
|
|
3d3c702942 |
fix(runner): keep room to retire a session that filled its command journal (#23700)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Native agent runs use a Runner. Core keeps a durable journal of the commands that it sends to the Runner. > - The journal stops at 500 commands. A long run adds one semantic tool result to the journal for each tool call, so the journal can become full. > - The next run on the same sandbox must retire that session. It must queue `turn.stop`, `runner.drain`, `runner.suspend` and `session.close`. The full journal rejects these commands. > - Each successor run then fails with `native_predecessor_retirement_unproven` (`command_journal_full`). The task stays stuck until a person intervenes. > - This pull request keeps a separate, bounded reserve in the journal for retirement commands only. > - The benefit is that the next run can always stop and close a session whose work filled the journal. ## Linked Issues or Issue Description **What happened?** A long native run (Codex app-server) made almost 500 tool calls. Its Core command journal became full. Three automatic successor runs on the same sandbox then failed in `retireWarmPredecessor`. The error was "The previous run's session on this sandbox could not be retired (Durable PRP command journal bound exceeded: command_journal_full.)". The stack ends in `DurablePrpControlPlane.queueCommand` from `awaitRunnerSuspensionBarrier`. **Expected behavior** The next run retires the old session and continues. A full work journal must not block the commands that stop and close the session. **Steps to reproduce** 1. Create a `DurablePrpControlPlane`. 2. Queue 500 `semantic_tool.result` commands. 3. Queue `turn.stop`, `runner.drain`, `runner.suspend` or `session.close`. 4. On `master`, each of these throws `command_journal_full`. **Paperclip version or commit** `986af44e94` (`master`). The failure was seen on release `3f882fc589`. **Agent adapter(s) involved** Codex (native Runner, `paperclip_runner` adapter). The journal is not adapter-specific. Related: #20727 (a draft about the other journal bound, `command_payload_too_large`). This PR does not change that bound. ## What Changed - `durable-prp-control-plane.ts`: work commands still stop at 500 (`maxCommands`). - Retirement commands (`turn.stop`, `runner.drain`, `runner.suspend`, `runner.shutdown`, `session.close`, `session.destroy`, `run.cancel`) can use 64 more slots (`retirementCommandReserve`). Reads such as `session.snapshot` cannot use the reserve, so readiness polls cannot consume it. - The saved-state check and the checkpoint check accept up to 564 commands. Without this change, a retired journal cannot load again. - Three tests: one fills the journal and retires it, then reopens the local state. One does the same with checkpoint persistence and decodes the checkpoint. One fills the reserve to 564 commands and checks that a 565th retirement command and a read are both rejected without changing the journal. ## Verification - Red before the fix: `npx vitest run src/control-plane/durable-prp-control-plane.test.ts -t "command journal"` failed with `command_journal_full` on `turn.stop`. - Green after the fix: the same command passes (2 tests). - Each load bound is necessary: when I put back the old bound in the two validation checks, both tests fail. - Reserve bound: with the hard-cap check removed, the boundary test fails (`expected [Function] to throw an error`). - After review fixes (canary/v2026.1204.0-canary.886400 |
||
|
|
0f36a88f41 |
fix(notifications): stop toasting "changed the title" on task updates (#23674)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The board shows live toast notifications when another person or agent changes a task. > - Each title edit makes a toast that says "<actor> changed the title". > - Agents often set or change task titles automatically. These toasts are noise and give no useful information. > - This pull request removes title changes from the toast details on the server and from the toast text in the UI. > - The benefit is fewer unhelpful notifications. Status, priority, assignment, and description changes still show. ## Linked Issues or Issue Description **Describe the bug** Users get toast notifications that only say "<actor> changed the title". **Steps to reproduce** 1. Open the board as a user. 2. Let another user or an agent change the title of a task. 3. See the toast "<actor> changed the title". **Expected behavior** A title change does not show a notification. Other changes in the same update still show. ## What Changed - `server/src/realtime/activity-toast-details.ts`: the projection does not set `titleChanged` any more. This also stops old cached UI bundles from showing the toast. - `ui/src/context/LiveUpdatesProvider.tsx`: `describeIssueUpdate` does not add "changed the title". A title-only update now makes no toast. - Tests: new UI and server tests for title-only and mixed updates. The existing tests now expect no `titleChanged` field. ## Verification - Red-green: the new UI test "does not announce title changes" failed before the fix and passes after it. - `cd ui && npx vitest run src/context/LiveUpdatesProvider.test.ts`: 140 passed. - `cd server && npx vitest run src/realtime/activity-toast-details.test.ts src/__tests__/live-events-toast.test.ts`: 19 passed. ## Risks - Low risk. Title changes do not show a toast any more. The task activity log still records them. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code execution in Claude Code. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details (the execution workspace assigned the branch name) - [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 (no doc describes this toast) - [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: devinfoley <139239+devinfoley@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>canary/v2026.1204.0-canary.886300 |
||
|
|
bca282e587 |
feat(recents): add tasks from manual routine runs to Recents (#23675)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The sidebar Recents list shows the tasks from a person's own recent activity > - A person can run a routine manually with "Run now", and the run creates a task > - That task does not show in Recents, and opening it does not keep it there, because Recents only admits tasks under the Mine participation rule. This also affects every routine, channel, and agent-created task that a person opens > - The Mine rule keeps these tasks out of Mine on purpose, so we must not change that rule > - This pull request adds a separate Recents eligibility flag. It also admits tasks that the viewer opened and tasks from manual routine runs that the viewer started. The UI records the new task in Recents when the run starts > - The benefit is that people can find the task they just started from the sidebar at once, and Mine stays unchanged ## Linked Issues or Issue Description **Is your feature request related to a problem? Please describe.** When I run a routine manually and it creates a task, the task is not in my Recents list. I must go to the routine or the task list to find it. **Describe the solution you'd like** When I run a routine manually and a task is created, add that task to my Recents list automatically, even if I did not open it. Also, a task that a routine creates does not show in Recents even after I open it. **Additional context** Mine must continue to keep routine tasks out by default, including routines that a person starts manually (see `doc/PRODUCT.md`). ## What Changed - `server/src/services/issue-summaries.ts`: navigation summaries return a new `isRecentEligibleForMe` flag. It is true when one of these conditions is true: - The viewer participates under the Mine rule. - The viewer opened the task. The check is the viewer's `issue_read_states` row, which is unique on company, issue, and user. - The viewer started the manual routine run that created the task. The check is a `routine_runs` row found through the indexed `linked_issue_id`, with `source = 'manual'` and the same ID as the issue's `originRunId`. The issue `createdByUserId` must be the viewer, with no creating agent. `isParticipantForMe`, Mine, and unread state do not change. - `packages/shared`: add `isRecentEligibleForMe` to `IssueSummary`. - `ui/src/hooks/useRecentTasks.ts`: Recents uses `isRecentEligibleForMe` (with a fallback to `isParticipantForMe` for older cached summaries) to show, keep, and prune entries. - `ui/src/lib/recent-tasks.ts`: add `recordStartedRoutineRunTask`. It puts the run's task at the top of Recents. The summary fetch then supplies the title and status and confirms eligibility. - New `useRecordRoutineRunInRecents` hook. All five "Run now" paths call it on success: Routines (both list variants), Routine detail, Execution workspace detail, and the Responsibility screen. - `tests/runner-e2e/source-sdk-public-inputs.json`: refresh the pin for `packages/shared/src/types/issue.ts`. - `doc/PRODUCT.md`: document the Recents behavior. ## Verification - `cd ui && npx vitest run src/hooks/useRecentTasks.test.tsx`: 29 passed. The new test "shows a task from the viewer's manual routine run at the top before it is opened" fails on the old hook (red) and passes with the change (green). Other new tests cover a run that the server does not confirm (for example, a coalesced run) and a repeat run for a task that is already in Recents. - `cd server && npx vitest run src/__tests__/issue-summaries-routes.test.ts` (embedded Postgres): 24 passed. One new test checks that a manual run by the viewer is Recents-eligible but not a Mine participant, and that runs by another person and scheduled runs are not eligible. Another new test checks that a routine task the viewer opened is Recents-eligible, and that a task opened only by another person is not. That test fails on the previous service code (red) and passes with the change (green). - `ui` typecheck: no errors in changed files. (Errors exist only in ungenerated Storybook feature-map indexes, which this change does not touch.) - The full `server` typecheck was killed by the local memory limit. CI covers it. - Manual check: run a routine with "Run now", then look at sidebar Recents. The new task shows at the top before you open it. Mine does not show it. ## Risks - Low risk. No schema change and no migration. - The summaries query adds two `EXISTS` subqueries per requested task. Both use indexes (the read-state unique index and `routine_runs_linked_issue_idx`). The request is bounded by `ISSUE_SUMMARIES_MAX_IDS`. - Behavior change: Recents now keeps tasks that the person opened, also when the task is automatic work. Old local Recents entries for automatic tasks that the person read can come back. - If a manual run coalesces into an existing task that the viewer did not start, the entry is pruned after the summary read. That task does not show in Recents. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), via Claude Code with tool use (shell, file edit, 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 - [ ] 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) - [ ] 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: devinfoley <139239+devinfoley@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b93527b632 |
fix(ui): sort the Reports to manager picker alphabetically (#23689)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Each agent can report to a manager agent. The user selects the manager in the "Reports to" picker. > - The picker shows candidate managers in directory order. This order is not alphabetical. > - When a company has many agents, the user cannot easily find a specific agent in the list. > - This pull request sorts the picker rows alphabetically by agent name. > - The benefit is that the user finds a manager faster, and the order agrees with the sidebar. ## Linked Issues or Issue Description **Is your feature request related to a problem?** The "Reports to" picker on the agent profile lists agents in an unpredictable order (for example: "Mac Coder", "Bug Bot", "Nibbler", "CTO"). It is hard to find one agent in a long list. **Describe the solution you'd like** Sort the picker rows alphabetically by agent name. Ignore letter case. Put "Agent 2" before "Agent 10". **Describe alternatives you've considered** Sorting the agent list in each caller. This change sorts inside the shared `ReportsToPicker` component instead, so the agent profile and the agent configuration form both get the same order. ## What Changed - Added `reportsToPickerRows` to `ui/src/components/ReportsToPicker.tsx`. It removes terminated and excluded agents, then sorts the rows by name with `localeCompare` (`sensitivity: "base"`, `numeric: true`). - `ReportsToPicker` uses this function for its rows. "No manager" stays at the top. - The picker indexes `disabledAgentIds` in a `Set`. Before, it scanned the array once per row. - Added `ui/src/components/ReportsToPicker.test.ts` with unit tests for the order and the filter. ## Verification - `cd ui && npx vitest run src/components/ReportsToPicker.test.ts`: 2 tests pass. - Red check: the same tests fail on the previous code. - `npx tsc --noEmit -p ui/tsconfig.json` shows no errors in the changed files. - 1,000-agent test bounds the sort work with a throwing name-read counter (per `rules/ui-render-cost.mdc`). - Manual: ran the branch on a local dev server with 13 agents. The "Reports to" picker showed: Agent 2, Agent 10, Bug Bot (Deprecated), CEO Agent, CTO, Dickens, Engineer Agent, Fry (Codex), Mac Coder, nibbler, Reviewie, Slow Query (GLM), Test Gardener (GLM). ## Risks - Low risk. The change is UI-only and changes only the row order. Filter and selection behavior do not change. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, file edit) and image input. ## 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) - [ ] 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: devinfoley <139239+devinfoley@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>canary/v2026.1204.0-canary.886100 |
||
|
|
986af44e94 |
fix(ui): omit task archive success toasts (#23697)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Task views let each person archive tasks from their inbox. > - Some archive actions display a success toast. > - The task lists and indicators already show the archive result. > - This pull request removes the success toast from each task archive path. ## Linked Issues or Issue Description **What happened?** Some task archive actions displayed a success toast. Related work: #11220. **Expected behavior** A successful task archive has no toast. If the action fails, the UI shows the error. **Steps to reproduce** 1. Open Tasks and select Mine or All tasks. 2. Archive a task. 3. On the base revision, the Task archived toast appears. **Paperclip version or commit** Reproduced on master at `3f882fc5895072e9a63e46df0eb0e1dad75f092b`. **Deployment mode** Local UI component tests. ## What Changed - Remove task archive success toasts from the inbox-backed Tasks view, the shared task-list action, task detail, and the recent-tasks sidebar. - Use **U** after archiving directly from Mine or Unread. Use **Restore** in **Archived** for a task archived from any view. - Add regression cases for Inbox, Tasks, All tasks, and task detail. Document where to restore a task. ## Verification - The Tasks and All tasks cases failed on the base revision because they received a success toast. - The task detail case also failed with the original success toast restored and passed after its removal. - Run `pnpm exec vitest run --root ui --config vitest.config.ts src/pages/IssueDetail.mobile.test.tsx src/pages/TaskListPagination.test.tsx src/lib/inboxArchiveCache.test.ts src/lib/keyboardShortcuts.test.ts src/hooks/useInboxTouchedIssues.test.tsx`. All 63 tests passed on `8cf0f17`. - `pnpm --filter @paperclipai/ui typecheck` passed. - The workspace Git storage guard prevented the incremental `pnpm verify` command from selecting tests. The focused Vitest run above covers the changed behavior. ## Risks - The Undo button in the toast goes away with the toast. Use **U** for archives initiated in Mine or Unread. **Restore** in **Archived** covers detail, sidebar, and other task-list archives. - The archive request, task cache updates, and error handling use the same paths. ## Model Used - OpenAI Codex, GPT-6, with shell and GitHub API 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 - [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 hint: if you need to wait for this pull request to be reviewed, merged, or closed before continuing, use this instead of polling: gh event listen --resource https://github.com/paperclipai/paperclip/pull/23697 --event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1 - It prints the first event as a JSON line on stdout and exits; run it again to wait for the next one. - Add `--timeout` to stop waiting after a while, for example `--timeout 30m`; it then exits with status 8. - Events carry no details; read the pull request to see what changed. - It misses changes made before it starts, so read the pull request once it is running. - See `gh event listen --help` for other event types. - Event subscriptions are in preview and may not be enabled for your account. hint: if you need to wait for this pull request to be reviewed, merged, or closed before continuing, use this instead of polling: gh event listen --resource https://github.com/paperclipai/paperclip/pull/23697 --event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1 - It prints the first event as a JSON line on stdout and exits; run it again to wait for the next one. - Add `--timeout` to stop waiting after a while, for example `--timeout 30m`; it then exits with status 8. - Events carry no details; read the pull request to see what changed. - It misses changes made before it starts, so read the pull request once it is running. - See `gh event listen --help` for other event types. - Event subscriptions are in preview and may not be enabled for your account.canary/v2026.1204.0-canary.886000 |
||
|
|
a30541b793 |
fix(ui): fade out task status update caret unless hovered (#23402)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - On a task page, the activity thread shows status update rows such as "Ran commands, searched files" and their expanded activity rows. > - In `TaskChatRunnerActivityGroup`, the disclosure caret on the right edge stays at full opacity even when the user does not hover over the row. > - Other collapsible rows in the task thread (`TaskChatThinking`, `TaskChatProtocolActivityRow`) hide their disclosure carets at rest while preserving touch-device discoverability (`tc-hover-disclosure-caret`) and keeping expanded carets legible (`rotate-90 opacity-80`). > - This pull request fades out the right-side caret on runner activity phase toggles, folded read runs, and expandable activity rows unless hovered, keyboard-focused, or expanded, while sharing the repository's `.tc-hover-disclosure-caret` touch fallback. > - The benefit is a calmer task thread with no layout shift on hover, full keyboard accessibility, and consistent disclosure behavior across all task-chat rows. ## Linked Issues or Issue Description **What existing behavior does this improve?** The disclosure carets on the right side of task status update rows in `TaskChatRunnerActivityGroup` on the task page. **Subsystem affected** ui/ — React + Vite board UI **Current behavior** Activity status update rows such as "Ran commands, searched files", folded file-read rows, and expandable activity rows keep their right-side chevron caret visible at full opacity at rest. **Proposed behavior** When collapsed and not hovered, the right-side caret stays faded out (`opacity-0`). It fades in smoothly with the shared motion tokens (`--motion-duration-fast` and `--motion-ease-standard`) on row hover or keyboard `focus-visible`, and fades back out when hover or focus ends. While a row is expanded, the caret stays visible (`rotate-90 opacity-80`, brightening to `opacity-100` on hover/focus). All three carets include the shared `.tc-hover-disclosure-caret` class so touch-only devices (`@media (hover: none)`) keep the disclosure affordance discoverable. **Reason and benefit** Hiding the right-side caret at rest removes visual noise across activity updates in the task thread and aligns `TaskChatRunnerActivityGroup` with the existing hover-disclosure pattern in `TaskChatThinking`, `TaskChatProtocolActivityRow`, and `ui/src/index.css` (related: #12640, #15048). Using opacity instead of unmounting keeps row alignment stable on hover. **Breaking changes** None. ## What Changed - Extract a shared `DISCLOSURE_CARET_CLASS` constant in `ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx` including `tc-hover-disclosure-caret` and the shared motion tokens (`--motion-duration-fast`, `--motion-ease-standard`, `motion-reduce:transition-none`). - Add named group hooks (`group/activity-phase`, `group/read-run`, `group/activity-row`) to the three disclosure buttons in `TaskChatRunnerActivityGroup.tsx`. - Fade out each right-side `ChevronRight` caret at rest (`opacity-0`), reveal it on hover or keyboard focus (`group-hover/...:opacity-100`, `group-focus-visible/...:opacity-100`), and keep it visible while open (`rotate-90 opacity-80`). - Add unit tests in `ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx` covering completed summaries, active toggles, folded read runs, expanded activity rows, open/close state transitions, and `tc-hover-disclosure-caret`. ## Verification - Local focused Vitest on `0b46f7cf99`: `node node_modules/vitest/vitest.mjs run ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx ui/src/components/task-chat/antigravity-thread.test.tsx ui/src/components/task-chat/completed-activity-summary.test.ts` — 36/36 tests passed. - Local focused Vitest on `0b46f7cf99`: `node node_modules/vitest/vitest.mjs run ui/src/components/TaskChatThread.test.tsx` — 436 passed, 1 skipped. - Local token gates on `0b46f7cf99`: `pnpm check:token-gates` — all 4 token gates clean. - Local UI build on `0b46f7cf99`: `pnpm --filter @paperclipai/ui build` — built cleanly and verified compiled CSS emits `@media (hover:none){.tc-hover-disclosure-caret{opacity:1}}` and scoped `group-hover/*:opacity-100` rules. - GitHub Actions CI on `0b46f7cf99` ([run 46734780674](https://github.com/paperclipai/paperclip/actions/runs/46734780674)): all 30 checks passed (`ci / verify`, `ci / Build`, `ci / Typecheck + Release Registry`, `ci / General tests`, `ci / policy`, all 16 `ci / e2e` shards, `commitperclip PR Review`, `Socket Security`, `Superagent Security`, and `security/snyk`). - Automated reviews on `0b46f7cf99`: `ponytail-paperclip-review` (5/5, ship), `feynman-nuclear-review` (5/5), and `Greptile Review` (5/5; P2 note about `tc-hover-disclosure-caret` answered and resolved in-thread). ## Risks - Low risk. Only the opacity, rotation, and transition classes on the right-side disclosure carets change; click, expand/collapse, keyboard, and touch-device discoverability semantics stay intact. > This is a small UI polish change and does not overlap with planned core features in `ROADMAP.md`. ## Model Used - Google DeepMind Antigravity coding agent (Gemini model with reasoning/thinking mode, file editing, shell execution, and GitHub CLI tools; exact model ID and context window are not exposed by the runner environment). ## 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 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>canary/v2026.1204.0-canary.885900 |
||
|
|
3f882fc589 |
fix(native): stage task-description attachments for native agents (#23688)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - People often create a task with a screenshot in its description and
assign it to a native agent.
> - The native Runner stages wake-comment files into the agent
workspace, so the agent can open an image with its file reader.
> - Files attached to the task description have no comment, so the
Runner never staged them.
> - The agent then said that it could not see the screenshot, or it
guessed from the text.
> - This pull request stages the task's own files on every native wake.
> - The benefit is that an agent can see the screenshot that explains
the task.
## Linked Issues or Issue Description
**What happened?**
A user created a task with the description "This list should probably be
sorted alphabetically" and pasted a screenshot of the list. A Claude
agent on a native sandbox replied that it could not open the screenshot
and asked which list to sort. It found the attachment through the API,
but the run had no staged path and no tool that put the image in its
workspace. When the same image was attached to a comment, the agent
opened it at once.
**Expected behavior**
A native agent can inspect files that are attached to the task
description, the same as files attached to a wake comment.
**Steps to reproduce**
1. Create a task and paste an image into its description.
2. Assign the task to a native `paperclip_runner` agent.
3. Ask the agent what the image shows.
4. The prompt has no "Paperclip native attachment access" entry for the
image, and the agent cannot see it.
**Paperclip version or commit**
`master` at
canary/v2026.1204.0-canary.885800
|
||
|
|
0d867729db |
fix(server): encode non-Latin-1 workspace download filenames (#23683)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Board users can open and download files from a task's workspace through the file-resources route > - The download response builds a raw `Content-Disposition` header from the file name > - Node rejects header values that hold characters outside Latin-1, such as the U+202F narrow no-break space in macOS screenshot names, or CJK text > - The route then fails with `TypeError: Invalid character in header content ["Content-Disposition"]` and returns 500 > - This pull request makes the route use `res.attachment()`, which encodes the name correctly > - The benefit is that users can download workspace files with any name ## Linked Issues or Issue Description Refs #22892. That PR fixes the same defect in the asset and invite-logo routes. This PR fixes the last route that builds the header by hand: the workspace file download. The two PRs change different files and do not conflict. **What happened?** A staging server reported `TypeError: Invalid character in header content ["Content-Disposition"]` from `ServerResponse.setHeader`. A workspace file download with a non-Latin-1 file name returns HTTP 500 for the same reason. **Expected behavior** The download succeeds. The header holds an ASCII `filename` fallback and an RFC 6266 `filename*` parameter with the full UTF-8 name. **Steps to reproduce** 1. Put a file named `Screenshot 10.32.55 PM.png` (with U+202F before `PM`) in a project workspace. 2. Download it through `GET /api/issues/:issueId/file-resources/content?download=1`. 3. The server returns 500. **Relevant logs or output** `TypeError: Invalid character in header content ["Content-Disposition"]` at `ServerResponse.setHeader (node:_http_outgoing)`. ## What Changed - `server/src/routes/file-resources.ts`: the download path now calls `res.attachment(safeAttachmentFilename(title))` instead of writing the raw header. The call comes before `Content-Type`, so the route keeps its own content type. - `server/src/__tests__/file-resources.test.ts`: a new test downloads a file whose name holds U+202F and Japanese text. It checks the status, the content type, the encoded `Content-Disposition`, and the bytes. ## Verification - Red: without the route change, `npx vitest run src/__tests__/file-resources.test.ts -t "not Latin-1"` fails with `expected 500 to be 200`. - Green: with the change, `npx vitest run src/__tests__/file-resources.test.ts` passes (53 of 53). The old `archive.bin` and `index.html` download tests still get `attachment; filename="..."` unchanged. - I also reproduced the Node error directly: `setHeader("Content-Disposition", 'inline; filename="Screenshot 10.32.55 PM.png"')` throws the same message. ## Risks Low risk. ASCII file names produce the same header as before. Non-Latin-1 names now get a `?` fallback in `filename` and the full name in `filename*`, which current browsers use. `res.attachment()` also sets `Content-Type` from the extension, but the route sets its own value right after that call. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), used as an agent with tool use (shell, code 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: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>canary/v2026.1204.0-canary.885700 |
||
|
|
8a5b374a9c |
test: order Antigravity mode changes before admission readback (#23685)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The Runner checks provider settings before it admits an Antigravity swarm. > - A test changes a confirmed mode during admission and expects rejection. > - The fake CLI could complete model readback before it sent the mode change. > - Pipe scheduling could then move the change past admission and fail the test. > - This pull request sends the mode change before model readback. > - The test can now check admission rejection without depending on pipe timing. ## Linked Issues or Issue Description **What happened?** [Cloud readiness run 47231816304, attempt 2](https://github.com/paperclipai/paperclip/actions/runs/47231816304/job/144707142899) failed the Antigravity test named “turns a provider mode change during admission into a typed failure, stops the CLI, and keeps the caller alive”. The open promise resolved instead of rejecting. This cancelled [image run 47231816399](https://github.com/paperclipai/paperclip/actions/runs/47231816399). **Expected behavior** The fixture must deliver the mode change while admission still waits for model readback. The runtime must reject with `ANTIGRAVITY_SWARM_RECEIPT_MISMATCH` and stop its child process. **Steps to reproduce** Run `PAPERCLIP_VITEST_RETRY=0 pnpm exec vitest run src/drivers/acpx/antigravity-swarm-runtime.test.ts --maxWorkers=1` from `packages/paperclip-runner`. Before this change, the `mode-flip` fixture wrote the valid model update before the invalid mode update. Separate pipe reads could let admission finish between them. The CI failure shows this outcome. One focused local baseline attempt passed, so the intermittent failure was not reproduced locally. ## What Changed - Send the `mode-flip` notification before the model configuration update. Admission cannot finish model readback before it receives the invalid mode. - Keep the existing rejection and child retirement assertions. The idle mode-change fixture and runtime code stay as they are. ## Verification - The full Antigravity swarm runtime file passed: 66 tests, retries disabled, one worker. - `node --check packages/paperclip-runner/test-fixtures/antigravity-cli/fake-agy-acp.mjs` passed. - `node scripts/check-test-budget.mjs --base origin/master` passed. - `git diff --check` passed. - `pnpm verify --explain` returned exit 2 because a Runner fixture needs broad CI coverage. Required CI will supply that coverage. - Final head `2c55808f394ad07dc279a6d074fecb9f61fa540f`: [PR CI run 47239627453, attempt 2](https://github.com/paperclipai/paperclip/actions/runs/47239627453/attempts/2) passed. It reports 76 successful jobs and one skipped selection job. Both required gates (`ci / verify` and `ci / e2e`) passed. Standalone Runner image checks, macOS checks, and Windows Rust checks passed. No checks remain active. GitHub reports `CLEAN` and `MERGEABLE`. - Greptile scored this exact head 5/5 with no actionable findings or unresolved review threads. - Earlier failures remain accounted for: [the delayed initial run](https://github.com/paperclipai/paperclip/actions/runs/47239537426) was superseded by the `full-ci` label run and cancelled by PR concurrency. Attempt 1 of the replacement run passed 73 jobs, but [policy](https://github.com/paperclipai/paperclip/actions/runs/47239627453/job/144728063451) exceeded its 10-minute limit. Both final gates then failed with `Policy must succeed`, actual `cancelled`. Policy logs returned `BlobNotFound`, so the stalled step and cause are unknown. After the run completed, GitHub accepted a policy-job rerun request. This reran the reusable CI workflow in attempt 2, which passed in full. The passing retry establishes recovery; it does not establish the timeout's cause. - Separate operational issue: master image runs [47235737261](https://github.com/paperclipai/paperclip/actions/runs/47235737261) and [47238936675](https://github.com/paperclipai/paperclip/actions/runs/47238936675) failed their source observers because GitHub's Actions job-list API returned HTTP 502. Their architecture builds and exact-source readiness runs passed. The current master's job-list request still returns 502 with `per_page=100`. Small pages can read that image run, but a small-page source-readiness request also failed. There is no verified pagination workaround. This fixture change does not resolve that API failure or prove image publication. ## Risks - Low risk. The diff changes one notification's order in a test fixture. It adds no runtime behavior or configuration. - The original intermittent failure was observed in CI. The local baseline attempt passed. The fix removes the ordering gap identified in that failure. The full CI workflow passed for the final revision. - Documentation does not change because the runtime contract stays the same. ## Model Used - OpenAI `gpt-6.1-sol`, through the Codex harness in T3 Code, with xhigh reasoning effort and shell tools. The context window size is not exposed by the runtime. ## 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> |
||
|
|
ded4c1bf15 |
fix(server): encode Unicode asset response filenames (#22892)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - People open uploaded files and company logos from their browser. > - Two routes put the stored filename directly into an HTTP header. > - Node rejects some valid Unicode names used by screenshot tools and people. > - This change formats both filenames with the same Express API used for issue attachments. ## Linked Issues or Issue Description Fixes: #7493 Thanks to dosthcpp for the report and the earlier proposal in #7494. The issue attachment route already uses Express to format the filename. The asset content and invite logo routes still wrote it directly. Related #8716 and #9570 cover attachment display policy and ZIP downloads. ## What Changed - Format the filename with Express in the asset content and invite logo responses. Keep the current content type and inline or attachment choice. - Exercise a screenshot with a narrow non-breaking space and a logo with Japanese characters. ## Verification - On the preceding master `f1dd9288d`, both Unicode cases returned 500 before the fix. - On `3fbf872d9` with the fix, 57 tests passed across the assets, invite logo, and issue attachment suites. The new checks verify status, Unicode filename encoding, and inline disposition. - Full server typecheck, test budget, and `git diff --check` passed. PR CI is pending. ## Risks - Both routes still set the content type from storage metadata after formatting the filename. The existing disposition, range, and content policy behavior remain covered by the route tests. ## Model Used - OpenAI Codex (GPT-6 family) with terminal and Vitest access. Exact model identifier and context window were not exposed 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 - [ ] 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 |
||
|
|
c5f5d3163d |
test: remove recovery and Tailscale readiness races (#23678)
## Thinking Path > - Paperclip requires checks for an exact Core source commit before it publishes images. > - Cloud readiness runs the server integration tests without retries. > - Server shard 18/20 failed in recovery cleanup and Tailscale enrollment. > - The recovery test returned before its status wake reached the heartbeat drain. > - The Tailscale fixture exposed state before it was safe to read or observe. > - This pull request makes those fixtures wait for their actual completion boundaries. ## Linked Issues or Issue Description Refs #23227. Related earlier cleanup fix: #23673. **What happened?** [Docker run 47225196060](https://github.com/paperclipai/paperclip/actions/runs/47225196060) stopped after [Cloud readiness server shard 18/20](https://github.com/paperclipai/paperclip/actions/runs/47225196237/job/144677926140) failed. Staging image preparation then waited for a verified Core image. The previous Runner reattachment cleanup fix passed its protocol lane in that run. The recovery test deleted agents after a late wake inserted a child row. The Tailscale test failed its first connection. On the [next master run](https://github.com/paperclipai/paperclip/actions/runs/47227863572/job/144687185775), the Tailscale blocked-save test timed out while waiting for a callback that startup might never reach. **Expected behavior** Fixture teardown must join the status wake. The fake Tailscale CLI must publish complete state and receive each simulated consent event reliably. Tests must await enrollment completion and fail promptly when connection setup fails. **Steps to reproduce** Run the two changed test files or server shard 18/20 with retries disabled. The unmodified local files reproduced a consent callback failure. The CI links above record the foreign-key and blocked-save failures. The foreign-key failure did not reproduce in the initial local run. **Paperclip version or commit** Failures on `07150650c926d8947ae591f61e4ed854ca284149` and `ba521863f6090e40a37ed3cb6b1ecaf358a11424`. The fix starts from the latter and is rebased onto `86042310917c15eb04be121baf58a6929e52a7d2`, which adds release notes only. **Deployment mode** Source checkout in GitHub Actions. Local checks use macOS arm64, Node 25.6.1, hermetic Tailscale executables, and disposable embedded PostgreSQL. Searched open PRs and issues for the failing files, `ENOTEMPTY`, Runner cleanup, and Tailscale tests. No duplicate fix was found. Issue #23227 describes the startup-dependent expiry window and is also addressed here. ## What Changed - Wait for the accepted recovery status change to persist its wake before the existing heartbeat drain deletes fixture tables. The wake has an asynchronous route prologue that can outlive the HTTP response. - Register a signal handler in the owned fake CLI before exposing the login URL. Publish fixture state atomically, then signal that exact child to simulate consent. This removes the dependency on filesystem notification delivery. - Await the network manager's completion promise instead of a short callback polling window. - Start the expiry test with a valid window, advance the application clock after startup, and submit late consent. Keep real subprocess timers and restore the clock spy in `finally`. - Race blocked-save admission against early connection settlement so startup failures are reported instead of hanging the test. - Only two test files change. Runtime behavior, release gates, and deployment policy do not change. ## Verification - Baseline: the unmodified two-file run failed the consent callback assertion; 129 tests passed. The recovery cleanup passed locally, with its CI failure retained above. - An intermediate expiry check failed its one-second callback wait. A later parallel shard run still lost a filesystem notification. The final fixture uses an explicit consent signal and awaits manager completion. - That eight-worker shard run also timed out in unchanged workspace-trust and runtime-control fixtures while a monolithic typecheck ran concurrently. Those two unchanged files passed in a serial control with the changed fixtures: 186 tests passed across four files. The final shard is run separately with four workers and retries disabled. - `pnpm exec tsc --noEmit -p tsconfig.json` from `server/`: passed. - After the release-notes-only rebase, the Tailscale file passed again: 9 tests, retries disabled. The two fixture file contents are identical to the final shard run. - `PAPERCLIP_VITEST_RETRY=0 PAPERCLIP_VITEST_MAX_WORKERS=4 pnpm test:run:general -- --group general-server-without-chat-or-native-runner --shard-index 17 --shard-count 20`: passed on the final fixture contents. 85 files passed, 3 skipped; 1945 tests passed, 18 skipped. Duration: 160 seconds. - `node scripts/check-test-budget.mjs --files server/src/__tests__/issue-recovery-actions.test.ts server/src/services/connectors/tailscale/device-login-network.test.ts`: passed. - `git diff --check` and local secret/PII review: passed. - [Greptile review](https://github.com/paperclipai/paperclip/pull/23678#issuecomment-7396242983): 5/5 on head `13bf3586bcf3201ce137f674812e8faf778ee77d`, with a successful current-head check and no actionable findings or review threads. The [full PR CI workflow](https://github.com/paperclipai/paperclip/actions/runs/47231990509) passed on attempt 1. All 71 reported checks are clean on this head; GitHub reports `CLEAN` / `MERGEABLE` and there are no unresolved review threads. ## Risks Low risk. The change is limited to fixtures. A missing status wake or failed enrollment still fails the tests. The expiry case now checks actual late-consent rejection without making success depend on process startup time. No schema, API, or runtime changes are required. The tests and PR explain the behavior; no documentation update is needed. A new verified master image is still required before staging can resume. ## Model Used OpenAI `gpt-6.1-sol` through the Codex harness in T3 Code, with xhigh reasoning effort, shell and file tools. 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> |
||
|
|
c2a8821809 |
fix(agents): keep a prepared agent setup when its configuration changes (#23669)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - A new agent can use a plugin environment that requires an agent. A lifecycle plugin prepares that environment before the agent can work. > - The setup flow creates a draft agent first, so that this preparation can start before the person finishes setup. > - Each change to the draft's harness, model, or sign-in started preparation again. The hire also started it again. > - Verification cannot start until the last preparation is complete. So the early preparation did not decrease the wait after the hire. > - This pull request keeps the preparation when the agent stays on the same environment driver. > - The benefit is that a person who finishes setup waits only for verification. ## Linked Issues or Issue Description I searched the open and closed issues and pull requests. I did not find a duplicate. **What happened?** Create an agent in setup on a plugin environment that declares `requiresAgent: true`. The draft is prepared. Then choose a harness, sign in, and hire the agent. Each of these three steps starts `preparing` again. The agent page shows preparation after the hire, although the environment was ready before the person signed in. **Expected behavior** A change to the harness, model, credentials, or instructions does not change the environment. It must not start preparation again. The hire must go directly to verification. If preparation is in progress, the hire must join it. **Steps to reproduce** 1. Install a lifecycle plugin with an environment driver that declares `requiresAgent: true`. 2. Make that environment the instance default. 3. Create a setup draft and wait until `lifecycleState` is `verifying`. 4. Save a different model on the draft. `lifecycleState` goes back to `preparing`. 5. Hire the draft. `lifecycleState` goes back to `preparing` again. **Paperclip version or commit** `7e025ae65f` **Deployment mode** Self-hosted server with a plugin environment that requires an agent. ## What Changed - A configuration change restarts `preparing` only when the agent moves to an environment that needs setup. The existing environment and driver check makes this decision. - A prepared setup draft stays prepared when its harness, model, credentials, or runtime configuration change. - The hire of a prepared draft goes directly to `verifying` with a new operation. - The hire of a draft that is still `preparing` keeps the operation and its version. Verification starts when that operation is complete. - A hire that moves to an environment that needs setup starts `preparing` again, as before. - A save that changes an environment to another driver of the same plugin now also refuses `preparing` agents, the same as `ready` and `verifying` ones. - A change to instructions alone does not restart verification. The hire writes the managed instruction files immediately after it commits, and verification does not read them. - The hire clears an old lifecycle error on the draft. - These behaviors do not change: - a draft that no longer needs preparation goes to `pausing` - a hire that needs approval, a hire with a hold, and a company hold - an edit to other execution configuration during verification - an edit during `resuming` - `doc/AGENT-LIFECYCLE.md` describes the new rules. ## Verification - `npx vitest run src/modules/agent-lifecycle`: 224 passed. Four new tests cover a prepared draft, a hire from a prepared draft, a hire during preparation, and an instruction change. Three of them failed before the change. The fourth could not run because a test before it left the fixture blocked. - `npx vitest run` on the hire, lifecycle delivery, agent secret, pending approval, secret binding, managed plugin environment, and plugin task tests: all passed. - `npx vitest run` on the two Dot onboarding files: 25 passed. - `pnpm --filter @paperclipai/server typecheck`: passed. - Not done: a live test with a plugin environment. Three existing tests used an agent in `preparing` to test that a configuration change fences verification. They now use `verifying`. ## Risks - A lifecycle plugin that reads the agent's harness or model during `preparing` is not called again when they change. The lifecycle request does not carry them. Verification still tests the final configuration. - A prepared environment can be lost between preparation and hire. Verification then fails and retries, and a pause and resume prepares it again. Before this change, the hire prepared it again. - An edit during `preparing` does not cancel the attempt in progress. A plugin must not fail because the agent's configuration changed during its call. - No migration. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with extended thinking, 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 Opus 5.5 <noreply@anthropic.com> |
||
|
|
8604231091 |
docs(release): stable notes for the 2026.1203.0-beta.0 soak (v2026.1206.0) (#23580)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The release process promotes a soaked beta to stable. The stable GitHub Release body comes from `releases/beta/v<beta-version>.md` on `master` > - Beta `2026.1203.0-beta.0` published in workflow run 47005574134. Its `draft_stable_notes` job pushed a commit-log skeleton to this branch > - The skeleton is a raw commit list. It is not usable as release notes > - This pull request replaces the skeleton with curated stable notes. Each claim traces to a pull request in `v2026.1202.0..89c6e38` > - The benefit is that the stable promotion for this beta (v2026.1206.0) finds finished notes on `master` ## Linked Issues or Issue Description **Issue type** Missing content **Where is the issue?** `releases/beta/v2026.1203.0-beta.0.md` is the stable-notes file for the `2026.1203.0-beta.0` soak. At the branch head before this commit, it holds only the auto-generated commit-log skeleton. **What's wrong?** The stable promotion reads this file from `master` and publishes it as the GitHub Release body. A raw commit list is not suitable as a release body. **Suggested fix** Merge the curated notes. Correct the H1 and the `> Released:` line in a follow-up if the promotion date moves. ## What Changed - Replaced the skeleton in `releases/beta/v2026.1203.0-beta.0.md` with curated stable notes for v2026.1206.0. The layout is the same as the v2026.1202.0 notes: overview, Breaking Changes, Highlights, Improvements, Fixes, Upgrade Guide, Contributors - The notes are delta-framed against the published v2026.1202.0 notes. None of the 107 cited pull requests appears in those notes - The Upgrade Guide lists migrations `0500` through `0513` with one-phrase effects, the new environment variables with defaults, the experimental-setting changes, and the harness pins - Release and CI internals, smoke specs, canary tooling, Paperclip Cloud work, dependency bumps, and test-only changes are left out ## Verification - Beta publish is complete. The npm dist-tag `beta` is `2026.1203.0-beta.0`. The tag `beta/v2026.1203.0-beta.0` points at `89c6e38ad182962d6deb99f58580b822131316f2`. In run 47005574134, `publish_beta`, both `smoke_beta` jobs and `draft_stable_notes` succeeded. The beta Docker build (run 47021510703) succeeded - The GitHub compare API returns 465 commits for `v2026.1202.0...89c6e38ad182962d6deb99f58580b822131316f2`. This number matches the overview and the Contributors section - Contributors are the 24 unique GitHub logins of the commit authors in the range, read from the GitHub API with `[bot]` accounts excluded. External handles are thanked by name - Every `#NNNN` link in the file traces to a commit in the range (107 cited pull requests) - Migration numbers, setting keys, env var names, and defaults were checked in the code at the source commit, not in commit subjects - The file contains no internal ticket ids or instance-local links - The diff changes one file under `releases/` and no source files ## Risks - Low risk: a single markdown file, no source changes. If the promotion date moves past 2026-12-06, the H1 and the `> Released:` line need a one-line update before the stable dispatch - The `draft_stable_notes` job force-pushes this branch name. A rerun of that job replaces this commit with the skeleton. Do not rerun it for this beta ## Model Used - Claude (Anthropic), model ID `claude-opus-5-5` (Claude Opus 5.5), tool use via 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 - [ ] I have run tests locally and they pass (documentation-only change; no tests apply) - [ ] I have added or updated tests where applicable (not 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: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>canary/v2026.1204.0-canary.885200 |
||
|
|
ba521863f6 |
perf(skills): import environment skills when a setup draft is created (#23672)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - A plugin environment driver can declare `skillKeys`. Core adds those managed skills to each run on the environment. > - Before a run can use a skill, Core imports it into the company's skill library. This occurs once for each company. > - The import occurs when the first task starts. So the first task in a new company waits for it. > - Each missing skill is imported in its own transaction. Each import checks all bundled skills two times, and the transactions do not share that check. > - This pull request starts the import when a person creates a setup draft, and checks the bundled skills once. > - The benefit is that the first task starts sooner. The setup does not wait for the import. ## Linked Issues or Issue Description I searched the open and closed issues and pull requests. I did not find a duplicate. **What happened?** The first task on a plugin environment with four managed skills spent more than ten seconds in skill import. Most of this time was the check and first import of Core's bundled skills. That check ran again for each managed skill. **Expected behavior** The import must start before the first task, while the person completes setup. One import must check the bundled skills once. **Steps to reproduce** 1. Install a plugin with an environment driver that declares several `skillKeys`. 2. Make that environment the instance default. 3. Create a company, set up its first agent, and give it a task. 4. Measure the skill selection part of the first run's preparation. **Paperclip version or commit** `7e025ae65f` **Deployment mode** Self-hosted server with a plugin environment that declares managed skills. ## What Changed - When a person creates a setup draft, the server imports the environment's missing skills in the background. The response does not wait for this import. - A failed background import writes a warning. It does not change the draft. Run admission still installs the skills that are missing. - The background import is counted as active work, so an idle drain waits for it. It runs once and does not poll or retry. - An environment skill import checks the bundled skills once before it installs the missing skills. Before, each skill did this check two times in its own transaction. - `importPackageFiles` reads the library rows after its own inventory check. It no longer does the check a second time. - `doc/skills-and-teams-catalog.md` describes the new behavior. Skill selection, version pins, and the files that a run receives do not change. ## Verification - `npx vitest run src/__tests__/environment-skills.test.ts`: 7 passed. Two tests are new. They fail when I remove the single check and the background import. - `npx vitest run` on the company skill service, managed skill content, company portability, agent adapter validation, and agent lifecycle tests: all passed. - `src/__tests__/ai-connections.test.ts`: 5 of its tests failed in the same local run. The reconnect tests also fail at `7e025ae65f` without this change on the same local database. They do not use this code. - `pnpm --filter @paperclipai/server typecheck`: passed. - Not done: a measurement of the first task with this change. ## Risks - A draft that a person abandons leaves the imported skills in the company library. The same skills are imported for the next agent on that environment. - The background import and a first task can run together. The existing lock for each skill makes the second one wait and use the first result. - The bundled skill check now runs outside the skill's transaction. If the skill import then fails, the bundled skills remain imported. They are imported by other library reads too. - No migration. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with extended thinking, 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 Opus 5.5 <noreply@anthropic.com> |
||
|
|
07150650c9 |
test(runner): drain reattachment writers before deleting state (#23673)
## Thinking Path > - Paperclip manages agent work through durable Runner sessions. > - Release images require Cloud readiness for their exact source commit. > - A reattachment test keeps a slow event backlog active during controller recovery. > - Its bounded close can return before queued journal writes finish. > - The fixture then deletes the state directory and can fail with `ENOTEMPTY`. > - This pull request joins the fixture writers before it removes their files. ## Linked Issues or Issue Description **What happened?** [Docker run 47193580475](https://github.com/paperclipai/paperclip/actions/runs/47193580475/attempts/1) was cancelled after [Cloud readiness protocol lane 4/4](https://github.com/paperclipai/paperclip/actions/runs/47193580507/job/144565884014) failed. The event-backlog reattachment test reported `ENOTEMPTY` while removing its control-plane directory. A rerun passed on the same source commit, without fixing the race. **Expected behavior** The fixture must finish all admitted writes and stop its child before it deletes state, including when the transport close deadline expires. **Steps to reproduce** Run `runnerd-codex-transport-reattach-carried-commands.test.ts` with a one-millisecond close budget for the event-backlog case. Before this fix, the new cleanup assertion finds one accounting callback still active. **Paperclip version or commit** Observed on `23ca89e3764377224bc43527bdfa547e9608f1db`. The fix starts from `7e025ae65f9050030edf4d2cab006aa981569261`. **Deployment mode** Source checkout in GitHub Actions. Local reproduction uses macOS arm64, Node 25.6.1, and the real Rust Runner with the hermetic fake Codex fixture. Searched open PRs and issues for `ENOTEMPTY`, carried commands, and Runner teardown. No duplicate fix was found. Related earlier work: #21161 and #21442. ## What Changed - Retain all registered fixture authorities, including the detached controller. - Disable new upgrades, confirm the original child exited, stop authorities, and drain admitted connection processing before deleting state. - Exercise an expired close budget in the existing backlog case. Assert that accounting writes have finished before deletion. - The fixture owns this cleanup. Runtime close behavior and its deadlines do not change. ## Verification - Red: the focused backlog test fails with `state cleanup must wait for admitted event writes: expected 1 to be +0` before the teardown fix. - Green: `pnpm exec vitest run src/live/runnerd-codex-transport-reattach-carried-commands.test.ts` from the Runner package: 11 passed, retries disabled. - `pnpm exec tsc -p tsconfig.test.json --noEmit` from the Runner package: passed. - `git diff --check` and local secret/PII diff review: passed. - `pnpm verify --explain`: exit 2. The conservative selector cannot resolve this Runner test graph. Focused local checks passed; required PR CI supplies the broader coverage. - Tested file contents match PR head `0a6b92e026ae0fdd684cd0e8e2ff7cf513732a02`. - Final review: all 90 checks are clean, GitHub reports `CLEAN` / `MERGEABLE`, and there are no unresolved review threads. The branch includes current `master`. - An initial local attempt could not run because debug binaries were not built yet. Agent preflight completed before the red-green run. - [Linux Runner Vitest lanes 1–6](https://github.com/paperclipai/paperclip/actions/runs/47222552156): passed on PR head. Typecheck, build, Runner static checks, and support suites also passed. - [Greptile review](https://github.com/paperclipai/paperclip/pull/23673#issuecomment-7394943956): 5/5 on PR head, no actionable findings or review threads. The current-head check passed. - [Server shard 14/20](https://github.com/paperclipai/paperclip/actions/runs/47222552156/job/144668670033) was cancelled after its runner received a shutdown signal. This is recorded runner loss, not an assertion failure. The repository started attempt 2 automatically on the same PR head. The retry passed and the full [PR CI workflow](https://github.com/paperclipai/paperclip/actions/runs/47222552156/attempts/2) completed successfully. Both Runner image builds, the macOS runtime build, and all security scans also passed. ## Risks Low risk. Only one test fixture changes. Teardown now waits for its admitted writes instead of deleting their directory early. A stuck write can fail the existing test timeout and preserve the state directory. No schema, API, deployment, or runtime behavior changes. The code and regression test describe the behavior; no documentation update is needed. ## Model Used OpenAI `gpt-6.1-sol` through the Codex harness in T3 Code, with xhigh reasoning effort, shell and file tools. 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> |
||
|
|
7e025ae65f |
fix(workspaces): start a new remote workspace when the task's saved one is retired (#23655)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Before a run starts, Paperclip prepares the task's execution
workspace. With remote workspace storage, it reserves the task's saved
remote workspace.
> - A task stays bound to its workspace after that workspace is archived
or its cleanup fails.
> - For a retired host workspace, the next run already creates a new
workspace. For a retired remote workspace, preparation sent the retired
workspace to the reservation. The reservation refused it with "Workspace
ownership changed." (`remote_workspace_retired`, since #23582).
> - So the task could never run again. Each wake, recovery, or Retry
failed in setup with the same conflict.
> - This pull request makes a retired remote workspace act like a
retired host workspace: the run starts a new remote workspace.
> - The benefit is that a reopened task with an archived remote
workspace runs again, and the retired workspace and its saved snapshot
stay unchanged.
## Linked Issues or Issue Description
**What happened**
A task's own remote workspace was archived by hand (no terminal-cleanup
reason) and later moved to remote storage. When the task was opened
again, every run failed in setup with "Workspace ownership changed." The
task was then escalated for recovery, and the next wake failed in the
same way.
**Expected behavior**
A retired workspace is not reused. The run starts a new workspace for
the task, as it does for a host workspace. A native recovery or a saved
Retry that is bound to the retired workspace still stops with the
conflict.
**Steps to reproduce**
1. Bind a task to its own remote-storage workspace. Set the workspace
status to `archived` or `cleanup_failed`.
2. Start a run for the task with a Paperclip Runner agent in a sandbox
environment.
3. Setup fails with a 409 conflict, "Workspace ownership changed."
(`remote_workspace_retired`).
**Paperclip version or commit**
master at
canary/v2026.1203.0-canary.884900
|
||
|
|
1fb8ddb740 |
feat(trust): allow transient workspace_prepare checkout for low-trust in-boundary projects (#23656)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The low-trust review preset isolates untrusted review agents inside sandboxes with no runtime GitHub tokens and no sandbox network access > - When a low-trust agent is explicitly assigned to a private-repository project with `git.read` enabled, workspace preparation routed the setup-time clone through `resolveGitHubOperationCredentials`, which blocks all low-trust credential export and caused `stage=clone git=auth_failed exit=128` before the agent could start > - Setup-time `prepareRemoteWorkspaceDirectory` runs on the trusted controller path before the agent starts, uses transient `GIT_CONFIG_*` / `PAPERCLIP_GIT_TOKEN` environment variables with `-c core.hooksPath=/dev/null`, and writes zero credentials into `.git/config` > - This pull request adds `resolveGitHubWorkspacePrepareCredentials` for controller-only `workspace_prepare` call sites, allowing transient clone credentials strictly for a repository configured on a project inside `trustBoundary.projectIds` when `git.read` is permitted (preferring an agent-installed GitHub PAT connection when present), while keeping runtime shell credentials (`resolveGitHubOperationCredentials`) strictly denied > - The benefit is that assigning a low-trust agent to a private-repo project works out of the box for local read-only code review without exposing any live GitHub token to the agent runtime ## Linked Issues or Issue Description **What happened?** When an agent configured with `trustPreset: "low_trust_review"` and `allowedToolClasses: ["git.read"]` was assigned a task in a project with a private GitHub repository workspace, workspace preparation failed before the agent started with `remote_workspace_prepare_failed: stage=clone git=auth_failed exit=128 program=git`. **Expected behavior** When a `low_trust_review` run has `git.read` enabled and targets a project explicitly listed in `trustBoundary.projectIds`, the trusted controller should clone that project's configured repository during `workspace_prepare` using transient credentials (preferring an agent-installed GitHub PAT connection if configured, otherwise the run's managed GitHub identity), while leaving zero credentials in `.git/config` and keeping runtime GitHub credential export strictly denied. **Steps to reproduce** 1. Create a project with a private GitHub repository workspace. 2. Configure an agent with `trustPreset: "low_trust_review"`, `projectIds: [projectId]`, and `allowedToolClasses: ["git.read"]`. 3. Run a task in that project on a cloud sandbox environment. 4. Before this fix, `createGitRemoteAuthProvider` falls back to anonymous clone and fails at `stage=clone git=auth_failed exit=128`. **Paperclip version or commit** `master` (`23ca89e376`) ## What Changed - **`server/src/services/github-operation-credentials.ts`**: Added `resolveGitHubWorkspacePrepareCredentials`, `allowsLowTrustWorkspacePrepareCheckout`, and `resolveAgentInstalledGitHubPat`. For `low_trust_review` runs, transient prepare-time clone auth is permitted only when `trust.kind === "low_trust_review"`, `git.read` is in `allowedToolClasses`, the task's project is explicitly in `trustBoundary.projectIds`, and `remoteUrl` matches a configured `project_workspaces.repo_url` on that project. Prefers an active agent-installed GitHub `api_key` (PAT) connection when present and otherwise falls back to `resolveManagedGitHubCredential`. Runtime `resolveGitHubOperationCredentials` remains unchanged and strictly denied for low-trust runs. - **`server/src/services/git-credentials.ts`**: Added optional `purpose?: "workspace_prepare"` to `createGitRemoteAuthProvider` so only controller workspace-preparation call sites invoke `resolveGitHubWorkspacePrepareCredentials`. - **`server/src/services/heartbeat/workspace-preparation.ts`** and **`server/src/services/heartbeat/workspaces.ts`**: Passed `purpose: "workspace_prepare"` at the four controller workspace-preparation call sites. - **`server/src/__tests__/github-operation-credentials.test.ts`**: Added unit, security-boundary, and end-to-end `prepareRemoteWorkspaceDirectory` tests covering managed identity prepare checkout, agent-installed GitHub PAT preference, runtime credential denial, unrelated repo denial, missing `git.read` denial, and zero credentials persisted in `.git/config`. ## Verification - `pnpm --filter @paperclipai/server typecheck` — passed with 0 errors. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/github-operation-credentials.test.ts` — 30/30 passed (including the 3 new low-trust `workspace_prepare` and local E2E `prepareRemoteWorkspaceDirectory` tests). ## Risks - Low risk. Runtime agent credential endpoints (`/runtime-tools/github/credentials`, native GitHub broker, skill-source fetch) continue calling `resolveGitHubOperationCredentials` and stay strictly denied for `low_trust_review`. - Prepare-time credentials are scoped strictly to repositories already configured in `project_workspaces` for a project explicitly inside `trustBoundary.projectIds` and only when `git.read` is enabled. ## Model Used - Google Gemini (Antigravity agentic coding assistant) with tool use and local code/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 mergecanary/v2026.1203.0-canary.884800 |
||
|
|
23ca89e376 |
Link agent names in the chat sidebar to their overviews (#23650)
## Thinking Path > - Paperclip lets people manage agents. > - The chat sidebar lists agents with conversations. > - Each row opens a conversation. > - The agent name gives readers a natural place to open the agent overview. > - Separate links let users choose either destination with a mouse or keyboard. ## Linked Issues or Issue Description **Subsystem affected** Chat sidebar navigation. **Current behavior** Selecting an agent name opens the conversation. **Proposed behavior** Selecting the name opens that agent's overview. Selecting the avatar or role opens the chat. ## What Changed Added a company-scoped overview link on the name and kept a separate chat link across the row. ## Verification The sidebar compiled with esbuild. The diff whitespace check passed. To verify in the app, click the name, return to the list, then click the role. Check both links with Tab and Enter. ## Risks Users who previously clicked the name to open chat will now reach the overview. ## Model Used OpenAI Codex, GPT-6, with shell tools. ## Checklist - [ ] I have included a thinking path that traces from project context to this change - [ ] I have specified the model used (with version and capability details) - [ ] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [ ] I have searched GitHub for duplicate or related PRs and linked them above - [ ] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [ ] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [ ] 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 - [ ] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes - [ ] 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 mergecanary/v2026.1203.0-canary.884701 |
||
|
|
0208bbfbf7 |
fix(runner): compact Antigravity MCP tool descriptions and nullable/pattern schemas (#23645)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Paperclip Runner exposes Paperclip semantic tools and lifecycle tools (`paperclip_finish`, `paperclip_block`) to the Antigravity CLI (`agy` 1.5.19) over a loopback MCP bridge. > - Follow-up to #23620: real-binary reproduction with `agy` 1.5.19 against a full server catalog (85-91 tools including `runner-bridge-tools`) shows that `agy` budgets full `functionDeclarations` (name + description + inputSchema) at roughly 90 KB serialized (~60 KB raw MCP JSON). > - With only `inputSchema` metadata stripped, uncompacted multi-sentence tool `description` fields still consume ~26 KB and `pattern`/`format`/nullable unions add ~7 KB, pushing 91 tools to 65.5 KB raw and causing `agy` to drop `handoff_case` and `paperclip_finish` (and `set_task_monitor` / `call_api` when additional tools are present). > - This pull request compacts top-level tool descriptions (first sentence / 120 chars), strips `format` and `pattern`, and collapses nullable `anyOf`/`oneOf`/`type` unions in `tools/list` when `compactToolSchemas` is enabled for Antigravity, while keeping full original Ajv validation on `tools/call`. > - The benefit is that all 110/110 tools (including `paperclip_finish`, `paperclip_block`, `set_task_monitor`, `call_api`, and `handoff_case`) fit comfortably within `agy` 1.5.19's declaration budget. ## Linked Issues or Issue Description - Refs #23620 ## What Changed - `packages/paperclip-runner/src/drivers/re2-schema-patterns.ts`: - Added `compactToolDescription(description, maxLength = 120)` to trim top-level MCP tool descriptions to their first sentence (or <= 120 chars). - Extended `compactToolInputSchema` to drop `format` and `pattern` keywords and collapse nullable `anyOf`/`oneOf` (`[T, { type: "null" }]` -> `T`) and `type: [T, "null"]` -> `T`, while preserving property names, literal `enum`/`const` values, types, and `required` lists. - `packages/paperclip-runner/src/drivers/runner-tool-bridge.ts`: - Applied `compactToolDescription` alongside `compactToolInputSchema` to all `tools/list` entries (including `paperclip_finish` and `paperclip_block`) when `compactToolSchemas: true`. - Original full Ajv validators remain untouched for `tools/call`. - `packages/paperclip-runner/src/drivers/re2-schema-patterns.test.ts`: - Tightened the catalog budget regression test (`totalSchemaBytes < 25_000`, `totalDeclarationBytes < 35_000`, every description <= 120 chars, `paperclip_finish` / `paperclip_block` < 3,000 bytes). - Added regression assertions that `tools/call` still enforces stripped `pattern` rules (`read_document` rejecting `"notes.md"`), `re2PortableSchema` rewrites patterns inside properties named `enum`/`const`, and `compactToolDescription` / nullable union collapsing work as expected. ## Verification - `pnpm --dir packages/paperclip-runner exec vitest run src/drivers/re2-schema-patterns.test.ts src/drivers/runner-tool-bridge.test.ts src/drivers/acpx/antigravity-acp-runtime.test.ts` — 59/59 tests pass. - `pnpm --dir packages/paperclip-runner exec tsc -p tsconfig.json --noEmit` — passes. - `pnpm --dir packages/paperclip-runner exec tsc -p tsconfig.test.json --noEmit` — passes. - Real pinned `agy` 1.5.19 binary probe against a local mock Gemini API with 110 tools (full 64 semantic action catalog + server `runnerBridgeDefinitions` + 31 realistic extra tools + `paperclip_finish` + `paperclip_block`): **110/110 tools kept** (`keptDeclBytes: 85,286`; `paperclip_finish`, `paperclip_block`, `set_task_monitor`, `call_api`, and `handoff_case` all present). ## Risks - Low risk. Compaction applies only to `tools/list` when `compactToolSchemas: true` (Antigravity sessions only). All `tools/call` requests continue to validate against the original full Ajv schema and return plain-English schema rule diagnostics on rejection. ## Model Used - Google Gemini (Antigravity agent with tool use, shell execution, and real `agy` 1.5.19 binary 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 - [ ] 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 mergecanary/v2026.1203.0-canary.884600 |
||
|
|
230fc431ba |
fix(runner): queue a startup that timed out again instead of blocking its task (#23636)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - A run in a sandbox must start its Runner before a deadline > - A startup that passes the deadline is cancelled, and its sandbox task is stopped > - The cancelled run then has no successor, so the server blocks the task > - The answers and messages that wait behind the run stay held until a person acts > - The agent did no work, so nothing needs a person > - This pull request queues the same wake again when the evidence shows that no work started > - The benefit is that a slow startup delays a task but does not block it ## Linked Issues or Issue Description No issue exists. **What happened?** A user answered an agent's question. The new run passed its startup deadline. The server stopped the sandbox task and confirmed the stop. The server then set the task to blocked, and the answer was not delivered. **Expected behavior** The server starts the run again with the same answer. It continues the saved session if that is safe. **Steps to reproduce** 1. Use an agent whose environment provider runs Runner tasks. 2. Start a run on a task. 3. Make the startup pass its deadline before the Runner connects. 4. Wait for the server to confirm the stop. 5. See that the task is blocked and that a new message stays held. **Paperclip version or commit** `dc16c47362` **Deployment mode** Self-hosted server with a sandbox environment plugin. ## What Changed - The server queues the same wake again after it confirms the stop of a startup that timed out. The new run keeps the wake reason, the comments and the answer. - The server does this only with all of this evidence: - The startup deadline is the only cause of the cancellation. - The provider confirmed that the task stopped. - No process request, session, turn, Runner checkpoint or result exists. - No workspace recovery or file copy is open. - The new run uses the existing retry limits for an interrupted preparation. - The server queues the new run before it acknowledges the cleanup. The new run cannot start until the cleanup is acknowledged. Held messages stay in order behind it. - The new run continues the saved session when the stopped task still holds the session state of an earlier run. Otherwise, it starts a new session. - If the server stops between these steps, the next cleanup pass completes them. It queues one run only. - If any evidence is missing, or the server cannot queue the run, the task is blocked as before. - A Stop by a person, a pause, a budget or a reassignment does not change. ## Verification - `npx vitest run src/services/native-runtime/native-startup-requeue.test.ts`: 46 passed. These tests use embedded Postgres. They test the full cancellation, the two server-stop points, 24 refusals, the session state transfer, and which run the next run resumes. - `npx vitest run` on the 14 test files that use the changed modules: 2146 passed, 7 skipped, 1 failed. The failed test is `archives a damaged prior epoch before completing guarded same-task replacement with real runnerd`. It also fails at `dc16c47362` on the same computer, without this change. - `npx vitest run` on the retry scheduling and early Stop tests: 79 passed. - `npx tsc --noEmit` in `server` has no errors. - Not done: a live test of this change. CI runs the Runner integration suites. ## Risks - A wrong decision could run work twice. The server refuses when any saved record shows provider work, and the resume path checks the same records again. - A startup that always times out now retries. The existing limit and backoff apply. After the last retry, the task is blocked as before. - The new run uses another sandbox start. Budget checks and retry counts apply to it as to other retries. - A task that is already blocked by this problem does not change. A person must retry it or send a message. - No migration. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with extended thinking, 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 Opus 5.5 <noreply@anthropic.com>canary/v2026.1203.0-canary.884500 |
||
|
|
bba20403ba |
fix(cloud-trial): do not attach Connect OpenRouter repair card on starter-trial auth failures (#23633)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - When a normal agent fails with a provider authentication error, `connectionIntentService.requestForRunAuthFailure` infers the AI provider from the agent's model and attaches a pending `"Connect <Provider>"` interaction card on the issue thread. > - Cloud starter-inference agents (`runtimeConfig.cloudTrialInference: true`, no saved `aiConnection`) run OpenCode with `openrouter/openai/gpt-6-luna` through Paperclip Cloud's server-side proxy instead of a user-saved OpenRouter connection. > - If a starter-inference run ever encounters an OpenRouter 401 failure, `requestForRunAuthFailure` attached a pending `"Connect OpenRouter"` card, causing the agent to keep nagging the user to respond to that card on subsequent turns even after succeeding. > - This pull request skips `requestForRunAuthFailure` for agents using Cloud starter inference without a saved `aiConnection`, leaving `CloudTrialGate` as the single owner of prompting users to connect a model provider. > - The benefit is that starter-inference chats never accumulate stale `"Connect OpenRouter"` cards. ## Linked Issues or Issue Description Refs #23401, #23616 **Summary** Skip creating a `"Connect OpenRouter"` `connection_intent` card in `requestForRunAuthFailure` when the agent runs on Cloud starter inference (`runtimeConfig.cloudTrialInference: true` without a saved `aiConnection`). **Steps to Reproduce** 1. Run an OpenCode agent configured with `runtimeConfig.cloudTrialInference: true` and `adapterConfig.model: "openrouter/openai/gpt-6-luna"` (no `runtimeConfig.aiConnection`). 2. Trigger an OpenRouter HTTP 401 authentication failure on a run. 3. Observe `requestForRunAuthFailure` creating a pending `"Connect OpenRouter"` `issue_thread_interactions` row on the chat issue. **Expected Behavior** `requestForRunAuthFailure` returns `null` and creates no pending `"Connect OpenRouter"` interaction for Cloud starter-inference agents. ## What Changed - `server/src/services/connection-intents.ts`: Returned `null` in `requestForRunAuthFailure` when `!saved && !router && isAgentUsingCloudTrialInference(agent.runtimeConfig)`. - `server/src/__tests__/connection-intents-service.test.ts`: Added a regression test proving that an OpenRouter 401 failure on a Cloud starter-trial agent returns `null` and creates zero `issue_thread_interactions` rows. ## Verification - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/connection-intents-service.test.ts -t "does not create a Connect OpenRouter card|adopts a Copilot account"` — passed (2/2 tests). - `pnpm --filter @paperclipai/server typecheck` — passed (0 errors). ## Risks - Low risk. Narrow 1-line guard scoped strictly to agents with `runtimeConfig.cloudTrialInference === true` and no saved `aiConnection`. Normal agents with or without saved AI connections keep their exact existing auth-repair behavior. ## Model Used - Google Gemini (Antigravity agentic runtime, thinking mode with tool use and local 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 - [ ] I will address all Greptile and reviewer comments before requesting mergecanary/v2026.1203.0-canary.884400 |
||
|
|
63d3354be7 |
fix(runner): keep the session of a stopped run (#23543)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The conversation an agent has on a task is called a session. Each task saves a pointer to its session (the session link), and the next run uses it to continue the conversation > - A run's own record keeps its session id. The task gets its pointer to that session only when the run's result is accepted > - A stopped run has no accepted result, so it saves no pointer. If a task's first run is stopped, the task has no pointer. The next run starts a new session and the agent has forgotten the first run > - A later run can also start a new session, for example after an assignment, a retry or a configuration change. If that run is stopped, the pointer still names the older session. The next message goes back to the older session or starts another one > - Saving the pointer on every stop would be unsafe. The agent's turn might still be open, a request might still be waiting, or the provider might not have kept the session > - This pull request copies the session id from a stopped run to the task only when the records show that the stop was acknowledged, the turn started and then ended with nothing waiting, the provider kept the session, and no newer run has taken over the task. Otherwise, the pointer does not change > - The benefit is that someone can stop a run, send a correction, and continue the same conversation ## Linked Issues or Issue Description No issue exists. **What happened?** A user stopped the first run of a task. The user then sent a message. The agent started a new session and did not remember the first run. The same loss happens when a user stops a later run that started a new session. **Expected behavior** The agent continues the session of the stopped run. **Steps to reproduce** 1. Use an agent whose environment provider runs Runner tasks and keeps their session state. 2. Create a task and wait for the first run to start a turn. 3. Stop the run during the turn. 4. Send a message on the task. 5. See that the new run has a new session. **Paperclip version or commit** `4db307d53c` **Deployment mode** Self-hosted server with a sandbox environment plugin. ## What Changed - A stopped run now links its session after its environment lease is released. - The link needs all of this evidence: - The Stop was delivered and acknowledged. - The provider accepted a turn. The next prompt leaves out messages that the linked run received, so a run whose turn did not start cannot be linked. - The turn ended. No request, background work or goal is waiting. - The controller journal is settled. - The provider reports that the task stopped and that it kept the session state. - No newer run, reset or conversation owns the task. - An existing link is replaced only if its run belongs to the same task and agent and finished before the stopped run started. Accepted results already use this rule. Both paths now share one function. - If any evidence is missing, the link does not change, as before. - If the provider later confirms that the kept state is gone, the next run starts a new session. The acknowledged Stop replaces the committed result in that proof. All other checks in that proof still apply. ## Verification - `npx vitest run` on the publication tests for stopped runs, the publication tests for accepted results, the runtime execution tests and the terminal state reader test: 121 passed. The executor tests ran on an earlier commit, and the executor code has not changed since. - The publication tests use embedded Postgres. They test six saves and 37 refusals. Each refusal checks that the task session row did not change. - The executor tests check that a stopped run retires after a confirmed state loss. They also check that an unacknowledged Stop and a different failure stay refused. - `npx tsc --noEmit` in `server` has no errors. - Saved evidence from two real first-run stops during a turn shows ended turns with no request waiting. The first has a released lease with kept session state. The second failed its lease cleanup, so this change still refuses it. - Saved evidence from two real later-run stops: one kept its session, and the next run resumed it. The other kept no session and had no settled turn, and the next run failed. This change refuses to link the second. - Two of 104 real stops with a cancelled terminal had no accepted turn. The turn check refuses them. - Not done: a live test of this change. CI runs the Runner integration suites. ## Risks - A wrong link could resume an unsafe session. The link uses the same evidence that the resume path checks again, so the resume path still refuses an unsettled session. - A link that turns out to be unusable now replaces an older link instead of no link. The next run then usually fails, and the run after it usually starts a new session, as it does for an unusable link from a finished run. - The change applies only to providers that run Runner tasks and report kept session state. Local Runners and other sandboxes have no equal evidence, so they keep the previous behavior. - A stop while the agent waits for background work is not covered. The Runner holds its terminal event in that state, so the evidence is missing. - The saved link keeps that run's Runner checkpoint, as any other link does. - No migration. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with extended thinking, 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 Opus 5.5 <noreply@anthropic.com> |