paperclip/server/src
Dotta 6ffe9df842
fix(auth): clarify protected-agent assignment blocks (#10893)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Task assignment policies control which agents can receive work.
> - Protected-agent policy flags currently stop assignment.
> - The existing error says that the assignment requires approval.
> - Paperclip has no approval workflow for this policy.
> - This pull request models the policy as a hard block and gives the
operator an action that exists.
> - The benefit is accurate API guidance without weakening the existing
fail-closed behavior.

## Linked Issues or Issue Description

Refs #6386

**What happened?**

A protected-agent assignment denial said that approval was required. No
approval record or approval action existed for this policy, so the
message sent agents and operators to a dead end.

**Expected behavior**

The authorization result must state that protected-agent policy blocks
assignment. It must tell a company administrator to remove the block
before retrying.

**Steps to reproduce**

1. Set `authorizationPolicy.protectedAgent.requiresApproval` to `true`
on a target agent.
2. Give another agent the `tasks:assign` permission.
3. Preview or attempt assignment to the protected agent.
4. Observe that the old response promises an approval step that does not
exist.

**Paperclip version or commit**

`c54936e2e9` on `master`.

**Deployment mode**

Built from source. The behavior is in the core authorization service and
is not deployment-specific.

**Agent adapter(s) involved**

Not adapter-specific.

## What Changed

- Added canonical `protectedAgent.blockAssignment` and
`protectedAgent.blockReason` policy fields.
- Kept the legacy approval-named flags as fail-closed compatibility
aliases.
- Changed denial copy to name the hard block and the administrator
action.
- Added authorization and plugin-host regression coverage for canonical
and legacy policy data.
- Updated the V1 implementation contract with the protected-assignment
rule.

## Verification

- `pnpm exec vitest run
server/src/__tests__/authorization-service.test.ts
server/src/__tests__/plugin-access-authorization-host-services.test.ts`
— 2 files passed, 61 tests passed.
- `pnpm --filter @paperclipai/shared typecheck` — passed.
- `pnpm --filter @paperclipai/server typecheck` — passed.
- `pnpm --filter @paperclipai/shared build` — passed.
- `pnpm --filter @paperclipai/server build` — passed.
- `pnpm check:token-gates` — all gates clean.
- `git diff --check public-gh/master...HEAD` — passed.

The repository-wide local wrappers exceeded the execution host resource
limit before they printed a final summary. The PR check loop will use
GitHub CI as the complete test and build authority.

## Risks

- Low: assignment remains fail-closed. The change corrects the policy
name and denial guidance.
- Low: legacy fields remain supported, so existing plugin-owned policy
data does not change behavior.
- Low: the new policy schemas allow unknown keys for forward
compatibility, as the existing authorization policy schema already does.

> 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, exact model ID `gpt-5`, tool-enabled coding agent with
reasoning, shell, Git, and GitHub CLI access. The runtime 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>
2026-08-05 10:09:17 -05:00
..
__tests__ fix(auth): clarify protected-agent assignment blocks (#10893) 2026-08-05 10:09:17 -05:00
adapters fix(runtime): scope PAPERCLIP_ env-binding strip to reserved keys (#9974) 2026-07-22 07:01:57 -05:00
auth feat(mcp) [split 3/8]: add tool access policy core (#9558) 2026-07-14 14:22:39 -05:00
built-ins/agents feat(skills): make summarize-status actions-first (#10117) 2026-07-23 15:59:44 -05:00
http Upload company import packages as compressed zip uploads (fix large-company imports through Cloud) (#10531) 2026-07-30 18:48:22 -07:00
lib Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
middleware feat: make in-app features cloud-aware (#10850) 2026-08-04 23:00:14 -05:00
onboarding-assets [codex] Add heartbeat policy eval coverage (#9087) 2026-07-06 16:31:14 -05:00
realtime Add browser SSH terminal for custom image setup (#8911) 2026-07-03 16:44:21 -07:00
routes feat(activity): add two-tier all-actors audit feed (#10831) 2026-08-04 23:07:38 -05:00
secrets feat(secrets): write through external values and deep-link details (#10196) 2026-07-27 19:08:07 -05:00
services fix(auth): clarify protected-agent assignment blocks (#10893) 2026-08-05 10:09:17 -05:00
storage feat(run-logs): durable run-log store via object-storage mirror (#8984) 2026-07-14 15:45:39 -07:00
types feat(mcp) [split 3/8]: add tool access policy core (#9558) 2026-07-14 14:22:39 -05:00
agent-auth-jwt.ts Skill Studio: three-pane skill IDE with sandboxed test runs (#9241) 2026-07-09 13:08:56 -05:00
app.ts feat: make in-app features cloud-aware (#10850) 2026-08-04 23:00:14 -05:00
attachment-types.ts fix(server): accept Office issue attachments (#8562) 2026-07-21 10:47:33 -07:00
board-claim.ts [codex] Add agent permissions and controls plan (#6386) 2026-05-22 08:12:52 -05:00
build-commit.ts fix(server): preserve source SHA without Git metadata (#9638) 2026-07-15 20:03:52 -05:00
build-version.ts fix(server): stamp the real build version into images instead of the package.json placeholder (#10257) 2026-07-25 10:06:28 -07:00
config-file.ts Fail loudly on invalid config files (#9041) 2026-07-21 10:18:45 -07:00
config.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
dev-runner-worktree.ts feat(workspaces): defer isolated setup until runtime start (#10653) 2026-08-02 10:37:10 -05:00
dev-server-status.ts [codex] UI and dev ops quality-of-life (#6384) 2026-05-19 15:52:39 -05:00
dev-watch-ignore.ts feat(adapters): external adapter plugin system with dynamic UI parser 2026-04-03 21:11:20 +01:00
errors.ts security(invites): widen invite-token entropy and rate-limit public invite endpoints (#8979) 2026-07-14 15:47:58 -07:00
first-admin-claim.ts [codex] Add private browser first-admin claim flow (#6755) 2026-05-27 21:15:01 -10:00
home-paths.ts feat(server): thread plural referenced-project workspaces through run prep (#10448) 2026-07-29 14:27:05 -07:00
index.ts fix(server): preserve hot-restart shutdown snapshots (#10815) 2026-08-04 11:44:43 -05:00
instrumentation.test.ts fix(server): export manual OpenTelemetry spans (#10565) 2026-07-31 12:47:57 -07:00
instrumentation.ts feat(observability): give sandbox sync spans true wall-clock width (#10864) 2026-08-04 19:52:15 -07:00
log-redaction.ts Sync/master post pap1497 followups 2026 04 15 (#3779) 2026-04-15 21:13:56 -05:00
paths.ts feat(cli): add client commands and home-based local runtime defaults 2026-02-20 07:10:58 -06:00
redaction.ts feat(issues): contain cross-issue agent side effects (#10837) 2026-08-04 13:17:49 -05:00
runtime-api.ts Prefer loopback runtime API URL for local agents (#5102) 2026-06-20 14:03:21 -07:00
server-info.ts fix(server): preserve source SHA without Git metadata (#9638) 2026-07-15 20:03:52 -05:00
shutdown.test.ts fix(server): preserve hot-restart shutdown snapshots (#10815) 2026-08-04 11:44:43 -05:00
shutdown.ts fix(server): preserve hot-restart shutdown snapshots (#10815) 2026-08-04 11:44:43 -05:00
startup-banner.ts Introduce bind presets for deployment setup 2026-04-11 07:09:07 -05:00
static-index-html.ts [codex] Bundle local branch fixes from PAP-10032 (#6604) 2026-05-25 07:25:26 -05:00
telemetry.ts fix: add periodic flush and graceful shutdown for server-side telemetry 2026-04-02 10:47:29 -05:00
ui-branding.ts Ensure worktree execution starts only after activation (#9374) 2026-07-10 16:11:26 -05:00
version.ts fix(server): stamp the real build version into images instead of the package.json placeholder (#10257) 2026-07-25 10:06:28 -07:00
vite-html-renderer.ts [codex] Add backup endpoint and dev runtime hardening (#4087) 2026-04-20 06:08:55 -05:00
worktree-config.ts fix(worktree): disable automatic database backups (#10520) 2026-07-30 17:35:04 -07:00