paperclip/doc
Dotta 3e1ea39ff3
fix(inbox): honor saved policy for explicit targets (#11221)
<!-- Write all pull request text in Simplified Technical English
(ASD-STE100): short sentences, one instruction per sentence, simple
approved vocabulary, and the active voice. -->

## Thinking Path

> - Paperclip is the open source control plane people use to manage
AI-agent companies and their work
> - Each user can let agents tidy that user's Mine inbox
> - The profile control saves either an open policy or an agent
allowlist
> - Explicit inbox archive requests checked only the separate
`inbox:manage` grant
> - This made the saved profile control ineffective for explicit user
targets
> - This pull request makes authorization honor the target user's saved
policy
> - The benefit is that the UI control and the API now enforce the same
user choice

## Linked Issues or Issue Description

**What happened?**

An agent received `403 inbox_cross_user_grant_required` when it archived
an issue with an explicit `userId`. The denial occurred even when that
user had enabled inbox management for the agent in Profile Settings. The
authorization service checked only `principal_permission_grants` for
explicit targets and ignored the saved user inbox policy.

**Expected behavior**

An explicit target is allowed when the target user saved an `open`
policy or an allowlist that contains the agent. An unsaved default-open
policy must remain limited to the responsible-user path. A scoped
`inbox:manage` grant must remain an administrative override.

**Steps to reproduce**

1. Save an inbox-agent allowlist for a user.
2. Include the acting agent in that allowlist.
3. Call `POST /api/issues/{issueId}/inbox-archive` with that user's
explicit `userId`.
4. Observe the incorrect `403 inbox_cross_user_grant_required` response
on the previous implementation.

**Paperclip version or commit**

Reproduced on `7ea2068ef8`.

**Deployment mode**

Self-hosted server.

**Installation method**

Built from source with pnpm.

**Agent adapter(s) involved**

Not adapter-specific. This is a core authorization bug.

**Database mode**

External Postgres in production. The regression tests use embedded
PostgreSQL.

**Access context**

Agent bearer authentication.

Related foundations: #9658 and #9724.

## What Changed

- Read the target user's saved inbox-agent policy before the
explicit-target decision.
- Allow saved `open` policies and matching allowlists for explicit
targets.
- Keep unsaved implicit-open policies responsible-user-only.
- Keep scoped `inbox:manage` grants as administrative overrides.
- Add service and route regressions for allow, deny, archive, unarchive,
and audit metadata.
- Update the implementation contract and agent-facing inbox API
guidance.

## Verification

- `pnpm exec vitest run
server/src/__tests__/authorization-service.test.ts
server/src/__tests__/inbox-archive-routes.test.ts` — 66 tests passed.
- `pnpm --filter @paperclipai/server typecheck` — passed.
- `git diff --check origin/master...HEAD` — passed.

## Risks

- Low risk. The change is limited to explicit inbox targets with a saved
policy.
- A missing policy row still denies explicit cross-user access.
- A non-matching allowlist and a disabled policy still deny access
unless a scoped administrative grant applies.

> 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 based on GPT-5. The runtime did not expose the exact
model build or context-window size. The agent used reasoning, repository
tools, code execution, 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 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-11 13:23:03 -04:00
..
assets
connections docs(connections): MCP-direct/DCR playbook section + Notion dry-run appendix (#11030) 2026-08-07 10:52:04 -05:00
design design(decisions): flatten decision cards to two task-borrowed types (#10474) 2026-07-31 18:43:40 -07:00
experimental feat(server): configure shared workspace concurrency (#10759) 2026-08-03 14:25:05 -05:00
logs
plans
plugins
pr/5429
screenshots
spec
AGENT-ARTIFACTS.md
AGENTCOMPANIES_SPEC_INVENTORY.md
CHANNELS.md feat(cli): add 'paperclipai channels' to show release lanes and the current one (#11210) 2026-08-11 08:47:32 -07:00
CLI.md feat(skills): require explicit merge modes (#10978) 2026-08-07 00:42:08 -05:00
CLIPHUB.md
DATABASE.md db: env-configurable client options; parallelize attention feed queries (#10795) 2026-08-04 06:30:36 -07:00
DEPLOYMENT-MODES.md
DEVELOPING.md feat: refine app connections and legacy worktree startup (#11040) 2026-08-07 14:26:40 -05:00
DOCKER.md
GOAL.md
HERMES_GATEWAY_ONBOARDING.md
HERMES_GATEWAY_SMOKE.md
INSTALLING.md feat(cli): add managed install, update, and service lifecycle (#10045) 2026-07-31 18:52:23 -07:00
LOW-TRUST-PRESETS.md
MCP-ACCESS-GOVERNANCE.md
MCP-DEMO-SCRIPT.md
MCP-RUNTIME-OPERATIONS.md
OPENCLAW_ONBOARDING.md
PRODUCT.md
PUBLISHING.md
README-draft.md
RELEASE-AUTOMATION-SETUP.md feat(release): add human-gated beta channel with stable soak enforcement (#11008) 2026-08-10 16:52:59 -07:00
RELEASE-CHECKLIST.md feat(release): candidate-branch beta builds and the release checklist (#11209) 2026-08-11 10:05:13 -07:00
RELEASE-NOTES-mcp-access-governance.md
RELEASING.md feat(release): candidate-branch beta builds and the release checklist (#11209) 2026-08-11 10:05:13 -07:00
SECRETS-AWS-PROVIDER.md
SPEC-implementation.md fix(inbox): honor saved policy for explicit targets (#11221) 2026-08-11 13:23:03 -04:00
SPEC.md
TASK-WATCHDOG.md
TASKS-mcp.md
TASKS.md
TELEMETRY_WORKFLOW.md
UNTRUSTED-PR-REVIEW.md
execution-semantics.md
memory-landscape.md
observability.md