mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-04 21:21:27 +01:00
## 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 c5f5d3163d.
## What Changed
- New column `issue_attachments.issue_level` (boolean, default `false`,
migration `0514`). It marks a file that a person attached to the task
itself.
- The UI sets `issueLevel` for new-task files, the task attachment
picker and drop zone, the task side panel upload button and drop zone,
the description editor, and task document images. Inline description
draft images that are bound at publication are also marked.
Comment-composer uploads, agent uploads and system files (for example
workspace-recovery archives) stay unmarked.
- The upload route accepts an optional `issueLevel` multipart field
(`true` or `false`). A file with a comment is never issue-level.
- `resolveNativeRunnerWakeAttachmentSelections` adds task files without
a comment after the wake comment's files. A task file is marked
issue-level, or the saved description links to it by its attachment or
asset content path (this covers files saved before the marker, with no
backfill). They come oldest first, within the existing 20-file limit. A
full wake keeps its comment files and does not fail. Only files a person
uploaded count; agent uploads, which carry no per-file trust, never do.
A quarantined low-trust task does not stage them.
- Staged descriptors for these files carry `taskAttachment: true`, so
the agent can tell them from the current wake's files.
- Runner download grants accept a null source comment for `wake` grants
only. The download route requires that the file is in the current wake
selection and has no comment. `history` grants still require a comment.
## Verification
- New `native-runner-task-attachment-staging.test.ts` (embedded
Postgres, with the migration): local staging of a task image, an
unmarked file that the description links to, comment-first ordering, an
unsent composer upload that is not staged and returns 404 on download,
an agent upload that is marked and linked from the description but is
not staged, the 20-file limit, low-trust quarantine, and the Runner
download grant (200 for the task file, 404 for crossed comment/task
grants, and no history grant without a comment).
- `issue-attachment-routes.test.ts`: `issueLevel` is saved for `true`,
is `false` when absent, and an invalid value returns 400.
- `chat-attachment-read`, `native-chat-workspace`,
`native-runner-attachment-staging`, `antigravity-run-start`,
`paperclip-control-plane-port`, `native-stop-accounting.integration`:
pass. `native-session-executor.test.ts`: 1572 passed, 7 skipped.
- `pnpm run typecheck` in `server` and `ui`: passed.
`IssueDetail.mobile.test.tsx`: passed.
- `pnpm verify` asks for full CI because of the migration. The pinned
runner-e2e source inputs are refreshed.
## Risks
- Schema change: one `ADD COLUMN ... DEFAULT false NOT NULL`. PostgreSQL
11 and later add it without a table rewrite.
- Existing attachments stay `false`. Older files that the description
links to are still staged. Other older files without a comment are not
staged. This fails closed, and a person can attach the file again.
- The migration is a constant-default `ADD COLUMN` only;
`migration-compatibility --check` passes.
- A file attached through a task-level surface stays a task file until
it is deleted, also if it is later removed from the description text. It
stays in the task's Attachments list for everyone on the task.
- Each native wake on a task with task files stages those files again.
The 20-file and 10 MiB Runner download limits apply. Each wake adds one
indexed query.
- Adapter (non-native) runs do not change.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use
(shell, file edits, database reads of a test instance) and extended
thinking.
## 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
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>