mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-23 13:13:46 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents use the `set_task_monitor` tool to save a timed follow-up
check on their task
> - Agents that run with the `low_trust_review` preset (for example,
pull request reviewers) cannot save this check
> - The tool requires company-wide `runtime:manage` access, and the
preset denies that access
> - Thus a reviewer must wait for a different event before it can
continue its review
> - This pull request lets the assignee save or clear a self-wake
monitor on its own task, and keeps the company-wide restriction
> - The benefit is that reviewers can continue their own review on time,
with no new company-wide access
## Linked Issues or Issue Description
**What happened?**
A `low_trust_review` agent calls `set_task_monitor` on its own
in-progress task. The call fails with this error: "low_trust_review
agents cannot use company-wide or privileged runtime:manage APIs by
default." The tool is advertised to the agent, but the agent cannot use
it. The agent cannot schedule its own follow-up check.
**Expected behavior**
The assignee can schedule or clear a monitor that only wakes itself on
its own task inside its trust boundary. Monitors that create recovery
tasks or escalate to the board stay denied. Company-wide
`runtime:manage` stays denied.
**Steps to reproduce**
1. Assign an in-progress task to an agent.
2. Start a native run for that task with a `low_trust_review` execution
policy whose boundary root is the task.
3. Call `set_task_monitor` with a future `nextCheckAt` and notes.
4. See the 403 error with reason `deny_low_trust_boundary`.
**Paperclip version or commit**
`master` at 8282d386da.
## What Changed
- `assertCanManageIssueMonitor` accepts an optional own-task scope. With
this scope, a `deny_low_trust_boundary` result for `runtime:manage` does
not block the assignee when both the requested monitor and the stored
monitor are the assignee's own self-wake (`wake_owner` recovery,
scheduled by the assignee, not the provider-quota service) or are empty.
- The native `set_task_monitor` tool passes this scope only when the
agent, project and task policies alone resolve the same low-trust
boundary as the current run. A monitor wake starts a run from those
sources, not from the run snapshot. Thus the woken run keeps the same
low-trust limits. A low-trust boundary that only the run snapshot
carries is still denied.
- The tool still checks `issue:read` and `issue:mutate` on the target
first, and still requires an in-progress or in-review task assigned to
the calling agent.
- The `create_recovery_issue` and `escalate_to_board` recovery policies
still require `runtime:manage`. The assignee also cannot clear or
replace a board-scheduled, recovery, escalation or provider-quota
monitor.
- The HTTP issue routes do not change.
- `doc/LOW-TRUST-PRESETS.md` describes the new rule.
## Verification
- Test 1 failing before the fix: `pnpm vitest run
src/services/native-runtime/task-monitor.integration.test.ts -t
"low-trust reviewer"` (in `server/`). The new test failed: `promise
rejected "Error: low_trust_review agents cannot use company-wide or
privileged runtime:manage APIs by default."` from
`assertCanManageIssueMonitor`, with `{ status: 403, details: { reason:
'deny_low_trust_boundary' } }`.
- Test 2 failing before the trust fix: `pnpm vitest run
src/__tests__/issue-monitor-scheduler.test.ts -t "low-trust limits"`. A
run with a low-trust policy only in its snapshot could save a monitor
(`promise resolved ... instead of rejecting`). After the fix, that call
is denied. When the task carries the policy, the monitor is saved, the
real scheduler fires it, and the woken run resolves to
`low_trust_review` with the same boundary.
- Test 3 failing before the stored-monitor fix: the extended "low-trust
reviewer" test cleared a board `escalate_to_board` monitor (`promise
resolved ... instead of rejecting`). After the fix, clear and replace
are denied for board-scheduled, `escalate_to_board`,
`create_recovery_issue` and provider-quota monitors.
- Passing after: `task-monitor.integration.test.ts`,
`issue-monitor-scheduler.test.ts` and
`native-preserved-monitor-wait.test.ts` pass (100/100).
- `pnpm run typecheck` in `server/` passes.
- I did not run the full `pnpm verify`.
## Risks
- Low risk. The change applies only to the native tool, only to the
assignee, and only to the task-scoped `wake_owner` monitor. A monitor
wake goes only to the same agent on the same task, and that run resolves
the same low-trust boundary.
- The bypass depends on the `deny_low_trust_boundary` decision reason.
Other denials (for example, a viewer responsible user, a task bridge
key, or a skill-test token) still block the call.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code
execution in an agent harness.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
170 lines
9.7 KiB
Markdown
170 lines
9.7 KiB
Markdown
# Low-Trust Presets
|
|
|
|
Paperclip ships core trust preset names so containment decisions are enforced in
|
|
Community Edition even when EE policy editing is unavailable.
|
|
|
|
## Presets
|
|
|
|
- `standard`: the default V1 company-visible collaboration model. This preserves
|
|
existing behavior for normal agents.
|
|
- `low_trust_review`: an opt-in containment preset for automated work that may
|
|
consume hostile or prompt-injected input, such as untrusted pull requests,
|
|
external tickets, dependency diffs, or generated review output.
|
|
|
|
## Boundary Model
|
|
|
|
`low_trust_review` is resolved from existing JSON policy fields:
|
|
|
|
- agent permissions: `permissions.trustPreset` and
|
|
`permissions.authorizationPolicy.trustBoundary`
|
|
- project policy:
|
|
`executionWorkspacePolicy.authorizationPolicy.trustBoundary`
|
|
- issue/run policy: `executionPolicy.authorizationPolicy.trustBoundary`
|
|
|
|
The resolver intersects those sources. Narrower wins. A low-trust preset must
|
|
resolve to a concrete company-local project, root issue, or issue-id scope. If a
|
|
policy source names another company, uses an unsupported preset, or lacks that
|
|
scope for risky access, Paperclip fails closed.
|
|
|
|
## Containment, Not Privacy
|
|
|
|
This is containment for hostile automated work. It is not a general project,
|
|
issue, or human privacy system.
|
|
|
|
V1 standard work remains company-visible by default: board users and in-company
|
|
actors can inspect company work objects unless a separate access-control feature
|
|
changes that behavior. Low-trust containment instead limits what the low-trust
|
|
agent can read or mutate through the Paperclip API and prevents raw untrusted
|
|
output from being automatically promoted into higher-trust agent context.
|
|
|
|
Low-trust agents cannot read or mutate privileged agent configuration or company
|
|
skill configuration through direct grants. Persistent instruction edits are also
|
|
restricted, except for the direct-chat self-edit described below. Configuration
|
|
changes from outside-triggered work must go through higher-trust review and
|
|
promotion paths instead.
|
|
|
|
Low trust does not prohibit task creation. Agents may create tasks assigned to
|
|
themselves, and subtasks of their own tasks, within their permitted project or
|
|
root-task scope. Creation uses the normal task-assignment permission checks,
|
|
including explicit assignment restrictions and the responsible user's authority,
|
|
even for an unassigned task. Other assignees must be explicitly within the trust
|
|
boundary; board-user assignments remain forbidden. New tasks retain the creator's
|
|
effective containment policy and quarantined source attribution. An exact issue-id
|
|
scope does not implicitly authorize new descendants, and a permitted parent does
|
|
not grant access to an unrelated project. An explicit root-task scope includes
|
|
its descendants. Self-assigned decomposition is not a delegation cycle.
|
|
|
|
Permission denials must identify the rejected action and specific restriction.
|
|
Agents must surface failed instruction-save receipts and explain when the current
|
|
run lacks direct-chat authority or the user lacks editing permission. The user
|
|
can request the edit in their authorized chat or apply it directly. Creating
|
|
another task does not authorize the instruction change.
|
|
|
|
When a low-trust agent's task is in a project outside its boundary, setup fails
|
|
the run with the typed `project_access_denied` code and the denied project ID
|
|
before provider work starts. The task notice links Manage project access. That
|
|
exact pre-dispatch shape is an owner action, so it stays on the task instead of
|
|
the unexpected Sentry run-failure stream. The legacy `setup_failed` code and the
|
|
denial message alone never suppress a report, and
|
|
`PAPERCLIP_SENTRY_RUN_FAILURES=all` still reports it.
|
|
|
|
## Direct-chat instruction edits
|
|
|
|
When an authorized user directly asks an agent in their own Agent Chat to edit
|
|
its persistent instructions, the agent may save its own `AGENTS.md` even under
|
|
`low_trust_review`. The exception requires the current accepted execution identity
|
|
and a recorded authenticated board-message wake for that chat, user, and agent.
|
|
User attribution alone, outside connector/plugin messages, ordinary tasks,
|
|
subtasks, and messages from another user do not qualify. An earlier owner message
|
|
cannot authorize a later external instruction. External content read during the
|
|
chat is not a request from the user to change instructions.
|
|
|
|
The authenticated owner-chat turn is the permission boundary. The server checks
|
|
message provenance and current edit access; it does not classify the message's
|
|
natural-language intent or require a separate approval for each edit. The agent
|
|
must follow the owner's request and treat tool output as data. This means prompt
|
|
injection during an authorized owner-chat turn remains a model-level risk; the
|
|
exception does not provide content-bound approval of the resulting file bytes.
|
|
|
|
Normal instruction editing permissions and explicit protected-change rules still
|
|
apply. The user's current permission is rechecked at every save, including private
|
|
working-copy collection after a successful, failed, or timed-out execution.
|
|
Cancellation, chat reset, reassignment, message deletion, and revoked access
|
|
invalidate the exception. A server-linked retry of the same chat request may use
|
|
its original authenticated message; unrelated continuations may not. This
|
|
authority is never written into the inherited trust policy and does not grant
|
|
peer instruction edits, general configuration access, or other privileged APIs.
|
|
|
|
## Human-directed work
|
|
|
|
An authenticated board user can talk to a low-trust agent in their own Agent
|
|
Chat or assign it a task outside its default intake boundary. Existing conversation
|
|
identity authorizes owner chat. Ordinary tasks use the human requester already
|
|
recorded on the run's wakeup requests, including coalesced requests. Each request
|
|
retains its server-owned origin; plugin-attributed users do not count as board
|
|
instructions. Legacy board assignment requests remain valid through their existing
|
|
assignment source, reason, and human requester, without trusting old plugin human
|
|
attribution. A board backlog assignment is retained as a completed assignment
|
|
request with no run, so it authorizes the later system launch without starting
|
|
work prematurely. No separate permission table or client-supplied human identity is needed. Responsible-user
|
|
attribution, external connector sender attribution, and agent claims do not qualify.
|
|
|
|
At dispatch and API authorization, Paperclip checks the live run and current
|
|
assignment in one database snapshot. The exception permits reading, commenting
|
|
on, and updating only that run's exact task. It does not extend to another task,
|
|
a child, a whole project, configuration, instructions, secrets, or runtime
|
|
management. Normal responsible-user checks still apply. The exception is never
|
|
stored in the inherited trust boundary.
|
|
|
|
Automatic retries and continuations follow the existing `retryOfRunId` database
|
|
links, checking the same company, agent, and task at every step. Cancelled runs
|
|
cannot authorize a retry. The common assignment transaction cancels prior human
|
|
requests, including plugin and service reassignments. Assigning the task back
|
|
cannot revive those requests, and late run settlement cannot undo cancellation. Sandbox and
|
|
isolated workspace requirements still apply, as do malformed-policy and
|
|
company-boundary checks.
|
|
|
|
## Child→Parent Reporting Under Containment
|
|
|
|
The direct-parent report comment is **off by default** for `low_trust_review`: a contained run reads
|
|
untrusted input, so a free-prose comment into the higher-trust parent thread is
|
|
a prompt-injection promotion path. Contained reviewers report by completing
|
|
their own review issue (`done` — the verdict is the deliverable; the
|
|
`issue_blockers_resolved` wake carries it upward) and by the platform's
|
|
system-attributed stop-only relay when they enter `blocked` or `cancelled`.
|
|
Never instruct a contained delegate to comment on its parent issue.
|
|
|
|
## Runtime Containment
|
|
|
|
Managed `low_trust_review` runs fail closed unless Paperclip can enforce the
|
|
runtime boundary:
|
|
|
|
- the selected execution environment must use the `sandbox` driver
|
|
- the effective execution workspace mode must be `isolated_workspace`
|
|
- the issue being run must be inside the resolved low-trust boundary or be the
|
|
exact human-directed task described above
|
|
- secret references must use binding ids explicitly allowed by the boundary
|
|
- inline sensitive environment values such as API keys and tokens are rejected
|
|
- workspace runtime-service mutations are denied unless the boundary explicitly
|
|
grants the `runtime.manage` tool class
|
|
- company-wide `runtime:manage` stays denied, but the assignee may use
|
|
`set_task_monitor` to schedule or clear a self-wake on its own in-boundary
|
|
task; monitors that create recovery tasks or escalate to the board are denied
|
|
- that self-wake is allowed only when the agent, project and task policies
|
|
alone resolve the same low-trust boundary as the run, so the woken run keeps
|
|
the same limits; a boundary carried only by the run snapshot is denied
|
|
- the assignee cannot clear or replace a monitor it does not own: a
|
|
board-scheduled, recovery, escalation or provider-quota monitor still needs
|
|
`runtime:manage`
|
|
|
|
When the task's project has no configured workspace and no layer specifies a
|
|
workspace strategy, sandbox execution uses a private directory for that company
|
|
and task. The directory persists across turns and reassignment and never imports the shared
|
|
project directory or agent home. No Git repository is required for this case.
|
|
Configured workspaces and explicit Git strategies keep their existing validation;
|
|
a missing or broken checkout does not fall back to an empty directory.
|
|
|
|
The Docker workflow in `doc/UNTRUSTED-PR-REVIEW.md` remains useful for manual
|
|
local review, but Paperclip-managed low-trust execution requires a sandboxed
|
|
environment instead of a host-local adapter process.
|