## Thinking Path > - Paperclip orchestrates AI-agent companies and needs secrets handling to work across local development, hosted operators, and governed agent execution. > - The affected subsystem is the company-scoped secrets control plane: database schema, server services/routes, CLI workflows, and the Secrets settings UI. > - The gap was that secrets were local-only and operators could not manage provider vaults or import existing remote references without exposing plaintext. > - This branch adds provider vault configuration plus an AWS Secrets Manager remote-import path while preserving company boundaries, binding context, and audit trails. > - I kept the PR to a single branch PR, removed unrelated lockfile/package drift, rebased the full branch onto the current `public-gh/master`, and addressed fresh Greptile findings. > - The benefit is a reviewable implementation of provider-backed secrets with focused tests covering provider selection, import conflicts, deleted secret reuse, rotation guards, and AWS signing behavior. ## What Changed - Added provider vault support for company secrets, including provider config storage, default vault handling, health checks, binding usage, access events, and remote import preview/commit. - Added an AWS Secrets Manager provider using SigV4 request signing, bounded request timeouts, namespace guardrails, cached runtime credential resolution, and external-reference linking without plaintext reads. - Added Secrets UI surfaces for vault management and remote import, plus CLI/API documentation for setup and operations. - Stabilized routine webhook secret binding paths and SSH environment-driver fixture bindings discovered during verification. - Addressed Greptile and CI findings: no lockfile/package drift, monotonic migration metadata, disabled-vault default races, soft-deleted secret hiding/recreate behavior, remove behavior with disabled vaults, soft-deleted external-reference re-import, non-active rotation guards, managed-secret soft deletion through PATCH, and per-call AWS SDK credential client churn. - Rebased this branch onto `public-gh/master` at `0e1a5828` and force-pushed with lease to keep this as the single PR for the branch. ## Verification - `git fetch public-gh master` - `git rebase public-gh/master` - `git diff --name-only public-gh/master...HEAD | grep '^pnpm-lock\.yaml$' || true` confirmed `pnpm-lock.yaml` is not in the PR diff. - Confirmed migration ordering: master ends at `0081_optimal_dormammu`; this PR adds `0082_dry_vision` and `0083_company_secret_provider_configs`. - Inspected migrations for repeat safety: new tables/indexes use `IF NOT EXISTS`; foreign keys are guarded by `DO $$ ... IF NOT EXISTS`; column additions use `ADD COLUMN IF NOT EXISTS`. - `pnpm -r typecheck` passed before the Greptile follow-up commits. - `pnpm test:run` ran the full stable Vitest path before the Greptile follow-up commits; it completed with 3 timing-related failures under parallel load: `codex-local-execute.test.ts`, `cursor-local-execute.test.ts`, and `environment-service.test.ts`. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/codex-local-execute.test.ts src/__tests__/cursor-local-execute.test.ts src/__tests__/environment-service.test.ts` passed on targeted rerun (`24/24`). - `pnpm build` passed before the Greptile follow-up commits. Vite reported existing chunk-size/dynamic-import warnings. - After Greptile follow-up commits: `pnpm --filter @paperclipai/server exec vitest run src/__tests__/secrets-service.test.ts` passed (`26/26`). - After Greptile follow-up commits: `pnpm --filter @paperclipai/server exec vitest run src/__tests__/aws-secrets-manager-provider.test.ts src/__tests__/secrets-service.test.ts` passed (`39/39`). - After Greptile follow-up commits: `pnpm --filter @paperclipai/server typecheck` passed. - Captured Storybook screenshots from `ui/storybook-static` for visual review. - Latest PR checks on `5ca3a5cf`: `policy`, serialized server suites 1/4-4/4, `Canary Dry Run`, `e2e`, `security/snyk`, and `Greptile Review` pass; aggregate `verify` is still registering the completed child checks. - Greptile review loop continued through the latest requested pass; all Greptile review threads are resolved and the latest `Greptile Review` check on `5ca3a5cf` passed with 0 comments added. ## Screenshots Before: the provider-vault and remote-import surfaces did not exist on `master`; these are after-state screenshots from the Storybook fixtures.    ## Risks - Migration risk: this adds new secret provider tables and extends existing secret rows. The migrations were checked for monotonic ordering and idempotent guards, but reviewers should still inspect upgrade behavior carefully. - Provider risk: AWS support uses direct SigV4 requests. Automated tests cover signing, request timeouts, vault-config selection, namespace guardrails, pending-version archival, sanitized provider errors, and service-level cleanup paths. A real-vault AWS smoke test remains deployment validation for an operator with AWS credentials rather than an unverified merge blocker in this local branch. - UI risk: the Secrets page and import dialog are large new surfaces; screenshots are included above for reviewer inspection. - Verification risk: the full local stable test command hit parallel-load timing failures, although the exact failed files passed when rerun directly. - Operational risk: remote import intentionally avoids plaintext reads; operators must understand that imported external references resolve at runtime and may fail if AWS permissions change. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI Codex, GPT-5 coding agent with local shell/tool use in the Paperclip worktree. Exact context-window size was 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 - [ ] 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: Paperclip <noreply@paperclip.ing> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| fixtures | ||
| helpers | ||
| README.md | ||
| access-service.test.ts | ||
| access-validators.test.ts | ||
| acpx-local-adapter-environment.test.ts | ||
| acpx-local-execute.test.ts | ||
| acpx-local-skill-sync.test.ts | ||
| activity-routes.test.ts | ||
| activity-service.test.ts | ||
| adapter-model-refresh-routes.test.ts | ||
| adapter-models.test.ts | ||
| adapter-registry.test.ts | ||
| adapter-routes-authz.test.ts | ||
| adapter-routes.test.ts | ||
| adapter-session-codecs.test.ts | ||
| agent-adapter-validation-routes.test.ts | ||
| agent-auth-jwt.test.ts | ||
| agent-cross-tenant-authz-routes.test.ts | ||
| agent-instructions-routes.test.ts | ||
| agent-instructions-service.test.ts | ||
| agent-live-run-routes.test.ts | ||
| agent-permissions-routes.test.ts | ||
| agent-shortname-collision.test.ts | ||
| agent-skill-contract.test.ts | ||
| agent-skills-routes.test.ts | ||
| agent-test-environment-routes.test.ts | ||
| app-hmr-port.test.ts | ||
| app-private-hostname-gate.test.ts | ||
| app-vite-dev-routing.test.ts | ||
| approval-routes-idempotency.test.ts | ||
| approvals-service.test.ts | ||
| assets.test.ts | ||
| attachment-types.test.ts | ||
| auth-routes.test.ts | ||
| auth-session-route.test.ts | ||
| authz-company-access.test.ts | ||
| aws-secrets-manager-provider.test.ts | ||
| better-auth.test.ts | ||
| board-mutation-guard.test.ts | ||
| budgets-service.test.ts | ||
| claude-local-adapter-environment.test.ts | ||
| claude-local-adapter.test.ts | ||
| claude-local-execute.test.ts | ||
| claude-local-skill-sync.test.ts | ||
| cleanup-removal-service.test.ts | ||
| cli-auth-routes.test.ts | ||
| codex-local-adapter-environment.test.ts | ||
| codex-local-adapter.test.ts | ||
| codex-local-execute.test.ts | ||
| codex-local-skill-injection.test.ts | ||
| codex-local-skill-sync.test.ts | ||
| companies-route-path-guard.test.ts | ||
| company-branding-route.test.ts | ||
| company-portability-routes.test.ts | ||
| company-portability.test.ts | ||
| company-search-rate-limit-routes.test.ts | ||
| company-search-service.test.ts | ||
| company-skills-detail.test.ts | ||
| company-skills-routes.test.ts | ||
| company-skills-service.test.ts | ||
| company-skills.test.ts | ||
| company-user-directory-route.test.ts | ||
| costs-service.test.ts | ||
| cursor-local-adapter-environment.test.ts | ||
| cursor-local-adapter.test.ts | ||
| cursor-local-execute.test.ts | ||
| cursor-local-skill-injection.test.ts | ||
| cursor-local-skill-sync.test.ts | ||
| dashboard-service.test.ts | ||
| dev-runner-output.test.ts | ||
| dev-runner-paths.test.ts | ||
| dev-runner-worktree.test.ts | ||
| dev-server-status.test.ts | ||
| dev-watch-ignore.test.ts | ||
| documents-service.test.ts | ||
| documents.test.ts | ||
| environment-config.test.ts | ||
| environment-execution-target.test.ts | ||
| environment-live-ssh.test.ts | ||
| environment-probe.test.ts | ||
| environment-routes.test.ts | ||
| environment-run-orchestrator.test.ts | ||
| environment-runtime-driver-contract.test.ts | ||
| environment-runtime.test.ts | ||
| environment-selection-route-guards.test.ts | ||
| environment-service.test.ts | ||
| environment-test-harness.test.ts | ||
| error-handler.test.ts | ||
| execution-workspace-policy.test.ts | ||
| execution-workspaces-routes.test.ts | ||
| execution-workspaces-service.test.ts | ||
| express5-auth-wildcard.test.ts | ||
| feedback-service.test.ts | ||
| feedback-share-client.test.ts | ||
| forbidden-tokens.test.ts | ||
| gemini-local-adapter-environment.test.ts | ||
| gemini-local-adapter.test.ts | ||
| gemini-local-execute.test.ts | ||
| gemini-local-skill-sync.test.ts | ||
| health-dev-server-token.test.ts | ||
| health.test.ts | ||
| heartbeat-active-run-output-watchdog.test.ts | ||
| heartbeat-comment-wake-batching.test.ts | ||
| heartbeat-context-summary.test.ts | ||
| heartbeat-dependency-scheduling.test.ts | ||
| heartbeat-issue-liveness-escalation.test.ts | ||
| heartbeat-list.test.ts | ||
| heartbeat-local-environment.test.ts | ||
| heartbeat-model-profile.test.ts | ||
| heartbeat-plugin-environment.test.ts | ||
| heartbeat-process-recovery.test.ts | ||
| heartbeat-project-env.test.ts | ||
| heartbeat-retry-scheduling.test.ts | ||
| heartbeat-run-log.test.ts | ||
| heartbeat-run-summary.test.ts | ||
| heartbeat-runtime-state.test.ts | ||
| heartbeat-stale-queue-invalidation.test.ts | ||
| heartbeat-start-lock.test.ts | ||
| heartbeat-workspace-session.test.ts | ||
| hire-hook.test.ts | ||
| http-log-policy.test.ts | ||
| inbox-dismissals.test.ts | ||
| instance-database-backups-routes.test.ts | ||
| instance-settings-routes.test.ts | ||
| invite-accept-existing-member.test.ts | ||
| invite-accept-gateway-defaults.test.ts | ||
| invite-accept-replay.test.ts | ||
| invite-create-route.test.ts | ||
| invite-expiry.test.ts | ||
| invite-join-grants.test.ts | ||
| invite-join-manager.test.ts | ||
| invite-list-route.test.ts | ||
| invite-logo-route.test.ts | ||
| invite-onboarding-text.test.ts | ||
| invite-summary-route.test.ts | ||
| invite-test-resolution-route.test.ts | ||
| issue-activity-events-routes.test.ts | ||
| issue-agent-mutation-ownership-routes.test.ts | ||
| issue-assigned-backlog-contract-routes.test.ts | ||
| issue-attachment-routes.test.ts | ||
| issue-blocker-attention.test.ts | ||
| issue-closed-workspace-routes.test.ts | ||
| issue-comment-cancel-routes.test.ts | ||
| issue-comment-reopen-routes.test.ts | ||
| issue-continuation-summary.test.ts | ||
| issue-dependency-wakeups-routes.test.ts | ||
| issue-document-restore-routes.test.ts | ||
| issue-execution-policy-routes.test.ts | ||
| issue-execution-policy.test.ts | ||
| issue-feedback-routes.test.ts | ||
| issue-goal-fallback.test.ts | ||
| issue-identifier-routes.test.ts | ||
| issue-liveness.test.ts | ||
| issue-monitor-scheduler.test.ts | ||
| issue-references-service.test.ts | ||
| issue-scheduled-retry-routes.test.ts | ||
| issue-stale-execution-lock-routes.test.ts | ||
| issue-telemetry-routes.test.ts | ||
| issue-thread-interaction-routes.test.ts | ||
| issue-thread-interactions-service.test.ts | ||
| issue-tree-control-routes.test.ts | ||
| issue-tree-control-service-unit.test.ts | ||
| issue-tree-control-service.test.ts | ||
| issue-update-comment-wakeup-routes.test.ts | ||
| issue-workspace-command-authz.test.ts | ||
| issues-checkout-wakeup.test.ts | ||
| issues-goal-context-routes.test.ts | ||
| issues-service.test.ts | ||
| issues-user-context.test.ts | ||
| join-request-dedupe.test.ts | ||
| json-schema-secret-refs.test.ts | ||
| llms-routes.test.ts | ||
| log-redaction.test.ts | ||
| logger-tz.test.ts | ||
| monthly-spend-service.test.ts | ||
| normalize-agent-mention-token.test.ts | ||
| openclaw-gateway-adapter.test.ts | ||
| openclaw-invite-prompt-route.test.ts | ||
| opencode-local-adapter-environment.test.ts | ||
| opencode-local-adapter.test.ts | ||
| opencode-local-skill-sync.test.ts | ||
| paperclip-env.test.ts | ||
| paperclip-skill-utils.test.ts | ||
| pi-local-adapter-environment.test.ts | ||
| pi-local-execute.test.ts | ||
| pi-local-skill-sync.test.ts | ||
| plugin-database.test.ts | ||
| plugin-dev-watcher.test.ts | ||
| plugin-environment-driver-seam.test.ts | ||
| plugin-local-folders.test.ts | ||
| plugin-managed-agents.test.ts | ||
| plugin-managed-routines.test.ts | ||
| plugin-orchestration-apis.test.ts | ||
| plugin-routes-authz.test.ts | ||
| plugin-scoped-api-routes.test.ts | ||
| plugin-sdk-orchestration-contract.test.ts | ||
| plugin-secrets-handler.test.ts | ||
| plugin-telemetry-bridge.test.ts | ||
| plugin-worker-manager.test.ts | ||
| private-hostname-guard.test.ts | ||
| productivity-review-service.test.ts | ||
| project-goal-telemetry-routes.test.ts | ||
| project-routes-env.test.ts | ||
| project-shortname-resolution.test.ts | ||
| quota-windows-service.test.ts | ||
| quota-windows.test.ts | ||
| recovery-classifiers.test.ts | ||
| redaction.test.ts | ||
| routine-run-telemetry.test.ts | ||
| routines-e2e.test.ts | ||
| routines-routes.test.ts | ||
| routines-service.test.ts | ||
| run-continuations.test.ts | ||
| run-liveness.test.ts | ||
| runtime-api.test.ts | ||
| sandbox-provider-runtime.test.ts | ||
| secret-provider-registry.test.ts | ||
| secrets-routes.test.ts | ||
| secrets-service.test.ts | ||
| server-startup-feedback-export.test.ts | ||
| setup-supertest.ts | ||
| shared-telemetry-events.test.ts | ||
| sidebar-preferences-routes.test.ts | ||
| storage-local-provider.test.ts | ||
| telemetry-client-flush.test.ts | ||
| ui-branding.test.ts | ||
| user-profile-routes.test.ts | ||
| vite-html-renderer.test.ts | ||
| work-products.test.ts | ||
| workspace-runtime-routes-authz.test.ts | ||
| workspace-runtime-service-authz.test.ts | ||
| workspace-runtime.test.ts | ||
| worktree-config.test.ts | ||
README.md
Server Tests
Server tests that need a real PostgreSQL process must use
./helpers/embedded-postgres.ts instead of constructing embedded-postgres
directly.
The shared helper creates a throwaway data directory and a reserved-safe loopback port for each test database. This protects the live Paperclip control-plane Postgres from server vitest runs; see PAP-2033 for the incident that introduced this guard.