Commit Graph
8875 Commits
Author SHA1 Message Date
cryppadotta 03dc341957 Merge origin/master into fix/opencode-api-key-and-antigravity 2026-12-04 10:22:19 +00:00
Dotta ca21075837 test(server): fold tiny purge suites into the agent lifecycle owner suite (#23719)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The agent lifecycle module owns agent purge and company deletion.
> - The repository test budget rule asks to add a narrow database case
to the owning suite, not to a small standalone file.
> - Two small test files each start their own embedded Postgres for a
few purge cases only.
> - This pull request moves those cases into the agent lifecycle owner
suite and deletes the two small files.
> - The benefit is two fewer test workers and two fewer database setups
in CI, with the same assertions kept.

## Linked Issues or Issue Description

No public GitHub issue exists for this change. The problem is described
here, using the enhancement template labels.

**What existing behavior does this improve?**

The layout of the agent lifecycle test suites and their CI setup cost.

**Subsystem affected**

server/ — REST API & orchestration services (agent lifecycle and company
deletion tests).

**Current behavior**

Two test files each boot an own embedded Postgres for a few purge cases:

- `server/src/services/agent-cost-history-deletion.test.ts` (61 lines)
covers the `agent_cost_history_retained` purge guard.
- `server/src/services/case-deletion.test.ts` (69 lines) covers company
deletion with retained case handoffs and the
`agent_case_history_retained` purge guard.

Each file pays a separate Vitest worker import and a separate embedded
database start. The `rules/test-budget.mdc` rule says: do not keep a
standalone embedded-Postgres file for one narrow regression case; add
the case to the owning service suite. The owner suite
`server/src/modules/agent-lifecycle/__tests__/lifecycle.test.ts` already
imports the same production modules (`createAgentLifecycle`,
`deleteCompany`) and uses the same database fixture.

**Proposed behavior**

The owner suite holds these cases inside two nested describe blocks. The
two small files no longer exist. No assertion changed.

**Reason and benefit**

CI runs two fewer standalone database files in the general server lane.
The moved cases reuse the database the owner suite already started. The
historical duration manifest recorded about 6 s and 8 s per file at its
recorded revision; these weights are scheduling estimates, not measured
savings for this change.

**Breaking changes**

None. Test code only.

## What Changed

- Moved 4 purge cost-history cases (cost event by run, cost event by
agent, finance event by run, and the positive purge case) into the owner
suite under `describe("agent purge with retained cost history")`.
- Moved 3 company-deletion-with-case-handoff cases (an `it.each` over
three handoff states, an `it.each` over source and target roles, and the
unrelated-agent purge case; 6 test registrations in total) into the
owner suite under `describe("deletion with retained case handoffs")`.
- Deleted `server/src/services/agent-cost-history-deletion.test.ts` and
`server/src/services/case-deletion.test.ts`.
- Added the `cases`, `caseAccessSources`, `caseHandoffs`, `costEvents`,
and `financeEvents` table imports to the owner suite.
- Net change: 131 deleted and 102 added test lines. No production line
changed.

The owner suite is a test file and was already longer than 1,000 lines
before this change. Extending the designated owner suite is the remedy
the test budget rule names for these files.

## Verification

Commands run on this branch (head `01bc9384`), local sandbox, Node
v25.9.0:

- `cd server && ../../node_modules/.bin/vitest run
src/modules/agent-lifecycle/__tests__/lifecycle.test.ts` — 1 file
passed, 86 tests passed, all 10 moved registrations included.
- Intended-failure control 1: the `agent_cost_history_retained` guard in
`server/src/services/agent-deletion.ts` was disabled for a moment. The 3
moved cost-history cases failed on their expected 409 conflict. The
positive purge case still passed. The file was then restored with `git
checkout` and the diff was checked clean.
- Intended-failure control 2: the `agent_case_history_retained` guard
was disabled the same way. The 2 moved handoff purge cases failed on
their expected 409 conflict. The other matched cases still passed. The
file was restored the same way.
- `node scripts/check-test-budget.mjs --files
server/src/modules/agent-lifecycle/__tests__/lifecycle.test.ts` — PASS.
- The full owner suite was run again after the restorations: 86 tests
passed.

Not run locally: the repository typecheck and the full test suite. The
runner build dependency for the typecheck did not fit the free disk of
this sandbox. The required CI checks passed on the PR head `01bc9384`:
68 checks succeeded (typecheck, build, all 20 general server test
shards, chat and workspaces-b shards, runner support, Greptile). Six
conditional lanes were skipped as not applicable. Three independent bot
reviews scored the change 5/5 with no findings.

## Risks

- Low risk. Test files only; no production code changed.
- The moved cases now share the database instance the owner suite
starts. Each moved case still creates its own rows with fresh
identifiers, and the controls above show each case still fails at its
own guard.
- The general server shard durations manifest still lists the two
deleted files. The manifest is regenerated from CI runs by
`scripts/ci/refresh-test-durations.mjs`; stale entries do not route
work.

## Model Used

GLM 5.3 (z-ai/glm-5.3; exact model ID `openrouter/z-ai/glm-5.3`), run by
the Paperclip Test Gardener agent, with tool use and code execution. No
extended thinking mode.

## 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
canary/v2026.1204.0-canary.886600 nightly/v2026.1204.0-nightly.0
2026-12-04 02:12:34 -06:00
597992d955 fix(ui): open the chat side drawer on the chat's task list (#23702)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Agent Chat lets a person talk to one agent. The chat header has a
button that toggles the right side drawer.
> - In a new chat, the button did nothing. The desktop panel did not
show content until the chat was saved by the first message.
> - In the coordinator workspace, the drawer opened on an empty
launcher. It did not show the tasks from the chat.
> - The user expects the button to open a list of the tasks that the
chat created or that its agent worked on.
> - This pull request makes the drawer open on that task list in both
cases.
> - The benefit is that the header button always does something useful
in a chat.

## Linked Issues or Issue Description

**What happened?**
In the chat view, the button in the top right toggles the right side
drawer. In a new chat, a click on the button does nothing. In the
coordinator workspace, the drawer opens empty.

**What did you expect to happen?**
The button opens the drawer with a list of the tasks that the chat
created or worked on.

**Steps to reproduce**
1. Turn on Agent Chat.
2. Open a chat with an agent that has no saved conversation.
3. Click the drawer button in the top right of the header.
4. The drawer does not open.

## What Changed

- `IssueDetail.tsx`: For an unsaved chat on desktop, the panel now shows
a read-only task list. The full side panel still needs a saved issue,
because its Properties tab writes to the issue.
- `AgentWorkPanels.tsx`: Add `AgentChatDraftTasksPanel`. It shows the
agent's tasks. In the coordinator workspace, it shows the empty list of
tasks from the conversation.
- `TaskSidePanel.tsx`: In the coordinator workspace, a saved chat now
opens on its Tasks tab ("Tasks from this conversation") and not on the
empty launcher. Other tasks keep the empty, on-demand panel.
- Add `IssueDetail.agentChatPanel.test.tsx` with four desktop tests: a
saved chat, an unsaved chat, a saved coordinator chat, and an unsaved
coordinator chat.

## Verification

- `cd ui && npx vitest run src/pages/IssueDetail.agentChatPanel.test.tsx
src/pages/IssueDetail.mobile.test.tsx`: 7 tests pass.
- Red-green: before the fix, the unsaved-chat test failed because the
drawer stayed hidden. The coordinator test failed when I removed the
`TaskSidePanel.tsx` change.
- `pnpm verify`: 4,214 tests pass in 260 of 261 selected files. One
test, `codemirror-single-instance.test.ts`, timed out at 5 s under load.
It walks `node_modules` and does not touch this change. It passes alone
(10/10).
- `npx tsc --noEmit -p ui`: no errors in changed files. The only errors
come from Storybook feature-map files that need generated indexes. Those
indexes are not in git.
- I did not do a manual browser check. The local preflight build did not
finish in time.

## Risks

- Low risk. The change applies only to Agent Chat routes.
- In the coordinator workspace, a chat's drawer now opens on Tasks and
not on the launcher. The user can still open other tabs from the
launcher.
- The unsaved-chat task list in the classic workspace shows all the
agent's tasks. That is the same list as the saved chat's default Tasks
tab.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and
code 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
- [ ] 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1204.0-canary.886500
2026-12-03 23:46:32 -08:00
3d3c702942 fix(runner): keep room to retire a session that filled its command journal (#23700)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Native agent runs use a Runner. Core keeps a durable journal of the
commands that it sends to the Runner.
> - The journal stops at 500 commands. A long run adds one semantic tool
result to the journal for each tool call, so the journal can become
full.
> - The next run on the same sandbox must retire that session. It must
queue `turn.stop`, `runner.drain`, `runner.suspend` and `session.close`.
The full journal rejects these commands.
> - Each successor run then fails with
`native_predecessor_retirement_unproven` (`command_journal_full`). The
task stays stuck until a person intervenes.
> - This pull request keeps a separate, bounded reserve in the journal
for retirement commands only.
> - The benefit is that the next run can always stop and close a session
whose work filled the journal.

## Linked Issues or Issue Description

**What happened?**
A long native run (Codex app-server) made almost 500 tool calls. Its
Core command journal became full. Three automatic successor runs on the
same sandbox then failed in `retireWarmPredecessor`. The error was "The
previous run's session on this sandbox could not be retired (Durable PRP
command journal bound exceeded: command_journal_full.)". The stack ends
in `DurablePrpControlPlane.queueCommand` from
`awaitRunnerSuspensionBarrier`.

**Expected behavior**
The next run retires the old session and continues. A full work journal
must not block the commands that stop and close the session.

**Steps to reproduce**
1. Create a `DurablePrpControlPlane`.
2. Queue 500 `semantic_tool.result` commands.
3. Queue `turn.stop`, `runner.drain`, `runner.suspend` or
`session.close`.
4. On `master`, each of these throws `command_journal_full`.

**Paperclip version or commit**
`986af44e94` (`master`). The failure was seen on release `3f882fc589`.

**Agent adapter(s) involved**
Codex (native Runner, `paperclip_runner` adapter). The journal is not
adapter-specific.

Related: #20727 (a draft about the other journal bound,
`command_payload_too_large`). This PR does not change that bound.

## What Changed

- `durable-prp-control-plane.ts`: work commands still stop at 500
(`maxCommands`).
- Retirement commands (`turn.stop`, `runner.drain`, `runner.suspend`,
`runner.shutdown`, `session.close`, `session.destroy`, `run.cancel`) can
use 64 more slots (`retirementCommandReserve`). Reads such as
`session.snapshot` cannot use the reserve, so readiness polls cannot
consume it.
- The saved-state check and the checkpoint check accept up to 564
commands. Without this change, a retired journal cannot load again.
- Three tests: one fills the journal and retires it, then reopens the
local state. One does the same with checkpoint persistence and decodes
the checkpoint. One fills the reserve to 564 commands and checks that a
565th retirement command and a read are both rejected without changing
the journal.

## Verification

- Red before the fix: `npx vitest run
src/control-plane/durable-prp-control-plane.test.ts -t "command
journal"` failed with `command_journal_full` on `turn.stop`.
- Green after the fix: the same command passes (2 tests).
- Each load bound is necessary: when I put back the old bound in the two
validation checks, both tests fail.
- Reserve bound: with the hard-cap check removed, the boundary test
fails (`expected [Function] to throw an error`).
- After review fixes (3c6fe49e80): `durable-prp-control-plane.test.ts`
passes (238 tests).
- Affected suites (3e72d97be6): `durable-prp-control-plane.test.ts`,
`durable-prp-checkpoint-records.test.ts` and
`warm-attachment-readiness.test.ts` pass (248 tests).
- The Rust Runner has no command-count bound. It compacts its own
journal, so it accepts the extra controller sequences.
- Not run locally: the full suite and `pnpm verify` (its selection step
did not finish in 5 minutes on this machine). CI supplies this coverage.

## Risks

- Low risk. Work commands keep the same 500 bound. The journal can grow
by a maximum of 64 small retirement commands.
- A run whose work fills the journal still stops its own work at 500
commands. This PR does not change that limit. It only makes sure that
the next run can retire the session.
- An older Core build that loads a journal with more than 500 commands
rejects that state. This can only occur after a rollback, and it fails
closed as before.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use (shell,
file edit, Sentry and Paperclip tools) in Claude Code.

## 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1204.0-canary.886400
2026-12-03 21:56:45 -08:00
0f36a88f41 fix(notifications): stop toasting "changed the title" on task updates (#23674)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The board shows live toast notifications when another person or
agent changes a task.
> - Each title edit makes a toast that says "<actor> changed the title".
> - Agents often set or change task titles automatically. These toasts
are noise and give no useful information.
> - This pull request removes title changes from the toast details on
the server and from the toast text in the UI.
> - The benefit is fewer unhelpful notifications. Status, priority,
assignment, and description changes still show.

## Linked Issues or Issue Description

**Describe the bug**
Users get toast notifications that only say "<actor> changed the title".

**Steps to reproduce**
1. Open the board as a user.
2. Let another user or an agent change the title of a task.
3. See the toast "<actor> changed the title".

**Expected behavior**
A title change does not show a notification. Other changes in the same
update still show.

## What Changed

- `server/src/realtime/activity-toast-details.ts`: the projection does
not set `titleChanged` any more. This also stops old cached UI bundles
from showing the toast.
- `ui/src/context/LiveUpdatesProvider.tsx`: `describeIssueUpdate` does
not add "changed the title". A title-only update now makes no toast.
- Tests: new UI and server tests for title-only and mixed updates. The
existing tests now expect no `titleChanged` field.

## Verification

- Red-green: the new UI test "does not announce title changes" failed
before the fix and passes after it.
- `cd ui && npx vitest run src/context/LiveUpdatesProvider.test.ts`: 140
passed.
- `cd server && npx vitest run
src/realtime/activity-toast-details.test.ts
src/__tests__/live-events-toast.test.ts`: 19 passed.

## Risks

- Low risk. Title changes do not show a toast any more. The task
activity log still records them.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code
execution in Claude Code.

## 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)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
(the execution workspace assigned the branch name)
- [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 (no
doc describes this toast)
- [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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1204.0-canary.886300
2026-12-03 20:54:56 -08:00
bca282e587 feat(recents): add tasks from manual routine runs to Recents (#23675)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The sidebar Recents list shows the tasks from a person's own recent
activity
> - A person can run a routine manually with "Run now", and the run
creates a task
> - That task does not show in Recents, and opening it does not keep it
there, because Recents only admits tasks under the Mine participation
rule. This also affects every routine, channel, and agent-created task
that a person opens
> - The Mine rule keeps these tasks out of Mine on purpose, so we must
not change that rule
> - This pull request adds a separate Recents eligibility flag. It also
admits tasks that the viewer opened and tasks from manual routine runs
that the viewer started. The UI records the new task in Recents when the
run starts
> - The benefit is that people can find the task they just started from
the sidebar at once, and Mine stays unchanged

## Linked Issues or Issue Description

**Is your feature request related to a problem? Please describe.**
When I run a routine manually and it creates a task, the task is not in
my Recents list. I must go to the routine or the task list to find it.

**Describe the solution you'd like**
When I run a routine manually and a task is created, add that task to my
Recents list automatically, even if I did not open it.

Also, a task that a routine creates does not show in Recents even after
I open it.

**Additional context**
Mine must continue to keep routine tasks out by default, including
routines that a person starts manually (see `doc/PRODUCT.md`).

## What Changed

- `server/src/services/issue-summaries.ts`: navigation summaries return
a new `isRecentEligibleForMe` flag. It is true when one of these
conditions is true:
  - The viewer participates under the Mine rule.
- The viewer opened the task. The check is the viewer's
`issue_read_states` row, which is unique on company, issue, and user.
- The viewer started the manual routine run that created the task. The
check is a `routine_runs` row found through the indexed
`linked_issue_id`, with `source = 'manual'` and the same ID as the
issue's `originRunId`. The issue `createdByUserId` must be the viewer,
with no creating agent.
  `isParticipantForMe`, Mine, and unread state do not change.
- `packages/shared`: add `isRecentEligibleForMe` to `IssueSummary`.
- `ui/src/hooks/useRecentTasks.ts`: Recents uses `isRecentEligibleForMe`
(with a fallback to `isParticipantForMe` for older cached summaries) to
show, keep, and prune entries.
- `ui/src/lib/recent-tasks.ts`: add `recordStartedRoutineRunTask`. It
puts the run's task at the top of Recents. The summary fetch then
supplies the title and status and confirms eligibility.
- New `useRecordRoutineRunInRecents` hook. All five "Run now" paths call
it on success: Routines (both list variants), Routine detail, Execution
workspace detail, and the Responsibility screen.
- `tests/runner-e2e/source-sdk-public-inputs.json`: refresh the pin for
`packages/shared/src/types/issue.ts`.
- `doc/PRODUCT.md`: document the Recents behavior.

## Verification

- `cd ui && npx vitest run src/hooks/useRecentTasks.test.tsx`: 29
passed. The new test "shows a task from the viewer's manual routine run
at the top before it is opened" fails on the old hook (red) and passes
with the change (green). Other new tests cover a run that the server
does not confirm (for example, a coalesced run) and a repeat run for a
task that is already in Recents.
- `cd server && npx vitest run
src/__tests__/issue-summaries-routes.test.ts` (embedded Postgres): 24
passed. One new test checks that a manual run by the viewer is
Recents-eligible but not a Mine participant, and that runs by another
person and scheduled runs are not eligible. Another new test checks that
a routine task the viewer opened is Recents-eligible, and that a task
opened only by another person is not. That test fails on the previous
service code (red) and passes with the change (green).
- `ui` typecheck: no errors in changed files. (Errors exist only in
ungenerated Storybook feature-map indexes, which this change does not
touch.)
- The full `server` typecheck was killed by the local memory limit. CI
covers it.
- Manual check: run a routine with "Run now", then look at sidebar
Recents. The new task shows at the top before you open it. Mine does not
show it.

## Risks

- Low risk. No schema change and no migration.
- The summaries query adds two `EXISTS` subqueries per requested task.
Both use indexes (the read-state unique index and
`routine_runs_linked_issue_idx`). The request is bounded by
`ISSUE_SUMMARIES_MAX_IDS`.
- Behavior change: Recents now keeps tasks that the person opened, also
when the task is automatic work. Old local Recents entries for automatic
tasks that the person read can come back.
- If a manual run coalesces into an existing task that the viewer did
not start, the entry is pruned after the summary read. That task does
not show in Recents.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), via Claude Code with tool use
(shell, file edit, test runs).

## 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 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)
- [ ] 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: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 20:54:26 -08:00
b93527b632 fix(ui): sort the Reports to manager picker alphabetically (#23689)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Each agent can report to a manager agent. The user selects the
manager in the "Reports to" picker.
> - The picker shows candidate managers in directory order. This order
is not alphabetical.
> - When a company has many agents, the user cannot easily find a
specific agent in the list.
> - This pull request sorts the picker rows alphabetically by agent
name.
> - The benefit is that the user finds a manager faster, and the order
agrees with the sidebar.

## Linked Issues or Issue Description

**Is your feature request related to a problem?**
The "Reports to" picker on the agent profile lists agents in an
unpredictable order (for example: "Mac Coder", "Bug Bot", "Nibbler",
"CTO"). It is hard to find one agent in a long list.

**Describe the solution you'd like**
Sort the picker rows alphabetically by agent name. Ignore letter case.
Put "Agent 2" before "Agent 10".

**Describe alternatives you've considered**
Sorting the agent list in each caller. This change sorts inside the
shared `ReportsToPicker` component instead, so the agent profile and the
agent configuration form both get the same order.

## What Changed

- Added `reportsToPickerRows` to
`ui/src/components/ReportsToPicker.tsx`. It removes terminated and
excluded agents, then sorts the rows by name with `localeCompare`
(`sensitivity: "base"`, `numeric: true`).
- `ReportsToPicker` uses this function for its rows. "No manager" stays
at the top.
- The picker indexes `disabledAgentIds` in a `Set`. Before, it scanned
the array once per row.
- Added `ui/src/components/ReportsToPicker.test.ts` with unit tests for
the order and the filter.

## Verification

- `cd ui && npx vitest run src/components/ReportsToPicker.test.ts`: 2
tests pass.
- Red check: the same tests fail on the previous code.
- `npx tsc --noEmit -p ui/tsconfig.json` shows no errors in the changed
files.
- 1,000-agent test bounds the sort work with a throwing name-read
counter (per `rules/ui-render-cost.mdc`).
- Manual: ran the branch on a local dev server with 13 agents. The
"Reports to" picker showed: Agent 2, Agent 10, Bug Bot (Deprecated), CEO
Agent, CTO, Dickens, Engineer Agent, Fry (Codex), Mac Coder, nibbler,
Reviewie, Slow Query (GLM), Test Gardener (GLM).

## Risks

- Low risk. The change is UI-only and changes only the row order. Filter
and selection behavior do not change.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude
Code with tool use (shell, file edit) and image input.

## 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)
- [ ] 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1204.0-canary.886100
2026-12-03 20:52:44 -08:00
Dotta 986af44e94 fix(ui): omit task archive success toasts (#23697)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Task views let each person archive tasks from their inbox.
> - Some archive actions display a success toast.
> - The task lists and indicators already show the archive result.
> - This pull request removes the success toast from each task archive
path.

## Linked Issues or Issue Description

**What happened?**
Some task archive actions displayed a success toast. Related work:
#11220.

**Expected behavior**
A successful task archive has no toast. If the action fails, the UI
shows the error.

**Steps to reproduce**
1. Open Tasks and select Mine or All tasks.
2. Archive a task.
3. On the base revision, the Task archived toast appears.

**Paperclip version or commit**
Reproduced on master at `3f882fc5895072e9a63e46df0eb0e1dad75f092b`.

**Deployment mode**
Local UI component tests.

## What Changed

- Remove task archive success toasts from the inbox-backed Tasks view,
the shared task-list action, task detail, and the recent-tasks sidebar.
- Use **U** after archiving directly from Mine or Unread. Use
**Restore** in **Archived** for a task archived from any view.
- Add regression cases for Inbox, Tasks, All tasks, and task detail.
Document where to restore a task.

## Verification

- The Tasks and All tasks cases failed on the base revision because they
received a success toast.
- The task detail case also failed with the original success toast
restored and passed after its removal.
- Run `pnpm exec vitest run --root ui --config vitest.config.ts
src/pages/IssueDetail.mobile.test.tsx
src/pages/TaskListPagination.test.tsx src/lib/inboxArchiveCache.test.ts
src/lib/keyboardShortcuts.test.ts
src/hooks/useInboxTouchedIssues.test.tsx`. All 63 tests passed on
`8cf0f17`.
- `pnpm --filter @paperclipai/ui typecheck` passed.
- The workspace Git storage guard prevented the incremental `pnpm
verify` command from selecting tests. The focused Vitest run above
covers the changed behavior.

## Risks

- The Undo button in the toast goes away with the toast. Use **U** for
archives initiated in Mine or Unread. **Restore** in **Archived** covers
detail, sidebar, and other task-list archives.
- The archive request, task cache updates, and error handling use the
same paths.

## Model Used

- OpenAI Codex, GPT-6, with shell and GitHub API tools.

## 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

hint: if you need to wait for this pull request to be reviewed, merged,
or closed before continuing, use this instead of polling:
gh event listen --resource
https://github.com/paperclipai/paperclip/pull/23697 --event
com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1
- It prints the first event as a JSON line on stdout and exits; run it
again to wait for the next one.
- Add `--timeout` to stop waiting after a while, for example `--timeout
30m`; it then exits with status 8.
  - Events carry no details; read the pull request to see what changed.
- It misses changes made before it starts, so read the pull request once
it is running.
  - See `gh event listen --help` for other event types.
- Event subscriptions are in preview and may not be enabled for your
account.

hint: if you need to wait for this pull request to be reviewed, merged,
or closed before continuing, use this instead of polling:
gh event listen --resource
https://github.com/paperclipai/paperclip/pull/23697 --event
com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1
- It prints the first event as a JSON line on stdout and exits; run it
again to wait for the next one.
- Add `--timeout` to stop waiting after a while, for example `--timeout
30m`; it then exits with status 8.
  - Events carry no details; read the pull request to see what changed.
- It misses changes made before it starts, so read the pull request once
it is running.
  - See `gh event listen --help` for other event types.
- Event subscriptions are in preview and may not be enabled for your
account.
canary/v2026.1204.0-canary.886000
2026-12-03 21:32:35 -06:00
DottaandPaperclip a30541b793 fix(ui): fade out task status update caret unless hovered (#23402)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - On a task page, the activity thread shows status update rows such as
"Ran commands, searched files" and their expanded activity rows.
> - In `TaskChatRunnerActivityGroup`, the disclosure caret on the right
edge stays at full opacity even when the user does not hover over the
row.
> - Other collapsible rows in the task thread (`TaskChatThinking`,
`TaskChatProtocolActivityRow`) hide their disclosure carets at rest
while preserving touch-device discoverability
(`tc-hover-disclosure-caret`) and keeping expanded carets legible
(`rotate-90 opacity-80`).
> - This pull request fades out the right-side caret on runner activity
phase toggles, folded read runs, and expandable activity rows unless
hovered, keyboard-focused, or expanded, while sharing the repository's
`.tc-hover-disclosure-caret` touch fallback.
> - The benefit is a calmer task thread with no layout shift on hover,
full keyboard accessibility, and consistent disclosure behavior across
all task-chat rows.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

The disclosure carets on the right side of task status update rows in
`TaskChatRunnerActivityGroup` on the task page.

**Subsystem affected**

ui/ — React + Vite board UI

**Current behavior**

Activity status update rows such as "Ran commands, searched files",
folded file-read rows, and expandable activity rows keep their
right-side chevron caret visible at full opacity at rest.

**Proposed behavior**

When collapsed and not hovered, the right-side caret stays faded out
(`opacity-0`). It fades in smoothly with the shared motion tokens
(`--motion-duration-fast` and `--motion-ease-standard`) on row hover or
keyboard `focus-visible`, and fades back out when hover or focus ends.
While a row is expanded, the caret stays visible (`rotate-90
opacity-80`, brightening to `opacity-100` on hover/focus). All three
carets include the shared `.tc-hover-disclosure-caret` class so
touch-only devices (`@media (hover: none)`) keep the disclosure
affordance discoverable.

**Reason and benefit**

Hiding the right-side caret at rest removes visual noise across activity
updates in the task thread and aligns `TaskChatRunnerActivityGroup` with
the existing hover-disclosure pattern in `TaskChatThinking`,
`TaskChatProtocolActivityRow`, and `ui/src/index.css` (related: #12640,
#15048). Using opacity instead of unmounting keeps row alignment stable
on hover.

**Breaking changes**

None.

## What Changed

- Extract a shared `DISCLOSURE_CARET_CLASS` constant in
`ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx` including
`tc-hover-disclosure-caret` and the shared motion tokens
(`--motion-duration-fast`, `--motion-ease-standard`,
`motion-reduce:transition-none`).
- Add named group hooks (`group/activity-phase`, `group/read-run`,
`group/activity-row`) to the three disclosure buttons in
`TaskChatRunnerActivityGroup.tsx`.
- Fade out each right-side `ChevronRight` caret at rest (`opacity-0`),
reveal it on hover or keyboard focus (`group-hover/...:opacity-100`,
`group-focus-visible/...:opacity-100`), and keep it visible while open
(`rotate-90 opacity-80`).
- Add unit tests in
`ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx`
covering completed summaries, active toggles, folded read runs, expanded
activity rows, open/close state transitions, and
`tc-hover-disclosure-caret`.

## Verification

- Local focused Vitest on `0b46f7cf99`: `node
node_modules/vitest/vitest.mjs run
ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx
ui/src/components/task-chat/antigravity-thread.test.tsx
ui/src/components/task-chat/completed-activity-summary.test.ts` — 36/36
tests passed.
- Local focused Vitest on `0b46f7cf99`: `node
node_modules/vitest/vitest.mjs run
ui/src/components/TaskChatThread.test.tsx` — 436 passed, 1 skipped.
- Local token gates on `0b46f7cf99`: `pnpm check:token-gates` — all 4
token gates clean.
- Local UI build on `0b46f7cf99`: `pnpm --filter @paperclipai/ui build`
— built cleanly and verified compiled CSS emits `@media
(hover:none){.tc-hover-disclosure-caret{opacity:1}}` and scoped
`group-hover/*:opacity-100` rules.
- GitHub Actions CI on `0b46f7cf99` ([run
46734780674](https://github.com/paperclipai/paperclip/actions/runs/46734780674)):
all 30 checks passed (`ci / verify`, `ci / Build`, `ci / Typecheck +
Release Registry`, `ci / General tests`, `ci / policy`, all 16 `ci /
e2e` shards, `commitperclip PR Review`, `Socket Security`, `Superagent
Security`, and `security/snyk`).
- Automated reviews on `0b46f7cf99`: `ponytail-paperclip-review` (5/5,
ship), `feynman-nuclear-review` (5/5), and `Greptile Review` (5/5; P2
note about `tc-hover-disclosure-caret` answered and resolved in-thread).

## Risks

- Low risk. Only the opacity, rotation, and transition classes on the
right-side disclosure carets change; click, expand/collapse, keyboard,
and touch-device discoverability semantics stay intact.

> This is a small UI polish change and does not overlap with planned
core features in `ROADMAP.md`.

## Model Used

- Google DeepMind Antigravity coding agent (Gemini model with
reasoning/thinking mode, file editing, shell execution, and GitHub CLI
tools; exact model ID and context window are not exposed by the runner
environment).

## 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 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>
canary/v2026.1204.0-canary.885900
2026-12-03 21:18:38 -06:00
Devin FoleyandPaperclip 3f882fc589 fix(native): stage task-description attachments for native agents (#23688)
## 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>
canary/v2026.1204.0-canary.885800
2026-12-03 17:44:15 -08:00
0d867729db fix(server): encode non-Latin-1 workspace download filenames (#23683)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Board users can open and download files from a task's workspace
through the file-resources route
> - The download response builds a raw `Content-Disposition` header from
the file name
> - Node rejects header values that hold characters outside Latin-1,
such as the U+202F narrow no-break space in macOS screenshot names, or
CJK text
> - The route then fails with `TypeError: Invalid character in header
content ["Content-Disposition"]` and returns 500
> - This pull request makes the route use `res.attachment()`, which
encodes the name correctly
> - The benefit is that users can download workspace files with any name

## Linked Issues or Issue Description

Refs #22892. That PR fixes the same defect in the asset and invite-logo
routes. This PR fixes the last route that builds the header by hand: the
workspace file download. The two PRs change different files and do not
conflict.

**What happened?**
A staging server reported `TypeError: Invalid character in header
content ["Content-Disposition"]` from `ServerResponse.setHeader`. A
workspace file download with a non-Latin-1 file name returns HTTP 500
for the same reason.

**Expected behavior**
The download succeeds. The header holds an ASCII `filename` fallback and
an RFC 6266 `filename*` parameter with the full UTF-8 name.

**Steps to reproduce**
1. Put a file named `Screenshot 10.32.55 PM.png` (with U+202F before
`PM`) in a project workspace.
2. Download it through `GET
/api/issues/:issueId/file-resources/content?download=1`.
3. The server returns 500.

**Relevant logs or output**
`TypeError: Invalid character in header content ["Content-Disposition"]`
at `ServerResponse.setHeader (node:_http_outgoing)`.

## What Changed

- `server/src/routes/file-resources.ts`: the download path now calls
`res.attachment(safeAttachmentFilename(title))` instead of writing the
raw header. The call comes before `Content-Type`, so the route keeps its
own content type.
- `server/src/__tests__/file-resources.test.ts`: a new test downloads a
file whose name holds U+202F and Japanese text. It checks the status,
the content type, the encoded `Content-Disposition`, and the bytes.

## Verification

- Red: without the route change, `npx vitest run
src/__tests__/file-resources.test.ts -t "not Latin-1"` fails with
`expected 500 to be 200`.
- Green: with the change, `npx vitest run
src/__tests__/file-resources.test.ts` passes (53 of 53). The old
`archive.bin` and `index.html` download tests still get `attachment;
filename="..."` unchanged.
- I also reproduced the Node error directly:
`setHeader("Content-Disposition", 'inline; filename="Screenshot
10.32.55 PM.png"')` throws the same message.

## Risks

Low risk. ASCII file names produce the same header as before.
Non-Latin-1 names now get a `?` fallback in `filename` and the full name
in `filename*`, which current browsers use. `res.attachment()` also sets
`Content-Type` from the extension, but the route sets its own value
right after that call.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), used as an agent with tool use
(shell, code edits, test runs).

## 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1204.0-canary.885700
2026-12-03 17:34:34 -08:00
Devin FoleyandPaperclip 8a5b374a9c test: order Antigravity mode changes before admission readback (#23685)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The Runner checks provider settings before it admits an Antigravity
swarm.
> - A test changes a confirmed mode during admission and expects
rejection.
> - The fake CLI could complete model readback before it sent the mode
change.
> - Pipe scheduling could then move the change past admission and fail
the test.
> - This pull request sends the mode change before model readback.
> - The test can now check admission rejection without depending on pipe
timing.

## Linked Issues or Issue Description

**What happened?**

[Cloud readiness run 47231816304, attempt
2](https://github.com/paperclipai/paperclip/actions/runs/47231816304/job/144707142899)
failed the Antigravity test named “turns a provider mode change during
admission into a typed failure, stops the CLI, and keeps the caller
alive”. The open promise resolved instead of rejecting. This cancelled
[image run
47231816399](https://github.com/paperclipai/paperclip/actions/runs/47231816399).

**Expected behavior**

The fixture must deliver the mode change while admission still waits for
model readback. The runtime must reject with
`ANTIGRAVITY_SWARM_RECEIPT_MISMATCH` and stop its child process.

**Steps to reproduce**

Run `PAPERCLIP_VITEST_RETRY=0 pnpm exec vitest run
src/drivers/acpx/antigravity-swarm-runtime.test.ts --maxWorkers=1` from
`packages/paperclip-runner`. Before this change, the `mode-flip` fixture
wrote the valid model update before the invalid mode update. Separate
pipe reads could let admission finish between them. The CI failure shows
this outcome. One focused local baseline attempt passed, so the
intermittent failure was not reproduced locally.

## What Changed

- Send the `mode-flip` notification before the model configuration
update. Admission cannot finish model readback before it receives the
invalid mode.
- Keep the existing rejection and child retirement assertions. The idle
mode-change fixture and runtime code stay as they are.

## Verification

- The full Antigravity swarm runtime file passed: 66 tests, retries
disabled, one worker.
- `node --check
packages/paperclip-runner/test-fixtures/antigravity-cli/fake-agy-acp.mjs`
passed.
- `node scripts/check-test-budget.mjs --base origin/master` passed.
- `git diff --check` passed.
- `pnpm verify --explain` returned exit 2 because a Runner fixture needs
broad CI coverage. Required CI will supply that coverage.
- Final head `2c55808f394ad07dc279a6d074fecb9f61fa540f`: [PR CI run
47239627453, attempt
2](https://github.com/paperclipai/paperclip/actions/runs/47239627453/attempts/2)
passed. It reports 76 successful jobs and one skipped selection job.
Both required gates (`ci / verify` and `ci / e2e`) passed. Standalone
Runner image checks, macOS checks, and Windows Rust checks passed. No
checks remain active. GitHub reports `CLEAN` and `MERGEABLE`.
- Greptile scored this exact head 5/5 with no actionable findings or
unresolved review threads.
- Earlier failures remain accounted for: [the delayed initial
run](https://github.com/paperclipai/paperclip/actions/runs/47239537426)
was superseded by the `full-ci` label run and cancelled by PR
concurrency. Attempt 1 of the replacement run passed 73 jobs, but
[policy](https://github.com/paperclipai/paperclip/actions/runs/47239627453/job/144728063451)
exceeded its 10-minute limit. Both final gates then failed with `Policy
must succeed`, actual `cancelled`. Policy logs returned `BlobNotFound`,
so the stalled step and cause are unknown. After the run completed,
GitHub accepted a policy-job rerun request. This reran the reusable CI
workflow in attempt 2, which passed in full. The passing retry
establishes recovery; it does not establish the timeout's cause.
- Separate operational issue: master image runs
[47235737261](https://github.com/paperclipai/paperclip/actions/runs/47235737261)
and
[47238936675](https://github.com/paperclipai/paperclip/actions/runs/47238936675)
failed their source observers because GitHub's Actions job-list API
returned HTTP 502. Their architecture builds and exact-source readiness
runs passed. The current master's job-list request still returns 502
with `per_page=100`. Small pages can read that image run, but a
small-page source-readiness request also failed. There is no verified
pagination workaround. This fixture change does not resolve that API
failure or prove image publication.

## Risks

- Low risk. The diff changes one notification's order in a test fixture.
It adds no runtime behavior or configuration.
- The original intermittent failure was observed in CI. The local
baseline attempt passed. The fix removes the ordering gap identified in
that failure. The full CI workflow passed for the final revision.
- Documentation does not change because the runtime contract stays the
same.

## Model Used

- OpenAI `gpt-6.1-sol`, through the Codex harness in T3 Code, with xhigh
reasoning effort and shell tools. The context window size is 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
- [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-12-03 17:27:03 -08:00
Danila Katalshov ded4c1bf15 fix(server): encode Unicode asset response filenames (#22892)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - People open uploaded files and company logos from their browser.
> - Two routes put the stored filename directly into an HTTP header.
> - Node rejects some valid Unicode names used by screenshot tools and
people.
> - This change formats both filenames with the same Express API used
for issue attachments.

## Linked Issues or Issue Description

Fixes: #7493

Thanks to dosthcpp for the report and the earlier proposal in #7494. The
issue attachment route already uses Express to format the filename. The
asset content and invite logo routes still wrote it directly. Related
#8716 and #9570 cover attachment display policy and ZIP downloads.

## What Changed

- Format the filename with Express in the asset content and invite logo
responses. Keep the current content type and inline or attachment
choice.
- Exercise a screenshot with a narrow non-breaking space and a logo with
Japanese characters.

## Verification

- On the preceding master `f1dd9288d`, both Unicode cases returned 500
before the fix.
- On `3fbf872d9` with the fix, 57 tests passed across the assets, invite
logo, and issue attachment suites. The new checks verify status, Unicode
filename encoding, and inline disposition.
- Full server typecheck, test budget, and `git diff --check` passed. PR
CI is pending.

## Risks

- Both routes still set the content type from storage metadata after
formatting the filename. The existing disposition, range, and content
policy behavior remain covered by the route tests.

## Model Used

- OpenAI Codex (GPT-6 family) with terminal and Vitest access. Exact
model identifier and context window were not exposed in this session.

## 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
- [ ] 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
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-12-03 16:49:11 -08:00
Devin FoleyandPaperclip c5f5d3163d test: remove recovery and Tailscale readiness races (#23678)
## Thinking Path

> - Paperclip requires checks for an exact Core source commit before it
publishes images.
> - Cloud readiness runs the server integration tests without retries.
> - Server shard 18/20 failed in recovery cleanup and Tailscale
enrollment.
> - The recovery test returned before its status wake reached the
heartbeat drain.
> - The Tailscale fixture exposed state before it was safe to read or
observe.
> - This pull request makes those fixtures wait for their actual
completion boundaries.

## Linked Issues or Issue Description

Refs #23227. Related earlier cleanup fix: #23673.

**What happened?**

[Docker run
47225196060](https://github.com/paperclipai/paperclip/actions/runs/47225196060)
stopped after [Cloud readiness server shard
18/20](https://github.com/paperclipai/paperclip/actions/runs/47225196237/job/144677926140)
failed. Staging image preparation then waited for a verified Core image.
The previous Runner reattachment cleanup fix passed its protocol lane in
that run.

The recovery test deleted agents after a late wake inserted a child row.
The Tailscale test failed its first connection. On the [next master
run](https://github.com/paperclipai/paperclip/actions/runs/47227863572/job/144687185775),
the Tailscale blocked-save test timed out while waiting for a callback
that startup might never reach.

**Expected behavior**

Fixture teardown must join the status wake. The fake Tailscale CLI must
publish complete state and receive each simulated consent event
reliably. Tests must await enrollment completion and fail promptly when
connection setup fails.

**Steps to reproduce**

Run the two changed test files or server shard 18/20 with retries
disabled. The unmodified local files reproduced a consent callback
failure. The CI links above record the foreign-key and blocked-save
failures. The foreign-key failure did not reproduce in the initial local
run.

**Paperclip version or commit**

Failures on `07150650c926d8947ae591f61e4ed854ca284149` and
`ba521863f6090e40a37ed3cb6b1ecaf358a11424`. The fix starts from the
latter and is rebased onto `86042310917c15eb04be121baf58a6929e52a7d2`,
which adds release notes only.

**Deployment mode**

Source checkout in GitHub Actions. Local checks use macOS arm64, Node
25.6.1, hermetic Tailscale executables, and disposable embedded
PostgreSQL.

Searched open PRs and issues for the failing files, `ENOTEMPTY`, Runner
cleanup, and Tailscale tests. No duplicate fix was found. Issue #23227
describes the startup-dependent expiry window and is also addressed
here.

## What Changed

- Wait for the accepted recovery status change to persist its wake
before the existing heartbeat drain deletes fixture tables. The wake has
an asynchronous route prologue that can outlive the HTTP response.
- Register a signal handler in the owned fake CLI before exposing the
login URL. Publish fixture state atomically, then signal that exact
child to simulate consent. This removes the dependency on filesystem
notification delivery.
- Await the network manager's completion promise instead of a short
callback polling window.
- Start the expiry test with a valid window, advance the application
clock after startup, and submit late consent. Keep real subprocess
timers and restore the clock spy in `finally`.
- Race blocked-save admission against early connection settlement so
startup failures are reported instead of hanging the test.
- Only two test files change. Runtime behavior, release gates, and
deployment policy do not change.

## Verification

- Baseline: the unmodified two-file run failed the consent callback
assertion; 129 tests passed. The recovery cleanup passed locally, with
its CI failure retained above.
- An intermediate expiry check failed its one-second callback wait. A
later parallel shard run still lost a filesystem notification. The final
fixture uses an explicit consent signal and awaits manager completion.
- That eight-worker shard run also timed out in unchanged
workspace-trust and runtime-control fixtures while a monolithic
typecheck ran concurrently. Those two unchanged files passed in a serial
control with the changed fixtures: 186 tests passed across four files.
The final shard is run separately with four workers and retries
disabled.
- `pnpm exec tsc --noEmit -p tsconfig.json` from `server/`: passed.
- After the release-notes-only rebase, the Tailscale file passed again:
9 tests, retries disabled. The two fixture file contents are identical
to the final shard run.
- `PAPERCLIP_VITEST_RETRY=0 PAPERCLIP_VITEST_MAX_WORKERS=4 pnpm
test:run:general -- --group general-server-without-chat-or-native-runner
--shard-index 17 --shard-count 20`: passed on the final fixture
contents. 85 files passed, 3 skipped; 1945 tests passed, 18 skipped.
Duration: 160 seconds.
- `node scripts/check-test-budget.mjs --files
server/src/__tests__/issue-recovery-actions.test.ts
server/src/services/connectors/tailscale/device-login-network.test.ts`:
passed.
- `git diff --check` and local secret/PII review: passed.
- [Greptile
review](https://github.com/paperclipai/paperclip/pull/23678#issuecomment-7396242983):
5/5 on head `13bf3586bcf3201ce137f674812e8faf778ee77d`, with a
successful current-head check and no actionable findings or review
threads. The [full PR CI
workflow](https://github.com/paperclipai/paperclip/actions/runs/47231990509)
passed on attempt 1. All 71 reported checks are clean on this head;
GitHub reports `CLEAN` / `MERGEABLE` and there are no unresolved review
threads.

## Risks

Low risk. The change is limited to fixtures. A missing status wake or
failed enrollment still fails the tests. The expiry case now checks
actual late-consent rejection without making success depend on process
startup time. No schema, API, or runtime changes are required. The tests
and PR explain the behavior; no documentation update is needed. A new
verified master image is still required before staging can resume.

## Model Used

OpenAI `gpt-6.1-sol` through the Codex harness in T3 Code, with xhigh
reasoning effort, shell and file tools. The harness 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-12-03 16:22:38 -08:00
Nicky LeachandClaude Opus 5.5 c2a8821809 fix(agents): keep a prepared agent setup when its configuration changes (#23669)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - A new agent can use a plugin environment that requires an agent. A
lifecycle plugin prepares that environment before the agent can work.
> - The setup flow creates a draft agent first, so that this preparation
can start before the person finishes setup.
> - Each change to the draft's harness, model, or sign-in started
preparation again. The hire also started it again.
> - Verification cannot start until the last preparation is complete. So
the early preparation did not decrease the wait after the hire.
> - This pull request keeps the preparation when the agent stays on the
same environment driver.
> - The benefit is that a person who finishes setup waits only for
verification.

## Linked Issues or Issue Description

I searched the open and closed issues and pull requests. I did not find
a duplicate.

**What happened?**

Create an agent in setup on a plugin environment that declares
`requiresAgent: true`. The draft is prepared. Then choose a harness,
sign in, and hire the agent. Each of these three steps starts
`preparing` again. The agent page shows preparation after the hire,
although the environment was ready before the person signed in.

**Expected behavior**

A change to the harness, model, credentials, or instructions does not
change the environment. It must not start preparation again. The hire
must go directly to verification. If preparation is in progress, the
hire must join it.

**Steps to reproduce**

1. Install a lifecycle plugin with an environment driver that declares
`requiresAgent: true`.
2. Make that environment the instance default.
3. Create a setup draft and wait until `lifecycleState` is `verifying`.
4. Save a different model on the draft. `lifecycleState` goes back to
`preparing`.
5. Hire the draft. `lifecycleState` goes back to `preparing` again.

**Paperclip version or commit**

`7e025ae65f`

**Deployment mode**

Self-hosted server with a plugin environment that requires an agent.

## What Changed

- A configuration change restarts `preparing` only when the agent moves
to an environment that needs setup. The existing environment and driver
check makes this decision.
- A prepared setup draft stays prepared when its harness, model,
credentials, or runtime configuration change.
- The hire of a prepared draft goes directly to `verifying` with a new
operation.
- The hire of a draft that is still `preparing` keeps the operation and
its version. Verification starts when that operation is complete.
- A hire that moves to an environment that needs setup starts
`preparing` again, as before.
- A save that changes an environment to another driver of the same
plugin now also refuses `preparing` agents, the same as `ready` and
`verifying` ones.
- A change to instructions alone does not restart verification. The hire
writes the managed instruction files immediately after it commits, and
verification does not read them.
- The hire clears an old lifecycle error on the draft.
- These behaviors do not change:
  - a draft that no longer needs preparation goes to `pausing`
  - a hire that needs approval, a hire with a hold, and a company hold
  - an edit to other execution configuration during verification
  - an edit during `resuming`
- `doc/AGENT-LIFECYCLE.md` describes the new rules.

## Verification

- `npx vitest run src/modules/agent-lifecycle`: 224 passed. Four new
tests cover a prepared draft, a hire from a prepared draft, a hire
during preparation, and an instruction change. Three of them failed
before the change. The fourth could not run because a test before it
left the fixture blocked.
- `npx vitest run` on the hire, lifecycle delivery, agent secret,
pending approval, secret binding, managed plugin environment, and plugin
task tests: all passed.
- `npx vitest run` on the two Dot onboarding files: 25 passed.
- `pnpm --filter @paperclipai/server typecheck`: passed.
- Not done: a live test with a plugin environment.

Three existing tests used an agent in `preparing` to test that a
configuration change fences verification. They now use `verifying`.

## Risks

- A lifecycle plugin that reads the agent's harness or model during
`preparing` is not called again when they change. The lifecycle request
does not carry them. Verification still tests the final configuration.
- A prepared environment can be lost between preparation and hire.
Verification then fails and retries, and a pause and resume prepares it
again. Before this change, the hire prepared it again.
- An edit during `preparing` does not cancel the attempt in progress. A
plugin must not fail because the agent's configuration changed during
its call.
- No migration.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with
extended thinking, tool use and code 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 15:55:56 -08:00
8604231091 docs(release): stable notes for the 2026.1203.0-beta.0 soak (v2026.1206.0) (#23580)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The release process promotes a soaked beta to stable. The stable
GitHub Release body comes from `releases/beta/v<beta-version>.md` on
`master`
> - Beta `2026.1203.0-beta.0` published in workflow run 47005574134. Its
`draft_stable_notes` job pushed a commit-log skeleton to this branch
> - The skeleton is a raw commit list. It is not usable as release notes
> - This pull request replaces the skeleton with curated stable notes.
Each claim traces to a pull request in `v2026.1202.0..89c6e38`
> - The benefit is that the stable promotion for this beta
(v2026.1206.0) finds finished notes on `master`

## Linked Issues or Issue Description

**Issue type**

Missing content

**Where is the issue?**

`releases/beta/v2026.1203.0-beta.0.md` is the stable-notes file for the
`2026.1203.0-beta.0` soak. At the branch head before this commit, it
holds only the auto-generated commit-log skeleton.

**What's wrong?**

The stable promotion reads this file from `master` and publishes it as
the GitHub Release body. A raw commit list is not suitable as a release
body.

**Suggested fix**

Merge the curated notes. Correct the H1 and the `> Released:` line in a
follow-up if the promotion date moves.

## What Changed

- Replaced the skeleton in `releases/beta/v2026.1203.0-beta.0.md` with
curated stable notes for v2026.1206.0. The layout is the same as the
v2026.1202.0 notes: overview, Breaking Changes, Highlights,
Improvements, Fixes, Upgrade Guide, Contributors
- The notes are delta-framed against the published v2026.1202.0 notes.
None of the 107 cited pull requests appears in those notes
- The Upgrade Guide lists migrations `0500` through `0513` with
one-phrase effects, the new environment variables with defaults, the
experimental-setting changes, and the harness pins
- Release and CI internals, smoke specs, canary tooling, Paperclip Cloud
work, dependency bumps, and test-only changes are left out

## Verification

- Beta publish is complete. The npm dist-tag `beta` is
`2026.1203.0-beta.0`. The tag `beta/v2026.1203.0-beta.0` points at
`89c6e38ad182962d6deb99f58580b822131316f2`. In run 47005574134,
`publish_beta`, both `smoke_beta` jobs and `draft_stable_notes`
succeeded. The beta Docker build (run 47021510703) succeeded
- The GitHub compare API returns 465 commits for
`v2026.1202.0...89c6e38ad182962d6deb99f58580b822131316f2`. This number
matches the overview and the Contributors section
- Contributors are the 24 unique GitHub logins of the commit authors in
the range, read from the GitHub API with `[bot]` accounts excluded.
External handles are thanked by name
- Every `#NNNN` link in the file traces to a commit in the range (107
cited pull requests)
- Migration numbers, setting keys, env var names, and defaults were
checked in the code at the source commit, not in commit subjects
- The file contains no internal ticket ids or instance-local links
- The diff changes one file under `releases/` and no source files

## Risks

- Low risk: a single markdown file, no source changes. If the promotion
date moves past 2026-12-06, the H1 and the `> Released:` line need a
one-line update before the stable dispatch
- The `draft_stable_notes` job force-pushes this branch name. A rerun of
that job replaces this commit with the skeleton. Do not rerun it for
this beta

## Model Used

- Claude (Anthropic), model ID `claude-opus-5-5` (Claude Opus 5.5), tool
use via Claude Code

## 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
- [ ] I have run tests locally and they pass (documentation-only change;
no tests apply)
- [ ] I have added or updated tests where applicable (not 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1204.0-canary.885200
2026-12-03 15:47:31 -08:00
Nicky LeachandClaude Opus 5.5 ba521863f6 perf(skills): import environment skills when a setup draft is created (#23672)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - A plugin environment driver can declare `skillKeys`. Core adds those
managed skills to each run on the environment.
> - Before a run can use a skill, Core imports it into the company's
skill library. This occurs once for each company.
> - The import occurs when the first task starts. So the first task in a
new company waits for it.
> - Each missing skill is imported in its own transaction. Each import
checks all bundled skills two times, and the transactions do not share
that check.
> - This pull request starts the import when a person creates a setup
draft, and checks the bundled skills once.
> - The benefit is that the first task starts sooner. The setup does not
wait for the import.

## Linked Issues or Issue Description

I searched the open and closed issues and pull requests. I did not find
a duplicate.

**What happened?**

The first task on a plugin environment with four managed skills spent
more than ten seconds in skill import. Most of this time was the check
and first import of Core's bundled skills. That check ran again for each
managed skill.

**Expected behavior**

The import must start before the first task, while the person completes
setup. One import must check the bundled skills once.

**Steps to reproduce**

1. Install a plugin with an environment driver that declares several
`skillKeys`.
2. Make that environment the instance default.
3. Create a company, set up its first agent, and give it a task.
4. Measure the skill selection part of the first run's preparation.

**Paperclip version or commit**

`7e025ae65f`

**Deployment mode**

Self-hosted server with a plugin environment that declares managed
skills.

## What Changed

- When a person creates a setup draft, the server imports the
environment's missing skills in the background. The response does not
wait for this import.
- A failed background import writes a warning. It does not change the
draft. Run admission still installs the skills that are missing.
- The background import is counted as active work, so an idle drain
waits for it. It runs once and does not poll or retry.
- An environment skill import checks the bundled skills once before it
installs the missing skills. Before, each skill did this check two times
in its own transaction.
- `importPackageFiles` reads the library rows after its own inventory
check. It no longer does the check a second time.
- `doc/skills-and-teams-catalog.md` describes the new behavior.

Skill selection, version pins, and the files that a run receives do not
change.

## Verification

- `npx vitest run src/__tests__/environment-skills.test.ts`: 7 passed.
Two tests are new. They fail when I remove the single check and the
background import.
- `npx vitest run` on the company skill service, managed skill content,
company portability, agent adapter validation, and agent lifecycle
tests: all passed.
- `src/__tests__/ai-connections.test.ts`: 5 of its tests failed in the
same local run. The reconnect tests also fail at `7e025ae65f` without
this change on the same local database. They do not use this code.
- `pnpm --filter @paperclipai/server typecheck`: passed.
- Not done: a measurement of the first task with this change.

## Risks

- A draft that a person abandons leaves the imported skills in the
company library. The same skills are imported for the next agent on that
environment.
- The background import and a first task can run together. The existing
lock for each skill makes the second one wait and use the first result.
- The bundled skill check now runs outside the skill's transaction. If
the skill import then fails, the bundled skills remain imported. They
are imported by other library reads too.
- No migration.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with
extended thinking, tool use and code 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 15:29:50 -08:00
Devin FoleyandPaperclip 07150650c9 test(runner): drain reattachment writers before deleting state (#23673)
## Thinking Path

> - Paperclip manages agent work through durable Runner sessions.
> - Release images require Cloud readiness for their exact source
commit.
> - A reattachment test keeps a slow event backlog active during
controller recovery.
> - Its bounded close can return before queued journal writes finish.
> - The fixture then deletes the state directory and can fail with
`ENOTEMPTY`.
> - This pull request joins the fixture writers before it removes their
files.

## Linked Issues or Issue Description

**What happened?**

[Docker run
47193580475](https://github.com/paperclipai/paperclip/actions/runs/47193580475/attempts/1)
was cancelled after [Cloud readiness protocol lane
4/4](https://github.com/paperclipai/paperclip/actions/runs/47193580507/job/144565884014)
failed. The event-backlog reattachment test reported `ENOTEMPTY` while
removing its control-plane directory. A rerun passed on the same source
commit, without fixing the race.

**Expected behavior**

The fixture must finish all admitted writes and stop its child before it
deletes state, including when the transport close deadline expires.

**Steps to reproduce**

Run `runnerd-codex-transport-reattach-carried-commands.test.ts` with a
one-millisecond close budget for the event-backlog case. Before this
fix, the new cleanup assertion finds one accounting callback still
active.

**Paperclip version or commit**

Observed on `23ca89e3764377224bc43527bdfa547e9608f1db`. The fix starts
from `7e025ae65f9050030edf4d2cab006aa981569261`.

**Deployment mode**

Source checkout in GitHub Actions. Local reproduction uses macOS arm64,
Node 25.6.1, and the real Rust Runner with the hermetic fake Codex
fixture.

Searched open PRs and issues for `ENOTEMPTY`, carried commands, and
Runner teardown. No duplicate fix was found. Related earlier work:
#21161 and #21442.

## What Changed

- Retain all registered fixture authorities, including the detached
controller.
- Disable new upgrades, confirm the original child exited, stop
authorities, and drain admitted connection processing before deleting
state.
- Exercise an expired close budget in the existing backlog case. Assert
that accounting writes have finished before deletion.
- The fixture owns this cleanup. Runtime close behavior and its
deadlines do not change.

## Verification

- Red: the focused backlog test fails with `state cleanup must wait for
admitted event writes: expected 1 to be +0` before the teardown fix.
- Green: `pnpm exec vitest run
src/live/runnerd-codex-transport-reattach-carried-commands.test.ts` from
the Runner package: 11 passed, retries disabled.
- `pnpm exec tsc -p tsconfig.test.json --noEmit` from the Runner
package: passed.
- `git diff --check` and local secret/PII diff review: passed.
- `pnpm verify --explain`: exit 2. The conservative selector cannot
resolve this Runner test graph. Focused local checks passed; required PR
CI supplies the broader coverage.
- Tested file contents match PR head
`0a6b92e026ae0fdd684cd0e8e2ff7cf513732a02`.
- Final review: all 90 checks are clean, GitHub reports `CLEAN` /
`MERGEABLE`, and there are no unresolved review threads. The branch
includes current `master`.
- An initial local attempt could not run because debug binaries were not
built yet. Agent preflight completed before the red-green run.
- [Linux Runner Vitest lanes
1–6](https://github.com/paperclipai/paperclip/actions/runs/47222552156):
passed on PR head. Typecheck, build, Runner static checks, and support
suites also passed.
- [Greptile
review](https://github.com/paperclipai/paperclip/pull/23673#issuecomment-7394943956):
5/5 on PR head, no actionable findings or review threads. The
current-head check passed.
- [Server shard
14/20](https://github.com/paperclipai/paperclip/actions/runs/47222552156/job/144668670033)
was cancelled after its runner received a shutdown signal. This is
recorded runner loss, not an assertion failure. The repository started
attempt 2 automatically on the same PR head. The retry passed and the
full [PR CI
workflow](https://github.com/paperclipai/paperclip/actions/runs/47222552156/attempts/2)
completed successfully. Both Runner image builds, the macOS runtime
build, and all security scans also passed.

## Risks

Low risk. Only one test fixture changes. Teardown now waits for its
admitted writes instead of deleting their directory early. A stuck write
can fail the existing test timeout and preserve the state directory. No
schema, API, deployment, or runtime behavior changes. The code and
regression test describe the behavior; no documentation update is
needed.

## Model Used

OpenAI `gpt-6.1-sol` through the Codex harness in T3 Code, with xhigh
reasoning effort, shell and file tools. The harness 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-12-03 15:12:47 -08:00
7e025ae65f fix(workspaces): start a new remote workspace when the task's saved one is retired (#23655)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Before a run starts, Paperclip prepares the task's execution
workspace. With remote workspace storage, it reserves the task's saved
remote workspace.
> - A task stays bound to its workspace after that workspace is archived
or its cleanup fails.
> - For a retired host workspace, the next run already creates a new
workspace. For a retired remote workspace, preparation sent the retired
workspace to the reservation. The reservation refused it with "Workspace
ownership changed." (`remote_workspace_retired`, since #23582).
> - So the task could never run again. Each wake, recovery, or Retry
failed in setup with the same conflict.
> - This pull request makes a retired remote workspace act like a
retired host workspace: the run starts a new remote workspace.
> - The benefit is that a reopened task with an archived remote
workspace runs again, and the retired workspace and its saved snapshot
stay unchanged.

## Linked Issues or Issue Description

**What happened**
A task's own remote workspace was archived by hand (no terminal-cleanup
reason) and later moved to remote storage. When the task was opened
again, every run failed in setup with "Workspace ownership changed." The
task was then escalated for recovery, and the next wake failed in the
same way.

**Expected behavior**
A retired workspace is not reused. The run starts a new workspace for
the task, as it does for a host workspace. A native recovery or a saved
Retry that is bound to the retired workspace still stops with the
conflict.

**Steps to reproduce**
1. Bind a task to its own remote-storage workspace. Set the workspace
status to `archived` or `cleanup_failed`.
2. Start a run for the task with a Paperclip Runner agent in a sandbox
environment.
3. Setup fails with a 409 conflict, "Workspace ownership changed."
(`remote_workspace_retired`).

**Paperclip version or commit**
master at 0208bbfbf7.

Refs #23582 (gave this conflict its stable code). Related: #21954
(releases a binding to *another* task's closed workspace; this change is
about the task's *own* retired remote workspace).

## What Changed

- `remote-workspaces.ts`: add `isRetiredExecutionWorkspaceStatus`
(`archived` or `cleanup_failed`). When the caller requests no workspace,
`reserveRemoteWorkspace` does not fall back to an issue binding to a
retired workspace. It creates a new workspace and moves the issue
binding to it. An explicitly requested retired workspace still gets the
`remote_workspace_retired` conflict.
- `heartbeat/workspace-preparation.ts`: do not offer a retired
remote-storage workspace for reuse. The retired workspace still decides
the storage authority, so the task stays on remote storage even when the
instance does not enroll new tasks. This does not apply to a native
recovery, a persisted native execution input, or a saved Retry/fresh
attempt. Those stay bound to the workspace that they admitted.
- Tests: three preparation tests (`archived`, `cleanup_failed`, and
`archived` with new-task remote storage off) and one native-recovery
safety test in `workspace-preparation.test.ts`. Two reservation tests in
`remote-workspaces.integration.test.ts`.

## Verification

- Red before the fix: `cd server && npx vitest run
src/services/heartbeat/workspace-preparation.test.ts -t "saved remote
workspace is"` failed with `Workspace ownership changed.` for both
statuses. With only the reservation change removed, the two new
`remote-workspaces.integration.test.ts` tests also failed with
`Workspace ownership changed.`
- Green after the fix: `npx vitest run
src/services/heartbeat/workspace-preparation.test.ts
src/services/remote-workspaces.integration.test.ts -t "saved remote
workspace is|native recovery bound to a task workspace|stable conflict
code|when no workspace is requested"`: 8 of 8 pass. The storage-off case
failed before the follow-up commit (the run fell back to the host path).
- The tests check that the new workspace is active and bound to the
task, that the binding revision goes up by one, and that the retired row
and its snapshot metadata do not change. The existing explicit-request
conflict test still passes, and a native recovery still gets the
conflict.
- Full files: `npx vitest run
src/services/heartbeat/workspace-preparation.test.ts
src/services/remote-workspaces.integration.test.ts
src/services/workspace-recovery-admission.test.ts`: 433 of 433 pass
(Linux x64, Node 24.23.0, embedded Postgres).

## Risks

- Behavior change: a task whose own remote workspace is retired now
continues in a new workspace. Files that were only in the retired
workspace's snapshot are not restored into the new workspace. This is
the same as for a retired host workspace. The retired snapshot is not
deleted.
- A native recovery or a saved Retry still stops on a retired workspace,
so a run that is in progress does not change its workspace silently.
- No schema or API change.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), with tool use and code execution
in a sandbox.

## 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
- [ ] 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1203.0-canary.884900
2026-12-03 13:45:10 -08:00
Dotta 1fb8ddb740 feat(trust): allow transient workspace_prepare checkout for low-trust in-boundary projects (#23656)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The low-trust review preset isolates untrusted review agents inside
sandboxes with no runtime GitHub tokens and no sandbox network access
> - When a low-trust agent is explicitly assigned to a
private-repository project with `git.read` enabled, workspace
preparation routed the setup-time clone through
`resolveGitHubOperationCredentials`, which blocks all low-trust
credential export and caused `stage=clone git=auth_failed exit=128`
before the agent could start
> - Setup-time `prepareRemoteWorkspaceDirectory` runs on the trusted
controller path before the agent starts, uses transient `GIT_CONFIG_*` /
`PAPERCLIP_GIT_TOKEN` environment variables with `-c
core.hooksPath=/dev/null`, and writes zero credentials into
`.git/config`
> - This pull request adds `resolveGitHubWorkspacePrepareCredentials`
for controller-only `workspace_prepare` call sites, allowing transient
clone credentials strictly for a repository configured on a project
inside `trustBoundary.projectIds` when `git.read` is permitted
(preferring an agent-installed GitHub PAT connection when present),
while keeping runtime shell credentials
(`resolveGitHubOperationCredentials`) strictly denied
> - The benefit is that assigning a low-trust agent to a private-repo
project works out of the box for local read-only code review without
exposing any live GitHub token to the agent runtime

## Linked Issues or Issue Description

**What happened?**
When an agent configured with `trustPreset: "low_trust_review"` and
`allowedToolClasses: ["git.read"]` was assigned a task in a project with
a private GitHub repository workspace, workspace preparation failed
before the agent started with `remote_workspace_prepare_failed:
stage=clone git=auth_failed exit=128 program=git`.

**Expected behavior**
When a `low_trust_review` run has `git.read` enabled and targets a
project explicitly listed in `trustBoundary.projectIds`, the trusted
controller should clone that project's configured repository during
`workspace_prepare` using transient credentials (preferring an
agent-installed GitHub PAT connection if configured, otherwise the run's
managed GitHub identity), while leaving zero credentials in
`.git/config` and keeping runtime GitHub credential export strictly
denied.

**Steps to reproduce**
1. Create a project with a private GitHub repository workspace.
2. Configure an agent with `trustPreset: "low_trust_review"`,
`projectIds: [projectId]`, and `allowedToolClasses: ["git.read"]`.
3. Run a task in that project on a cloud sandbox environment.
4. Before this fix, `createGitRemoteAuthProvider` falls back to
anonymous clone and fails at `stage=clone git=auth_failed exit=128`.

**Paperclip version or commit**
`master` (`23ca89e376`)

## What Changed

- **`server/src/services/github-operation-credentials.ts`**: Added
`resolveGitHubWorkspacePrepareCredentials`,
`allowsLowTrustWorkspacePrepareCheckout`, and
`resolveAgentInstalledGitHubPat`. For `low_trust_review` runs, transient
prepare-time clone auth is permitted only when `trust.kind ===
"low_trust_review"`, `git.read` is in `allowedToolClasses`, the task's
project is explicitly in `trustBoundary.projectIds`, and `remoteUrl`
matches a configured `project_workspaces.repo_url` on that project.
Prefers an active agent-installed GitHub `api_key` (PAT) connection when
present and otherwise falls back to `resolveManagedGitHubCredential`.
Runtime `resolveGitHubOperationCredentials` remains unchanged and
strictly denied for low-trust runs.
- **`server/src/services/git-credentials.ts`**: Added optional
`purpose?: "workspace_prepare"` to `createGitRemoteAuthProvider` so only
controller workspace-preparation call sites invoke
`resolveGitHubWorkspacePrepareCredentials`.
- **`server/src/services/heartbeat/workspace-preparation.ts`** and
**`server/src/services/heartbeat/workspaces.ts`**: Passed `purpose:
"workspace_prepare"` at the four controller workspace-preparation call
sites.
- **`server/src/__tests__/github-operation-credentials.test.ts`**: Added
unit, security-boundary, and end-to-end
`prepareRemoteWorkspaceDirectory` tests covering managed identity
prepare checkout, agent-installed GitHub PAT preference, runtime
credential denial, unrelated repo denial, missing `git.read` denial, and
zero credentials persisted in `.git/config`.

## Verification

- `pnpm --filter @paperclipai/server typecheck` — passed with 0 errors.
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/github-operation-credentials.test.ts` — 30/30 passed
(including the 3 new low-trust `workspace_prepare` and local E2E
`prepareRemoteWorkspaceDirectory` tests).

## Risks

- Low risk. Runtime agent credential endpoints
(`/runtime-tools/github/credentials`, native GitHub broker, skill-source
fetch) continue calling `resolveGitHubOperationCredentials` and stay
strictly denied for `low_trust_review`.
- Prepare-time credentials are scoped strictly to repositories already
configured in `project_workspaces` for a project explicitly inside
`trustBoundary.projectIds` and only when `git.read` is enabled.

## Model Used

- Google Gemini (Antigravity agentic coding assistant) with tool use and
local code/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
- [ ] 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
canary/v2026.1203.0-canary.884800
2026-12-03 15:41:55 -06:00
Tonio 23ca89e376 Link agent names in the chat sidebar to their overviews (#23650)
## Thinking Path

> - Paperclip lets people manage agents.
> - The chat sidebar lists agents with conversations.
> - Each row opens a conversation.
> - The agent name gives readers a natural place to open the agent
overview.
> - Separate links let users choose either destination with a mouse or
keyboard.

## Linked Issues or Issue Description

**Subsystem affected**
Chat sidebar navigation.

**Current behavior**
Selecting an agent name opens the conversation.

**Proposed behavior**
Selecting the name opens that agent's overview. Selecting the avatar or
role opens the chat.

## What Changed

Added a company-scoped overview link on the name and kept a separate
chat link across the row.

## Verification

The sidebar compiled with esbuild. The diff whitespace check passed. To
verify in the app, click the name, return to the list, then click the
role. Check both links with Tab and Enter.

## Risks

Users who previously clicked the name to open chat will now reach the
overview.

## Model Used

OpenAI Codex, GPT-6, with shell tools.

## Checklist

- [ ] I have included a thinking path that traces from project context
to this change
- [ ] I have specified the model used (with version and capability
details)
- [ ] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [ ] I have searched GitHub for duplicate or related PRs and linked
them above
- [ ] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [ ] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass
- [ ] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [ ] 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
canary/v2026.1203.0-canary.884701
2026-12-03 12:13:14 -08:00
Dotta 0208bbfbf7 fix(runner): compact Antigravity MCP tool descriptions and nullable/pattern schemas (#23645)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Paperclip Runner exposes Paperclip semantic tools and lifecycle
tools (`paperclip_finish`, `paperclip_block`) to the Antigravity CLI
(`agy` 1.5.19) over a loopback MCP bridge.
> - Follow-up to #23620: real-binary reproduction with `agy` 1.5.19
against a full server catalog (85-91 tools including
`runner-bridge-tools`) shows that `agy` budgets full
`functionDeclarations` (name + description + inputSchema) at roughly 90
KB serialized (~60 KB raw MCP JSON).
> - With only `inputSchema` metadata stripped, uncompacted
multi-sentence tool `description` fields still consume ~26 KB and
`pattern`/`format`/nullable unions add ~7 KB, pushing 91 tools to 65.5
KB raw and causing `agy` to drop `handoff_case` and `paperclip_finish`
(and `set_task_monitor` / `call_api` when additional tools are present).
> - This pull request compacts top-level tool descriptions (first
sentence / 120 chars), strips `format` and `pattern`, and collapses
nullable `anyOf`/`oneOf`/`type` unions in `tools/list` when
`compactToolSchemas` is enabled for Antigravity, while keeping full
original Ajv validation on `tools/call`.
> - The benefit is that all 110/110 tools (including `paperclip_finish`,
`paperclip_block`, `set_task_monitor`, `call_api`, and `handoff_case`)
fit comfortably within `agy` 1.5.19's declaration budget.

## Linked Issues or Issue Description

- Refs #23620

## What Changed

- `packages/paperclip-runner/src/drivers/re2-schema-patterns.ts`:
- Added `compactToolDescription(description, maxLength = 120)` to trim
top-level MCP tool descriptions to their first sentence (or <= 120
chars).
- Extended `compactToolInputSchema` to drop `format` and `pattern`
keywords and collapse nullable `anyOf`/`oneOf` (`[T, { type: "null" }]`
-> `T`) and `type: [T, "null"]` -> `T`, while preserving property names,
literal `enum`/`const` values, types, and `required` lists.
- `packages/paperclip-runner/src/drivers/runner-tool-bridge.ts`:
- Applied `compactToolDescription` alongside `compactToolInputSchema` to
all `tools/list` entries (including `paperclip_finish` and
`paperclip_block`) when `compactToolSchemas: true`.
  - Original full Ajv validators remain untouched for `tools/call`.
- `packages/paperclip-runner/src/drivers/re2-schema-patterns.test.ts`:
- Tightened the catalog budget regression test (`totalSchemaBytes <
25_000`, `totalDeclarationBytes < 35_000`, every description <= 120
chars, `paperclip_finish` / `paperclip_block` < 3,000 bytes).
- Added regression assertions that `tools/call` still enforces stripped
`pattern` rules (`read_document` rejecting `"notes.md"`),
`re2PortableSchema` rewrites patterns inside properties named
`enum`/`const`, and `compactToolDescription` / nullable union collapsing
work as expected.

## Verification

- `pnpm --dir packages/paperclip-runner exec vitest run
src/drivers/re2-schema-patterns.test.ts
src/drivers/runner-tool-bridge.test.ts
src/drivers/acpx/antigravity-acp-runtime.test.ts` — 59/59 tests pass.
- `pnpm --dir packages/paperclip-runner exec tsc -p tsconfig.json
--noEmit` — passes.
- `pnpm --dir packages/paperclip-runner exec tsc -p tsconfig.test.json
--noEmit` — passes.
- Real pinned `agy` 1.5.19 binary probe against a local mock Gemini API
with 110 tools (full 64 semantic action catalog + server
`runnerBridgeDefinitions` + 31 realistic extra tools +
`paperclip_finish` + `paperclip_block`): **110/110 tools kept**
(`keptDeclBytes: 85,286`; `paperclip_finish`, `paperclip_block`,
`set_task_monitor`, `call_api`, and `handoff_case` all present).

## Risks

- Low risk. Compaction applies only to `tools/list` when
`compactToolSchemas: true` (Antigravity sessions only). All `tools/call`
requests continue to validate against the original full Ajv schema and
return plain-English schema rule diagnostics on rejection.

## Model Used

- Google Gemini (Antigravity agent with tool use, shell execution, and
real `agy` 1.5.19 binary verification).

## 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
- [x] I will address all Greptile and reviewer comments before
requesting merge
canary/v2026.1203.0-canary.884600
2026-12-03 12:15:11 -06:00
Nicky LeachandClaude Opus 5.5 230fc431ba fix(runner): queue a startup that timed out again instead of blocking its task (#23636)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - A run in a sandbox must start its Runner before a deadline
> - A startup that passes the deadline is cancelled, and its sandbox
task is stopped
> - The cancelled run then has no successor, so the server blocks the
task
> - The answers and messages that wait behind the run stay held until a
person acts
> - The agent did no work, so nothing needs a person
> - This pull request queues the same wake again when the evidence shows
that no work started
> - The benefit is that a slow startup delays a task but does not block
it

## Linked Issues or Issue Description

No issue exists.

**What happened?**

A user answered an agent's question. The new run passed its startup
deadline. The server stopped the sandbox task and confirmed the stop.
The server then set the task to blocked, and the answer was not
delivered.

**Expected behavior**

The server starts the run again with the same answer. It continues the
saved session if that is safe.

**Steps to reproduce**

1. Use an agent whose environment provider runs Runner tasks.
2. Start a run on a task.
3. Make the startup pass its deadline before the Runner connects.
4. Wait for the server to confirm the stop.
5. See that the task is blocked and that a new message stays held.

**Paperclip version or commit**

`dc16c47362`

**Deployment mode**

Self-hosted server with a sandbox environment plugin.

## What Changed

- The server queues the same wake again after it confirms the stop of a
startup that timed out. The new run keeps the wake reason, the comments
and the answer.
- The server does this only with all of this evidence:
  - The startup deadline is the only cause of the cancellation.
  - The provider confirmed that the task stopped.
- No process request, session, turn, Runner checkpoint or result exists.
  - No workspace recovery or file copy is open.
- The new run uses the existing retry limits for an interrupted
preparation.
- The server queues the new run before it acknowledges the cleanup. The
new run cannot start until the cleanup is acknowledged. Held messages
stay in order behind it.
- The new run continues the saved session when the stopped task still
holds the session state of an earlier run. Otherwise, it starts a new
session.
- If the server stops between these steps, the next cleanup pass
completes them. It queues one run only.
- If any evidence is missing, or the server cannot queue the run, the
task is blocked as before.
- A Stop by a person, a pause, a budget or a reassignment does not
change.

## Verification

- `npx vitest run
src/services/native-runtime/native-startup-requeue.test.ts`: 46 passed.
These tests use embedded Postgres. They test the full cancellation, the
two server-stop points, 24 refusals, the session state transfer, and
which run the next run resumes.
- `npx vitest run` on the 14 test files that use the changed modules:
2146 passed, 7 skipped, 1 failed. The failed test is `archives a damaged
prior epoch before completing guarded same-task replacement with real
runnerd`. It also fails at `dc16c47362` on the same computer, without
this change.
- `npx vitest run` on the retry scheduling and early Stop tests: 79
passed.
- `npx tsc --noEmit` in `server` has no errors.
- Not done: a live test of this change. CI runs the Runner integration
suites.

## Risks

- A wrong decision could run work twice. The server refuses when any
saved record shows provider work, and the resume path checks the same
records again.
- A startup that always times out now retries. The existing limit and
backoff apply. After the last retry, the task is blocked as before.
- The new run uses another sandbox start. Budget checks and retry counts
apply to it as to other retries.
- A task that is already blocked by this problem does not change. A
person must retry it or send a message.
- No migration.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with
extended thinking, tool use and code 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1203.0-canary.884500
2026-12-03 09:34:26 -08:00
Dotta bba20403ba fix(cloud-trial): do not attach Connect OpenRouter repair card on starter-trial auth failures (#23633)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - When a normal agent fails with a provider authentication error,
`connectionIntentService.requestForRunAuthFailure` infers the AI
provider from the agent's model and attaches a pending `"Connect
<Provider>"` interaction card on the issue thread.
> - Cloud starter-inference agents (`runtimeConfig.cloudTrialInference:
true`, no saved `aiConnection`) run OpenCode with
`openrouter/openai/gpt-6-luna` through Paperclip Cloud's server-side
proxy instead of a user-saved OpenRouter connection.
> - If a starter-inference run ever encounters an OpenRouter 401
failure, `requestForRunAuthFailure` attached a pending `"Connect
OpenRouter"` card, causing the agent to keep nagging the user to respond
to that card on subsequent turns even after succeeding.
> - This pull request skips `requestForRunAuthFailure` for agents using
Cloud starter inference without a saved `aiConnection`, leaving
`CloudTrialGate` as the single owner of prompting users to connect a
model provider.
> - The benefit is that starter-inference chats never accumulate stale
`"Connect OpenRouter"` cards.

## Linked Issues or Issue Description

Refs #23401, #23616

**Summary**
Skip creating a `"Connect OpenRouter"` `connection_intent` card in
`requestForRunAuthFailure` when the agent runs on Cloud starter
inference (`runtimeConfig.cloudTrialInference: true` without a saved
`aiConnection`).

**Steps to Reproduce**
1. Run an OpenCode agent configured with
`runtimeConfig.cloudTrialInference: true` and `adapterConfig.model:
"openrouter/openai/gpt-6-luna"` (no `runtimeConfig.aiConnection`).
2. Trigger an OpenRouter HTTP 401 authentication failure on a run.
3. Observe `requestForRunAuthFailure` creating a pending `"Connect
OpenRouter"` `issue_thread_interactions` row on the chat issue.

**Expected Behavior**
`requestForRunAuthFailure` returns `null` and creates no pending
`"Connect OpenRouter"` interaction for Cloud starter-inference agents.

## What Changed

- `server/src/services/connection-intents.ts`: Returned `null` in
`requestForRunAuthFailure` when `!saved && !router &&
isAgentUsingCloudTrialInference(agent.runtimeConfig)`.
- `server/src/__tests__/connection-intents-service.test.ts`: Added a
regression test proving that an OpenRouter 401 failure on a Cloud
starter-trial agent returns `null` and creates zero
`issue_thread_interactions` rows.

## Verification

- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/connection-intents-service.test.ts -t "does not create a
Connect OpenRouter card|adopts a Copilot account"` — passed (2/2 tests).
- `pnpm --filter @paperclipai/server typecheck` — passed (0 errors).

## Risks

- Low risk. Narrow 1-line guard scoped strictly to agents with
`runtimeConfig.cloudTrialInference === true` and no saved
`aiConnection`. Normal agents with or without saved AI connections keep
their exact existing auth-repair behavior.

## Model Used

- Google Gemini (Antigravity agentic runtime, thinking mode with tool
use and local code 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
- [ ] 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
canary/v2026.1203.0-canary.884400
2026-12-03 10:18:04 -06:00
Nicky LeachandClaude Opus 5.5 63d3354be7 fix(runner): keep the session of a stopped run (#23543)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The conversation an agent has on a task is called a session. Each
task saves a pointer to its session (the session link), and the next run
uses it to continue the conversation
> - A run's own record keeps its session id. The task gets its pointer
to that session only when the run's result is accepted
> - A stopped run has no accepted result, so it saves no pointer. If a
task's first run is stopped, the task has no pointer. The next run
starts a new session and the agent has forgotten the first run
> - A later run can also start a new session, for example after an
assignment, a retry or a configuration change. If that run is stopped,
the pointer still names the older session. The next message goes back to
the older session or starts another one
> - Saving the pointer on every stop would be unsafe. The agent's turn
might still be open, a request might still be waiting, or the provider
might not have kept the session
> - This pull request copies the session id from a stopped run to the
task only when the records show that the stop was acknowledged, the turn
started and then ended with nothing waiting, the provider kept the
session, and no newer run has taken over the task. Otherwise, the
pointer does not change
> - The benefit is that someone can stop a run, send a correction, and
continue the same conversation

## Linked Issues or Issue Description

No issue exists.

**What happened?**

A user stopped the first run of a task. The user then sent a message.
The agent started a new session and did not remember the first run. The
same loss happens when a user stops a later run that started a new
session.

**Expected behavior**

The agent continues the session of the stopped run.

**Steps to reproduce**

1. Use an agent whose environment provider runs Runner tasks and keeps
their session state.
2. Create a task and wait for the first run to start a turn.
3. Stop the run during the turn.
4. Send a message on the task.
5. See that the new run has a new session.

**Paperclip version or commit**

`4db307d53c`

**Deployment mode**

Self-hosted server with a sandbox environment plugin.

## What Changed

- A stopped run now links its session after its environment lease is
released.
- The link needs all of this evidence:
  - The Stop was delivered and acknowledged.
- The provider accepted a turn. The next prompt leaves out messages that
the linked run received, so a run whose turn did not start cannot be
linked.
  - The turn ended. No request, background work or goal is waiting.
  - The controller journal is settled.
- The provider reports that the task stopped and that it kept the
session state.
  - No newer run, reset or conversation owns the task.
- An existing link is replaced only if its run belongs to the same task
and agent and finished before the stopped run started. Accepted results
already use this rule. Both paths now share one function.
- If any evidence is missing, the link does not change, as before.
- If the provider later confirms that the kept state is gone, the next
run starts a new session. The acknowledged Stop replaces the committed
result in that proof. All other checks in that proof still apply.

## Verification

- `npx vitest run` on the publication tests for stopped runs, the
publication tests for accepted results, the runtime execution tests and
the terminal state reader test: 121 passed. The executor tests ran on an
earlier commit, and the executor code has not changed since.
- The publication tests use embedded Postgres. They test six saves and
37 refusals. Each refusal checks that the task session row did not
change.
- The executor tests check that a stopped run retires after a confirmed
state loss. They also check that an unacknowledged Stop and a different
failure stay refused.
- `npx tsc --noEmit` in `server` has no errors.
- Saved evidence from two real first-run stops during a turn shows ended
turns with no request waiting. The first has a released lease with kept
session state. The second failed its lease cleanup, so this change still
refuses it.
- Saved evidence from two real later-run stops: one kept its session,
and the next run resumed it. The other kept no session and had no
settled turn, and the next run failed. This change refuses to link the
second.
- Two of 104 real stops with a cancelled terminal had no accepted turn.
The turn check refuses them.
- Not done: a live test of this change. CI runs the Runner integration
suites.

## Risks

- A wrong link could resume an unsafe session. The link uses the same
evidence that the resume path checks again, so the resume path still
refuses an unsettled session.
- A link that turns out to be unusable now replaces an older link
instead of no link. The next run then usually fails, and the run after
it usually starts a new session, as it does for an unusable link from a
finished run.
- The change applies only to providers that run Runner tasks and report
kept session state. Local Runners and other sandboxes have no equal
evidence, so they keep the previous behavior.
- A stop while the agent waits for background work is not covered. The
Runner holds its terminal event in that state, so the evidence is
missing.
- The saved link keeps that run's Runner checkpoint, as any other link
does.
- No migration.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with
extended thinking, tool use and code 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 08:17:44 -08:00
Nicky LeachandClaude Opus 5.5 dc16c47362 refactor(runner): remove the unused plugin task source recovery path (#23590)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - An agent run uses a Runner task that an environment plugin provides.
When a Runner stops, the next run can need its saved session
> - #19134 and #19196 added one way to do this. The next run claims the
stopped Runner's task, and then starts that task again under its own
control
> - Those pull requests added the claim and its checks. They did not add
a caller. #19157 was to add the caller, and it did not merge
> - Nothing on `master` calls the claim. No lease gets the two records
that the claim writes, so every check of those records does nothing
> - The unused path still looks active. A reader can change it, and can
think that the change fixes a failure
> - This pull request removes the claim and all code that only reads its
records
> - The benefit is that the code shows only the recovery paths that can
run

## Linked Issues or Issue Description

Refs #19134, #19196 (added the path), #19157 (closed draft that called
it).

**Issue type**

Dead code

**What happened?**

`claimPluginTaskSourceRecovery` has no caller on `master`. Only the
claim writes `runnerTaskSourceConsumer` and `runnerTaskSourceRecovery`
to a lease. Six other server files read those records.

**Expected behavior**

The server contains only recovery code that can run.

**Steps to reproduce**

1. Run `git grep claimPluginTaskSourceRecovery master -- server`.
2. See only the definition.
3. Run `git log -G claimPluginTaskSourceRecovery master`.
4. See that the commits added the path, and later removed its tests. No
commit added a caller.

## What Changed

- Removed the source recovery claim and its checks
(`plugin-task-source-recovery.ts`).
- Removed the special handling of a claimed source from plugin task
dispatch, task resume, checkpoint writes, task ownership, and retained
and warm sandbox expiry.
- A Runner task owner no longer takes `codexSourceRecoveryVersion`.
Nothing set it, so the owner always refused to prepare a predecessor's
launch. It still refuses.
- The checkpoint writer still locks both runs, and still refuses a late
write from a session that moved to another task.
- The plugin SDK still accepts `codexSourceRecoveryVersion` and
`acpxSourceRecoveryVersion`, so a plugin that sends them does not fail.
The guide now says that Core does not use them.
- The Runner package does not change.

## Verification

- `npx vitest run` on eight test files for the changed code: 319 tests
pass.
- `npx tsc --noEmit` in `server` has no errors.
- The test of a late write to a retired checkpoint used the removed
records. It now uses the records of a session that moved to another
task.
- Not run locally: the suites that start a real Runner. CI runs them.

## Risks

- No production code wrote these records, so no saved lease should
contain them. A lease that does contain them is no longer held by them.
- #19157 depended on this path. It is closed and did not merge.
- No migration. No change to the plugin or Runner protocol.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code, with
extended thinking, tool use and code 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 07:43:49 -08:00
Nicky LeachandClaude Opus 5.5 0134081be8 fix(native): resume a saved session whatever the task status (#23533)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - A native agent keeps a warm session between the turns of a task
> - After the warm session leaves memory, the server recovers it from
saved state
> - That recovery required the task status to be `in_progress`
> - Some runs start on a task that is not `in_progress`, by design
> - Those runs lost their session, although the saved session was intact
> - Run dispatch already decides which tasks a run may start on
> - This pull request removes the status check from recovery
> - The benefit is that a comment on a task in review continues the same
conversation

## Linked Issues or Issue Description

Refs #16451 (added this recovery), #21001 (separated the two kinds of
refusal).

**What happened?**

A task was in review. The warm session was no longer in memory. A
comment started a run. The run failed with `native_session_interrupted`
and `warm_recovery_refused=current_run_not_admitted`. The task then
continued in a fresh session.

A comment soon after the previous run did resume the session. That path
uses the session in memory and does not read the task status.

**Expected behavior**

The run must resume the saved session. Automatic checkout leaves a task
in review on purpose. The agent skill tells the agent to check out the
task after it reads the comment. The agent cannot do that before its
session resumes.

**Steps to reproduce**

1. Run a task on a remote environment with a warm session.
2. Let the agent move the task to review.
3. Wait until the warm session leaves memory.
4. Add a comment to the task.

I saw this failure once on a live task. An API call had set that task to
review. The new test shows the cause. I did not repeat steps 1 to 4 on a
task that an agent moved to review.

**Paperclip version or commit**

The check is on `master` at 4db307d53c.

## What Changed

- Warm session recovery no longer checks the task status.
- The status check did not stop the run. It only lost the saved session.
On a closed task the automatic fresh continuation does not apply, so the
run failed.
- The ownership, cancellation, agent and lease checks do not change.
- Automatic checkout does not change.

## Verification

- `npx vitest run
src/services/native-runtime/remote-warm-session-recovery.test.ts` in
`server`: 11 tests pass on an embedded PostgreSQL database.
- The file tests every task status, and each ownership and cancellation
refusal.
- The tests replace only the parser of the saved execution input and the
saved checkpoint. The suite setup reads the same database settings as
the suite gate.
- I ran the same tests against the previous check. The cases for a
status other than `in_progress` failed. The other cases passed.
- `npx tsc --noEmit` in `server` has no errors. CI runs the other test
suites.

## Risks

- A run can now resume on a task whose status changed while the run
started. The path that uses the session in memory already allows this.
- A person who closes a task, and any actor who cancels one, also stops
its run. The run checks then refuse recovery. If an agent marks the task
done while the run starts, the run continues and keeps its session.
- Saved state does not change. A session saved by the previous release
resumes as before, or resumes where it was refused.
- Other failures of the current run can still end in a fresh session.
This pull request does not change that policy.

> 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

- Claude Opus 5.5 (`claude-opus-5-5`) by Anthropic, in Claude Code, with
tool use (shell, file editing, code search) 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
- [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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 07:39:29 -08:00
DottaandPaperclip 477323e4e8 fix(evals): attribute native saved-skill library reads (#23611)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Product E2E tests check that agents use saved skills and save the
correct result.
> - The saved-skill test binds a native source read to an exact skill
version and run.
> - The native library tool can return the complete source through
`paperclip_load_skill`.
> - The test did not recognize this tool result, so it rejected a
successful read.
> - This pull request adds a closed check for that result and preserves
the independent output checks.

## Linked Issues or Issue Description

**What happened?**

The saved-skill journey rejected a successful native OpenCode library
read. Its receipt list was empty. The proxy reports `operation: unknown`
and `readOnly: false` for this tool. Retained event payloads can also
omit null targets.

**Expected behavior**

A complete source read must qualify when the saved skill, immutable
version, source bytes, admitted assignment and native call all agree.
Failed, partial, copied or foreign results must fail.

**Steps to reproduce**

Run the new library-loader test against the old parser. The valid
start/progress/completion case returns no receipt. The test expects one
receipt. The new retained-event case also fails before support for
omitted null targets.

Related public repairs: #22813 fixes assigned-skill name resolution.
[Cloud #1135](https://github.com/paperclipai/paperclip-cloud/pull/1135)
reports ordinary saved-skill assignment. Neither adds this evidence
path.

## What Changed

- Carry the saved skill ID with the selected key and version.
- Accept the native OpenCode library result only with matching IDs, key,
version, full source, SHA-256, byte count and complete single-file
inventory.
- Require the actual run, runner, native session, turn, item and one
ordered start/completion pair. Allow progress events between them. Allow
absent or null targets. Reject a supplied path.
- Share native run admission across the library, OpenCode loader and
Codex paths. Share the two OpenCode loaders' ordered call checks.
- Preserve literal numeric prefixes in verified source text. Remove
display line numbers only from file-reader output.
- Add negative cases and full-flow cases for the source read and
independent output checks. Document the accepted evidence.

## Verification

- Red: the valid library read returned an empty receipt list against the
old parser.
- Red: the retained event shape with omitted null targets failed before
that case was supported.
- Red: six new library and assigned-source cases with literal `1: `,
`2|` and `3→` prefixes fail before the review fix. Native and provider
skill-loader cases also cover these prefixes.
- Green: five focused saved-skill test files pass, with 279 tests.
- Replay of retained private events: the old receipt list is empty; the
fixed parser returns one receipt for the original completed event.
Private data stays out of this PR.
- `pnpm test:e2e:runner:typecheck` passed for the final files. The test
fixture uses mutable row types for its negative cases.
- `pnpm verify` could not select tests because the managed Git storage
guard rejected `git ls-files`. The focused tests ran directly.
- [Required
CI](https://github.com/paperclipai/paperclip/actions/runs/47113067897)
passes on c34ad477. The typecheck, all four runner-support shards,
static checks and all six runner package shards pass. The path selector
skips Build and unrelated suites for this test-only change.
- Greptile, Feynman and Ponytail each give the current head 5/5. All
four prior review threads are resolved.
- After merge, run only `saved-skill-use` in the QA staging workflow.
The original failed run remains failed.

## Risks

The main risk is a false positive from copied or incomplete tool output.
The new path requires a specific built-in tool, exact source identity
and bytes, the admitted version and a unique paired native call.
Existing file-read and Codex checks remain unchanged. Independent
document content, revision author, reload and source-preservation checks
still apply. No runtime behavior, schema, migration or selected test
plan changes.

## Model Used

OpenAI Codex, GPT-6, with reasoning, tool use and code 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-12-03 09:39:05 -06:00
DottaandPaperclip 5f7670739d fix(runner): compact Antigravity MCP tool schemas so lifecycle tools stay within agy budget (#23620)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The Paperclip Runner exposes Paperclip's semantic tools
(`paperclip_finish`, `paperclip_block`, `set_task_monitor`,
`report_progress`, `call_api`, etc.) to Google Antigravity (`agy`
1.5.19) over a loopback HTTP MCP bridge (`startRunnerToolBridge`)
> - `agy` 1.5.19 packs MCP `functionDeclarations` smallest-first under a
~40 KB total schema budget and silently drops tools that exceed it
instead of making them lazy-loaded
> - Because the full Paperclip semantic action catalog plus reserved
lifecycle tools exceeds 61 KB of JSON Schema, `agy` 1.5.19 evicted the
largest tools first — starting with `paperclip_finish` (5.6 KB) and
`paperclip_block` (5.0 KB), and on larger catalogs also `call_api`,
`report_progress`, and `set_task_monitor` — causing ordinary Antigravity
runs to finish work without being able to finalize and fail with
`native_finalization_missing`
> - This pull request adds `compactToolInputSchema()` and a
`compactToolSchemas` option on `startRunnerToolBridge` (enabled for
Antigravity in `AcpxRuntimeHost`) to strip verbose schema-level metadata
from `tools/list` while keeping full original Ajv validation on every
`tools/call`
> - The benefit is that total schema size drops by more than half (~61
KB to ~28 KB), so all Paperclip MCP lifecycle tools stay declared in
`agy` 1.5.19 with full server-side validation intact

## Linked Issues or Issue Description

Refs #23168, #23536

**What happened?**
Ordinary Google Antigravity runs on `agy` 1.5.19 started cleanly and
executed shell/read tools (`get_task_context`, `get_identity`,
`run_command`), but could not call `paperclip_finish`,
`paperclip_block`, `set_task_monitor`, `report_progress`, or `call_api`
because `agy` 1.5.19 silently evicted the largest MCP tool schemas from
`functionDeclarations` once the server's total schema size exceeded its
~40 KB budget. Runs then ended with `native_finalization_missing:
session returned no semantic result`.

**Expected behavior**
All Paperclip MCP lifecycle tools (`paperclip_finish`,
`paperclip_block`, `set_task_monitor`, `report_progress`, `call_api`,
`create_task`, etc.) remain declared in `agy` 1.5.19
`functionDeclarations` even when the full semantic action catalog and
assigned tools are served, while `tools/call` continues enforcing every
original JSON Schema constraint.

**Steps to reproduce**
1. Start `startRunnerToolBridge` with
`PAPERCLIP_SEMANTIC_ACTION_CATALOG` (`schemaPatternDialect: "re2"`
without `compactToolSchemas`).
2. Connect `agy` 1.5.19 `acp` to the bridge via `session/new`
`mcpServers` and inspect the outgoing `functionDeclarations` on
`session/prompt`.
3. Observe `agy` 1.5.19 keeps only 60 of 66 tools and silently drops the
6 largest (`paperclip_finish`, `paperclip_block`, `handoff_case`,
`create_task`, `create_case`, `create_responsibility`).

**Paperclip version or commit**
`master` (after #23168 / #23536)

**Deployment mode**
Self-hosted server

## What Changed

- Add `compactToolInputSchema()` in
`packages/paperclip-runner/src/drivers/re2-schema-patterns.ts` to strip
schema-level metadata (`description`, `title`, `$schema`, `$id`,
`examples`, `default`, `minLength`, `maxLength`, `minItems`, `maxItems`,
`minimum`, `maximum`, and `additionalProperties: false`) while
preserving all property keys inside `properties` / `patternProperties` /
`$defs` / `definitions` (including properties named `description` or
`title`), types, enums, and `required` lists.
- Add `compactToolSchemas?: boolean` to `RunnerToolBridgeOptions` in
`packages/paperclip-runner/src/drivers/runner-tool-bridge.ts`, applied
only to `tools/list` output after compiling the full original Ajv
validators.
- Enable `compactToolSchemas: true` for `options.agent ===
"antigravity"` in
`packages/paperclip-runner/src/drivers/acpx/runtime-host.ts`.
- Add red-green regression tests in
`packages/paperclip-runner/src/drivers/re2-schema-patterns.test.ts` and
`packages/paperclip-runner/src/drivers/acpx/antigravity-acp-runtime.test.ts`.

## Verification

- **Red (before fix)**: New regression test in
`re2-schema-patterns.test.ts` failed with `expected 61366 to be less
than 35000`; real `agy` 1.5.19 binary probe dropped `paperclip_finish`,
`paperclip_block`, `handoff_case`, `create_task`, `create_case`, and
`create_responsibility` (60/66 kept).
- **Green (after fix)**:
- `pnpm --dir packages/paperclip-runner exec vitest run
src/drivers/re2-schema-patterns.test.ts
src/drivers/runner-tool-bridge.test.ts
src/drivers/acpx/antigravity-acp-runtime.test.ts` — **3 files, 58 tests
passed**
- `pnpm --dir packages/paperclip-runner exec tsc -p tsconfig.json
--noEmit && pnpm --dir packages/paperclip-runner exec tsc -p
tsconfig.test.json --noEmit` — **passed**
- Real `agy` 1.5.19 binary probe with 80 tools
(`PAPERCLIP_SEMANTIC_ACTION_CATALOG` + 14 extra tools +
`paperclip_finish` + `paperclip_block`): **80/80 tools kept** in
`functionDeclarations` (including `paperclip_finish`, `paperclip_block`,
`set_task_monitor`, `report_progress`, `call_api`, `create_task`).

## Risks

- Low risk. Scoped strictly to `options.agent === "antigravity"`
(`compactToolSchemas: true`), and every `tools/call` invocation is still
validated against the original uncompacted Ajv schema with
plain-language error messages (`toolInputError`).

## Model Used

- Google Gemini 4 Neon (Medium) via Antigravity agent with tool use and
local code 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
- [ ] All Paperclip CI gates are green
- [ ] 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-12-03 09:25:29 -06:00
Dotta 8e2381a1d1 fix(cloud-trial): use stable HMAC-signed proxy tokens across warm OpenCode sessions (#23616)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Cloud starter-inference OpenCode runs in remote Daytona sandboxes
reuse warm OpenCode sessions across consecutive chat turns.
> - Inside the warm sandbox, `startOpenCodeProviderProxy` stays alive
bound to the first run's `PAPERCLIP_OPENROUTER_PROXY_TOKEN`.
> - Because `cloud-trial-proxy.ts` generated a random per-run token and
deleted it in `cleanup()`, every reused-session turn failed on attempt
#1 with HTTP 401 (`Trial proxy token is no longer active on this server
instance`) and posted `"The OpenCode run failed before it completed."`
into the chat before auto-retry recovered.
> - This pull request replaces single-run random tokens with
deterministic HMAC-SHA256 signed per-`(companyId, agentId,
allowedModel)` tokens (`pctrial_v1.<payload>.<sig>`) that remain valid
across warm turns and stack restarts/sleep-wake, while still failing
closed on tampering, `work_requires_model`, `$1` exhaustion, disallowed
models, and provider migration.
> - The benefit is zero spurious 401 failure messages on consecutive
chat turns in warm starter-inference sessions.

## Linked Issues or Issue Description

Refs #23401, #23559, #23571

**Summary**
Use stable HMAC-signed proxy tokens for Cloud starter-inference OpenCode
sessions so reused warm sessions succeed on attempt #1.

**Steps to Reproduce**
1. Start a Cloud starter-inference (`free_inference_1`) chat with an
OpenCode agent in a warm Daytona sandbox.
2. Send a first message and wait for the reply.
3. Send a second message in the same chat (`sessionReused: true`).
4. Observe HTTP 401 (`Trial proxy token is no longer active on this
server instance`) and `"The OpenCode run failed before it completed."`
before auto-retry starts a fresh process.

**Expected Behavior**
Consecutive messages on a reused warm OpenCode session authenticate
cleanly on attempt #1 with zero 401 failures, while tokens still fail
closed on tampering, `work_requires_model`, `$1` exhaustion, disallowed
models, or migration to a user provider.

## What Changed

- `server/src/services/cloud-trial-proxy.ts`: Replaced single-run random
`pctrial_` tokens with deterministic HMAC-SHA256 signed
`pctrial_v1.<payload>.<sig>` tokens derived from the stack's stable
secret (`PAPERCLIP_CLOUD_CONNECTOR_SIGN_PRIVATE_KEY` /
`PAPERCLIP_CLOUD_TENANT_SERVER_TOKEN` / `PAPERCLIP_AGENT_JWT_SECRET` /
`BETTER_AUTH_SECRET`, with a per-process random fallback). Kept
`cleanup()` probing OpenRouter usage without deleting the token on
normal run exit, and added `revokeCompanyTokens(companyId)`.
- `server/src/services/cloud-trial-inference.ts`: Called
`proxy.revokeCompanyTokens(companyId)` upon `migrateTrialAgents`
completion and exposed `revokeCompanyTokens`.
- `server/src/__tests__/cloud-trial-inference.test.ts`: Added regression
test verifying warm session token reuse after `cleanup()`, survival
across a fresh controller restart, HTTP 401 on tampered tokens, and HTTP
401 after `revokeCompanyTokens`.

## Verification

- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/cloud-trial-inference.test.ts
src/__tests__/cloud-trial-proxy-middleware-order.test.ts` — passed (8/8
tests).
- `pnpm --filter @paperclipai/server typecheck` — passed (0 errors).

## Risks

- Low risk. Tokens are HMAC-SHA256 verified with `timingSafeEqual`,
strictly scoped to `(companyId, agentId, allowedModel)`, never contain
the raw OpenRouter key, and fail closed on `work_requires_model`, `$1`
budget exhaustion, disallowed models, and company migration.

## Model Used

- Google Gemini (Antigravity agentic runtime, thinking mode with tool
use and local code 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
- [ ] 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
2026-12-03 08:54:03 -06:00
ce204a223a fix(ui): tag chunk-load reports with the reload recovery step that gave up (#23613)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The board UI loads each page as a lazy chunk. When a chunk fails to
load, chunk-load recovery reloads the page. It retries while a deploy
settles (#17349, #19361).
> - Safari reported `TypeError: Importing a module script failed.` from
the route error boundary. The build already had the retry logic. So
recovery gave up and the user saw the error page.
> - Recovery can give up for four reasons. The reload did not leave the
page within 10 seconds, the retries were used up, session storage was
blocked, or an earlier reload in this page was abandoned. The report
does not say which one occurred. Breadcrumbs are off for privacy, so the
event has no other clue.
> - This pull request records the recovery decision for each chunk-load
error and sends it as one enum tag.
> - The benefit is that the next report shows which recovery step
failed, so a real fix can target that step.

## Linked Issues or Issue Description

Refs #17349
Refs #19361

**What happened?**
A Safari user got `TypeError: Importing a module script failed.` from
the route error boundary. The page was more than 10 minutes old and had
become visible 10–60 seconds earlier. The build included the chunk-load
retry logic, so recovery gave up. The event does not tell why.

**Expected behavior**
A chunk-load error report states which recovery step gave up, without
URLs or page data.

**Steps to reproduce**
1. Open a lazy route in a build where its chunk can no longer load.
2. Let the reload stall for more than 10 seconds, or use up the retries
in the guard window.
3. Look at the Sentry event. It has no field that tells which case
occurred.

## What Changed

- `chunk-load-recovery.ts`: Record a `ChunkLoadRecoveryOutcome` for each
chunk-load error. The values are `reload_pending`, `reload_abandoned`,
`reload_cancelled`, `retries_exhausted`, `storage_unavailable`, and
`disabled_after_abandon`. Errors that wait on a reload change to
`reload_abandoned` or `reload_cancelled` when that reload ends. Add
`readChunkLoadRecoveryOutcome(error)`. The reload behavior does not
change.
- `sentry.ts`: In `beforeSend`, add the `browser_chunk_reload` tag when
the original exception has a recorded outcome.
- Tests for each outcome and for the tag.

## Verification

- `cd ui && npx vitest run src/lib/chunk-load-recovery.test.ts
src/lib/sentry.test.ts src/components/RouteErrorBoundary.test.tsx
src/components/AppErrorBoundary.test.tsx`: 83 tests pass.
- Red check: the 4 new tests fail on the old implementation and pass
with this change.
- `cd ui && npx tsc --noEmit -p tsconfig.json`: no errors in changed
files. The only errors are the ignored generated Storybook catalog
files, which were not generated locally.
- Note: `sentry.test.ts > initializes with the DSN it receives` can time
out at 5 s on a cold cache. The same flake occurs on unchanged `master`.
- `pnpm verify` did not finish in this environment (no output in 300 s,
also with `--explain`). CI supplies the broad coverage.

## Risks

Low risk. The change only adds one enum tag to Sentry events. It sends
no URL, path, or page data. The outcome map is a `WeakMap`, so it holds
no errors in memory. The reload timing and the guard logic do not
change.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), agentic coding with tool use and
code 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
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1203.0-canary.883700
2026-12-03 06:25:58 -08:00
Tonio 24e095c160 Keep provider navigation visible in Connect account (#23602)
## Thinking Path

> - Paperclip helps people manage AI agents.
> - Agents use provider connections to run tasks.
> - People choose those providers in the Connect account dialog.
> - A selected provider needs a direct path back to the grid.
> - Two cards keep that path visible during sign-in.

## Linked Issues or Issue Description

**Subsystem affected**

Connect account dialog.

**Current behavior**

The grid entry disappears for some providers. A disabled Next button
takes up space during automatic sign-in.

**Proposed behavior**

Show the selected provider and Other Models together. Show a primary
action when the flow requires one.

## What Changed

- Added access to the provider grid from native and custom connection
forms.
- Hid the footer during automatic sign-in and retained explicit
connection actions.

## Verification

- Ran the two AgentProviderConnection test files. All 13 tests passed.

## Risks

- Switching to another provider leaves the current credential draft.

## Model Used

GPT-6 (Codex).
canary/v2026.1203.0-canary.883600
2026-12-03 09:35:02 +00:00
Tonio 741bed6651 Align credential chips and clarify Restart sign-in (#23600)
## Thinking Path

> - Paperclip lets people share provider credentials with selected
agents.
> - Connect account shows those agents as profile chips.
> - The identity chip and disclosure link have different alignment
needs.
> - Give the chips one height and place the disclosure beside the access
summary.
> - Label the sign-in restart action directly.

## Linked Issues or Issue Description

Related PR #23598.

**What happened?**

The identity chip was shorter than the agent chips, and the Change link
moved when the chips wrapped.

**Expected behavior**

Keep chips at 28 pixels. Align Change and Done with the summary. Show
Restart sign-in for the isolated sign-in flow.

**Steps to reproduce**

Open Antigravity under Other Models in Connect account and expand the
access editor.

## What Changed

Move the disclosure to the summary row and align its baseline. Set a
common chip height. Update the restart link and its tests.

## Verification

All 51 focused credential access and sign-in tests passed.

## Risks

Long summaries can wrap on narrow viewports.

## Model Used

OpenAI GPT-6, via Codex.

## Checklist

- [ ] I have included a thinking path that traces from project context
to this change
- [ ] I have specified the model used (with version and capability
details)
- [ ] 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
- [ ] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [ ] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass
- [ ] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [ ] 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
canary/v2026.1203.0-canary.883500
2026-12-03 08:43:39 +00:00
Okan YücelandClaude Opus 5.5 4363be6069 fix(workspaces): resolve issue identifiers on task workspace routes (#20658)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Each task can have a task workspace, and the API lets agents and
board users inspect and change it
> - The routes `GET` and `PUT /api/issues/:id/workspace` and `POST
/api/issues/:id/workspace/repositories` are in their own router
> - The issues router changes an issue identifier (for example `ABC-12`)
to the issue UUID, but that resolver does not apply to this router
> - So these routes send the identifier into a UUID comparison, Postgres
refuses it, and the API returns 500
> - This pull request makes these routes accept an issue identifier, and
return 404 for a value that is not an identifier and not a UUID
> - The benefit is that the workspace routes act like the other issue
routes, and a bad value gives a clear 4xx, not a 500

## Linked Issues or Issue Description

I searched the open and closed issues and pull requests for this
problem. I did not find one. Related issues show the same class of error
on other routes: #20356, #13504, #17332. They do not touch these routes.

**What happened?**

`GET /api/issues/ABC-12/workspace` and `PUT
/api/issues/ABC-12/workspace` return `500 {"error":"Internal server
error"}`. The server log shows `DrizzleQueryError` caused by
`PostgresError: invalid input syntax for type uuid: "ABC-12"`. The same
request with the issue UUID returns 200. Other issue routes, for example
`GET /api/issues/ABC-12` and `GET /api/issues/ABC-12/comments`, accept
the identifier. A value that is not an identifier and not a UUID (for
example `not-a-task`) also returns 500.

**Expected behavior**

The workspace routes accept an issue identifier, as the other issue
routes do. The agent skill reference
(`skills/paperclip/references/issue-workspaces.md`) writes these routes
with `:issueId`, so agents send identifiers. A value that does not
identify an issue returns a 4xx.

**Steps to reproduce**

1. Create an issue. Note its identifier (for example `ABC-12`).
2. Send `GET /api/issues/ABC-12/workspace` as a board user or as an
agent.
3. See `500 Internal server error` and the UUID syntax error in the
server log.
4. Send the same request with the issue UUID. See 200.

**Paperclip version or commit**

Seen on release `2026.1106.0`. The route code is the same on `master` at
`4f33bb357`.

**Deployment mode**

Authenticated, private exposure. Installed from npm. Embedded Postgres.

**Agent adapter(s) involved**

Not adapter-specific (core bug). An agent found it with the Claude Code
adapter.

## What Changed

- `server/src/routes/task-workspaces.ts`: the shared `task()` lookup now
uses `normalizeIssueIdentifier` and `isUuidLike` from
`@paperclipai/shared`. An identifier matches `issues.identifier`. A UUID
matches `issues.id`. Any other value returns `404 Task not found` before
the query.
- The lookup keeps the same read condition (`issueReadSqlCondition`) and
the same access checks. An identifier that the actor cannot read gets
the same 404 as a UUID that the actor cannot read.
- `server/src/__tests__/task-workspace-binding.test.ts`: one new test.
It reads and selects a workspace with the identifier (in lower case for
the read), and checks 404 for `not-a-task` and for an unknown
identifier.
- No documentation change. The skill reference already writes these
routes with `:issueId`.

## Verification

- Red before the fix: `npx vitest run
src/__tests__/task-workspace-binding.test.ts -t "resolves an issue
identifier"` failed with `expected 500 to be 200`.
- Green after the fix: the same command passes.
- The three test files that mount these routes pass:
`task-workspace-binding.test.ts`,
`heartbeat-repository-catalog-recovery.test.ts` and
`workspace-preparation-history.test.ts` (117 tests).
- `pnpm --filter @paperclipai/server typecheck` passes.
- `pnpm verify --base upstream/master` keeps 2,498 test files, because
`server/src/app.ts` imports the route. I stopped the local run after 75
minutes, in the first of its 10 jobs. In that part, four files failed:
`file-resources-git-scan-load`, `git-restore-point-expiration`,
`git-workspace-expiration` and `issue-recovery-assignments`. None of
them imports the changed route or `app.ts`. On the base revision, the
same four files also stall on this machine: a test database connection
stays idle in a transaction, and the cleanup waits for its lock.
- The CI checks on this pull request run the full suite. All checks
pass.
- Manual check on a release `2026.1106.0` instance before the fix:
identifier 500, UUID 200, `not-a-task` 500.

## Risks

- Low risk. The change touches one lookup in one route file.
- A UUID still matches by id, with the same checks. `isUuidLike` accepts
UUID versions 1 to 5. Issue ids come from `gen_random_uuid()` (version
4).
- A value that is not a UUID and not an identifier now returns 404
instead of 500. No client can depend on the old 500.

## Model Used

- Anthropic Claude Opus 5.5 (`claude-opus-5-5`). Capabilities: extended
reasoning, tool use and code execution. The harness does not show 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1203.0-canary.883400 nightly/v2026.1203.0-nightly.0
2026-12-02 23:47:36 -08:00
Tonio 432ca25efa Manage Connect account access with agent profile chips (#23598)
## Thinking Path

> - Paperclip connects provider accounts to agents.
> - The account dialog summarizes agent access.
> - Initials alone make selected agents hard to identify.
> - Agent Overview already shows agent names and avatars together.
> - Reuse those chips and let people edit the selection in place.

## Linked Issues or Issue Description

Related PR #23576.

**What happened?**

The credential summary showed overlapping badges and required opening
Change to edit the selected agents.

**Expected behavior**

Show each selected agent by name. Offer a searchable add control and a
remove control on each editable agent chip.

**Steps to reproduce**

Open Connect account, choose Antigravity under Other Models, and inspect
credential access.

## What Changed

Reuse profile chips and the agent picker. Keep the draft selection in
sync with the expanded access editor.

## Verification

All 36 focused credential selection and provider sign-in tests passed.

## Risks

A large explicit selection wraps across multiple rows. Organization-wide
agent access uses one summary chip.

## Model Used

OpenAI GPT-6, via Codex.

## Checklist

- [ ] I have included a thinking path that traces from project context
to this change
- [ ] I have specified the model used (with version and capability
details)
- [ ] 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
- [ ] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [ ] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass
- [ ] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [ ] 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
2026-12-03 07:11:26 +00:00
3b380c6b15 fix(workspaces): name a saved remote workspace the agent's environment cannot use (#23586)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Paperclip can keep a task's workspace in remote storage. Only a
Paperclip Runner agent in a sandbox environment, or a supported agent in
an SSH environment, can restore and save that workspace.
> - An agent can move to another environment, for example from a sandbox
to a plugin computer. Its tasks keep their saved remote workspaces.
> - When such a task woke, workspace preparation threw a bare 409: "This
workspace requires a supported remote execution environment." The run
ended `setup_failed`. The task offered Retry, and each Retry failed the
same way. Sentry received each refusal as an unexpected run failure.
> - This is a known configuration state that only an owner can repair,
like the project-storage mismatch from #22398.
> - This pull request refuses that run as `configuration_incomplete`
with a named reason, and it tells the owner what to do.
> - The benefit is an actionable task notice, no Retry loop, and no
Sentry noise for this state.

## Linked Issues or Issue Description

Refs #22398 (the same treatment for a source project's storage that the
environment cannot serve).
Refs #23568 (that change gave this refusal its own run-failure group, so
it became visible as a separate error).

**What happened?**

A task's workspace was saved in remote storage by an agent in a Daytona
sandbox. The agent was later moved to a plugin computer environment. An
automatic wake on the task failed setup with "This workspace requires a
supported remote execution environment." The run ended `setup_failed`.
The task notice said to press Retry. Retry cannot help, because the
agent's environment still cannot use the saved workspace. Sentry
received the refusal as an unexpected run failure.

**Expected behavior**

The refusal names the cause: the saved workspace is in remote storage,
and the agent's environment cannot use it. The run fails
`configuration_incomplete`. The task notice tells the owner to assign
the task to an agent that can use the saved workspace, or to change the
agent's environment. Sentry does not receive this known configuration
state. The saved workspace stays unchanged.

**Steps to reproduce**

1. Save a task workspace in remote storage with a Paperclip Runner agent
in a sandbox environment.
2. Change the agent's environment to a plugin computer (or assign the
task to an agent in another environment).
3. Wake the agent on the task. The run fails `setup_failed` with the
bare 409 message.

**Paperclip version or commit**

Seen on hosted staging. The new regression tests fail on `master` at
fc09515c7e and pass with this change.

## What Changed

- `remote-workspaces.ts`: extract
`supportsRemoteWorkspaceExecution(adapterType, driver)`.
`shouldUseRemoteWorkspaces` uses it. Its own behavior is unchanged.
- `workspace-preparation.ts`: when the task's existing workspace has
remote authority and the selected executor cannot use it, preparation
throws `ConfigurationIncompleteFailure` with reason
`remote_workspace_environment_incompatible`. This happens before
workspace resolution and environment acquisition. The payload records
the workspace, environment, driver, adapter, a stable fingerprint, and
the agent runtime action URL. Controller-only runs keep their existing
path.
- `run-failure-report.ts`: the exact pre-dispatch outcome is skipped,
together with `project_storage_environment_incompatible`. A marker after
provider work started, during execution, under another error code, or
outside the setup report is still reported.
`PAPERCLIP_SENTRY_RUN_FAILURES=all` still reports it.
- `stranded-notice.ts` and `recovery/service.ts`: the task notice and
the recovery next action name the owner action. Before this change, the
unknown reason fell back to the "missing secret" text.
- `doc/workspace-storage.md`: describe the new outcome.

## Verification

- Red before the fix, green after (red captured on fc09515c7e with only
the tests applied):
- `server/src/services/heartbeat/workspace-preparation.test.ts` › "names
a remote-storage workspace that the agent's environment cannot use as an
owner configuration gap". Before: the run failed with the bare 409 "This
workspace requires a supported remote execution environment." After:
`configuration_incomplete` with the named reason and payload. The test
also confirms that no workspace is resolved, no environment is acquired,
the saved remote authority is unchanged, and the task keeps its
workspace binding.
-
`server/src/services/__tests__/run-failure-report-remote-workspace-environment.test.ts`
› "keeps a remote workspace the agent's environment cannot use on the
task before dispatch". Before: Sentry received the run.
-
`server/src/services/recovery/stranded-notice-remote-workspace-environment.test.ts`.
Before: the notice said that a secret was missing.
- Safety cases (pass before and after): 11 marker variants are still
reported (other status, `setup_failed`, executing stage, exit code,
signal, no bootstrap marker, provider work started, other reason, no
setup phase, execute phase, `all` mode). The existing remote-workspaces
integration cases "preserves enrolled workspaces after disabling
enrollment and rejects a legacy writer" and "keeps enrollment
conditional…" pass. The full `workspace-preparation.test.ts` (161 tests)
passes, including the sandbox enrollment paths.
- Commands (local, Node 24.23, embedded Postgres):
- `pnpm exec vitest run
src/services/recovery/stranded-notice-remote-workspace-environment.test.ts
src/services/__tests__/run-failure-report-remote-workspace-environment.test.ts
src/services/__tests__/run-failure-report-project-access.test.ts
src/services/heartbeat/workspace-preparation.test.ts
src/__tests__/run-failure-sentry.test.ts` (server)
- `pnpm exec vitest run
src/services/remote-workspaces.integration.test.ts -t "preserves
enrolled workspaces|keeps enrollment conditional"` (server)
- `PAPERCLIP_TYPECHECK_LOW_MEMORY=1 pnpm --filter @paperclipai/server
typecheck` (passed)
- `pnpm verify` selected a broad plan because a doc changed. Required CI
supplies the broad coverage.

## Risks

- Low risk. The new path runs only where `shouldUseRemoteWorkspaces`
already threw. No run that started before can fail now.
- For those refused runs, only the failure code, the message, the
notice, and the Sentry decision change.
- The saved remote workspace and the task's binding are not changed. The
owner still chooses a compatible agent or environment.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code
execution in a sandboxed workspace.

## 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: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1203.0-canary.883200
2026-12-02 22:51:09 -08:00
917a38efd7 fix(server): give the retired task workspace conflict a stable code (#23582)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Before a run starts, Paperclip reserves the task's remote workspace.
It refuses a workspace that is archived or whose cleanup failed, with
the message "Workspace ownership changed.".
> - When setup fails, the server sends a run-failure report to Sentry.
Since #23568, the report groups a setup conflict by the stable code in
its details.
> - This conflict has no code. Its reports use the fallback grouping and
share a Sentry group with other uncoded setup conflicts.
> - This pull request gives the conflict the code
`remote_workspace_retired`.
> - The benefit is a separate Sentry group for runs that fail on a
retired task workspace.

## Linked Issues or Issue Description

**What happened**
A task's execution workspace was archived. Automatic recovery then
started new runs for the task. Each run failed setup with "Workspace
ownership changed.". These reports went into a shared Sentry group with
unrelated setup conflicts, because the conflict had no code.

**Expected behavior**
The conflict has a stable code. Its run-failure reports get their own
Sentry group.

**Steps to reproduce**
1. Reserve a remote task workspace, then set its status to `archived` or
`cleanup_failed`.
2. Reserve the workspace again for a new run.
3. The reservation rejects with a 409 conflict that has no
`details.code`.

**Paperclip version or commit**
master at 8379dedd9.

Refs #23568 (reads `details.code` for run-failure grouping).

## What Changed

- `remote-workspaces.ts`: the "Workspace ownership changed." conflict
now has `details.code` `remote_workspace_retired`. The message and the
409 status do not change.
- `remote-workspaces.integration.test.ts`: a new test reserves an
`archived` and a `cleanup_failed` workspace and expects the conflict
with the new code.
- `run-failure-sentry.test.ts`: the example of an uncoded conflict now
uses another conflict that still has no code.

## Verification

- `cd server && npx vitest run
src/services/remote-workspaces.integration.test.ts -t "stable conflict
code"`: 2 of 2 pass. Without the change to `remote-workspaces.ts`, both
fail.
- `npx vitest run src/services/remote-workspaces.integration.test.ts
src/__tests__/run-failure-sentry.test.ts
src/services/__tests__/run-failure-diagnostics.test.ts`: 301 of 302
pass. The one failure, "cleans saved reads with read-only folders", also
fails on unchanged master in my sandbox (file mode 256 instead of 292).
It is not related to this change.

## Risks

- Low risk. The message, the status and the control flow do not change.
Only the conflict details get a code.
- Expected change: after deploy, Sentry reports for this conflict move
to a new group.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), with tool use and code execution
in a sandbox.

## 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
- [ ] 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1203.0-canary.883100
2026-12-02 22:13:09 -08:00
Michael NguyenandClaude fc09515c7e Emit Cloud chat.started when a chat with an agent starts (#23558)
<!-- claude-projects-attribution: {"github_login":"nguyenm7"} -->

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Paperclip Cloud measures activation with a funnel: account created,
org named, agent named, model connected, chat launched, first agent run
succeeded, first task created
> - `model.connected`, `agent.task_run` and `task.created` come from the
server, but "chat launched" comes only from the browser
(`onboarding_step_completed` with `step=launch`)
> - `task.created` skips chats on purpose, so a person who only chats
with their agent has no server-side step after "first agent run"
> - #23403 added a Cloud-only direct PostHog path
(`trackCloudPostHogEvent`) for onboarding events that must not depend on
the browser
> - This pull request uses that path to emit `chat.started` when the
chat owner's first message or first question-card answer commits
> - The benefit is a server-side "chat started" step that counts a real
action by the person, once per chat, whichever way they reached the chat

## Linked Issues or Issue Description

Refs #23403

**What existing behavior does this improve?**
Server-side activation funnels on Paperclip Cloud.

**Current behavior**
The only "chat launched" signal is the browser `launch` step. Browser
events can be lost (wizard skipped or resumed, navigation, ad blockers
on older builds). On the server, a chat creates an issue but
`emitTaskCreatedAfterCommit` returns early for it, so no event records
that the chat started.

**Proposed behavior**
When the chat owner's first turn commits (their first message, or their
first answer to a question card such as the onboarding welcome card),
the server emits the Cloud-only event `chat.started` with `surface`
(`onboarding_chat` | `agent_chat`) and `agent_id`. Creating or preparing
a chat emits nothing, because onboarding prepares the chat before the
person clicks Launch. The Launch click itself is already relayed
server-side as `onboarding_step_completed` (`step=launch`).

**Reason and benefit**
Funnel steps should come from real product actions that the server
records. With `chat.started`, a funnel can count "chat launched" from
the server and see people who chat but never create a task.

**Breaking changes**
None. The event is new and is Cloud-only.

## What Changed

- `server/src/services/product-telemetry.ts`: add `CHAT_STARTED_EVENT`
and `emitChatStartedIfFirstOwnerTurn`. It runs inside the transaction
that wrote the person's turn and locks the chat's issue row. It checks
that the actor is the chat owner (not an agent, run, or system actor),
and that the owner has no other message and no other answered question
card in the chat. Cancelled or skipped cards do not count. Then it emits
`chat.started` through `trackCloudPostHogEvent` after commit.
- Callers: `addComment` (`issues.ts`), `answerQuestions`
(`issue-thread-interactions.ts`), both headless comment paths
(`headless-comment-group-commit.ts` and the serialized insert in
`routes/headless-channels-schemas.ts`), and the headless one-line
resolve (`headless-events-schedules-interactions.ts`).
- `server/src/__tests__/chat-started-telemetry.test.ts`: unit tests for
the first turn, both surfaces, and every case that must not emit.
- `server/src/__tests__/product-telemetry.test.ts`: embedded-Postgres
tests. Chat creation and system or other-person messages emit nothing.
The owner's first message emits once. A first message after a cancelled
card still emits. A rolled-back first message and a task comment emit
nothing.
- `docs/api/onboarding-telemetry.md`: document the server-emitted
`chat.started` event.

## Verification

- `npx vitest run server/src/__tests__/chat-started-telemetry.test.ts`:
10 passed (helper unit tests).
- `pnpm --filter @paperclipai/server typecheck`: passed.
- The cases in `product-telemetry.test.ts` need embedded Postgres, which
could not start in my environment (it runs as root). CI runs them.

## Risks

- Low. The event is fire-and-forget after commit, inside a `try`. It
does nothing on self-hosted installs, when `PAPERCLIP_POSTHOG_DIRECT=0`,
or when the PostHog environment is not set.
- One event per chat: the check runs under the chat's issue row lock,
and a rolled-back write emits nothing. `/new` in an existing chat does
not emit again.
- Two extra indexed reads run on a person's chat message or answer, and
only on chats.

### Open questions for reviewers

1. **Consent.** Like `model.connected` and the #23403 relay, this server
event is not gated by the browser cookie banner. This PR does not add a
consent check. The only switch is the existing
`PAPERCLIP_POSTHOG_DIRECT=0`. If people who decline cookies must be
excluded from server-side product events, that should be one rule for
all Cloud direct events, not a rule in this PR.
2. **New name or existing name.** This PR adds a new name,
`chat.started`, instead of emitting `onboarding_step_completed`
(`step=launch`) from the server. A new name keeps the browser and server
signals separate, so the two funnels can be compared and the existing
insights do not double count. The other choice is to emit the existing
name with a `source: server` property. Please say which one you prefer.

Not in this PR: "Agent named" has no clean server moment (the setup
agent is saved with a default name before the person names it, and
`agent.created` fires at launch), and `agent.task_run` still does not
say whether a run was a chat reply or a task. That needs a new
registered dimension in the telemetry contract, so it is a follow-up.

## Model Used

Claude Code (Anthropic Claude, agentic coding with tool use and code
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)
- [ ] 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

https://claude.ai/code/session_01KmUZthscGtSrd1KaWnwzWm

---
_Generated by [Claude Code](https://claude.ai/code)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
canary/v2026.1203.0-canary.883000
2026-12-02 20:20:25 -08:00
scotttongandScott Tong 8379dedd93 Pin Plugins by default in workspace navigation (#23578)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - People browse available integrations on the Plugins page.
> - A fresh Coordinator sidebar puts that page inside More.
> - People who look in Settings can miss it.
> - This pull request pins Plugins until a person chooses their own
layout.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

Finding the Plugins catalog on a first visit to the Coordinator
workspace.

**Current behavior**

Open a workspace in a fresh browser profile. The sidebar shows Inbox
followed by More. Open More to find Plugins.

**Proposed behavior**

Show Plugins below Inbox on the first visit. Honor saved pins and their
order, including an empty list.

Related discussion about navigation for individual plugin pages: #21807.

## What Changed

- Use the Plugins route as the default when the signed-in user has no
saved pin list in this browser.
- Add a browser regression for unpinning and re-pinning across reloads.
Update the AgentMail browser journey to use the visible Plugins link.
- Document the default and how to change it.

## Verification

- `pnpm exec vitest run ui/src/hooks/usePinnedNavigation.test.tsx`
passed.
- `pnpm exec playwright test -c tests/e2e/playwright.config.ts
tests/e2e/plugins-browse.spec.ts tests/e2e/agentmail.spec.ts` passed all
four Chromium tests against the built app and a disposable database.
- Compared the parent and feature commits in fresh Chromium sessions.
Confirmed the pin control in More and the unpin and reorder controls on
the pinned row.

## Risks

An existing user who has never saved pins in this browser also receives
the new default. A saved empty list keeps the sidebar empty of pins.

## Model Used

OpenAI GPT-6 (Codex), with repository editing and Chromium 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: Scott Tong <scott@scotts-mbp-m5-max.local>
canary/v2026.1203.0-canary.882900
2026-12-02 18:30:20 -08:00
Tonio a93d971eed Refine Connect account sign-in controls and access badges (#23576)
## Thinking Path

> - Paperclip lets people connect provider accounts to agents.
> - The Connect account dialog shows the sign-in controls and credential
access.
> - A pasted callback requires an additional submit action.
> - The desktop dialog has room for the three controls on one row.
> - Back should return to the provider grid in one step.

## Linked Issues or Issue Description

Related PR #23551.

**What happened?**

The submit control occupied a second row and Back collapsed the selected
provider before returning to the grid.

**Expected behavior**

Keep desktop controls inline, stack them on mobile, and return directly
to the grid.

**Steps to reproduce**

Select Antigravity under Other Models. Inspect the sign-in controls,
then press Back.

## What Changed

Adjust the Antigravity and Grok sign-in marks. Show overlapping
credential access badges. Simplify the submit label and the Back action.

## Verification

All 35 focused AdapterLoginChrome and AgentProviderConnection tests
passed.

## Risks

Narrow viewports use a stacked layout. The available callback controls
depend on the environment.

## Model Used

OpenAI GPT-6, via Codex.

## Checklist

- [ ] I have included a thinking path that traces from project context
to this change
- [ ] I have specified the model used (with version and capability
details)
- [ ] 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
- [ ] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [ ] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass
- [ ] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [ ] 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
2026-12-03 02:25:24 +00:00
paperclipbugbotandClaude Opus 5.5 49165825a0 fix(native): restart an unclaimed continued-session follow-up instead of reattaching (#23434)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Native runs can execute in remote Daytona sandboxes. After a server
restart, restart recovery decides how each interrupted run continues.
> - Recovery can restart an incomplete bootstrap, or it can reattach to
a live remote runner.
> - A continued-session follow-up gets the previous turn's checkpoint
and provider session (`sessionIdBefore`) at admission, before an
executor claims it.
> - The unclaimed-bootstrap check (#20214) refuses every run that has
`sessionIdBefore`. Thus a real follow-up never matches it. Recovery
falls through to the generic fallback and reattaches to a runner that
never started.
> - This pull request lets the unclaimed-bootstrap check accept such a
follow-up when all of its session evidence is inherited.
> - The benefit is that the run restarts cleanly. It does not fail, and
it does not cause the next follow-up to fail.

## Linked Issues or Issue Description

Refs #20214, #20153, #20642, #20979, #20226, #19373

**What happened?**
A hard restart reached a continued-session follow-up on a new Daytona
sandbox before any executor claimed it (coordinator attempt 0,
controller generation 0). Recovery chose `reattach_remote_runner` from
the inherited provider session ID only. The run failed with
`remote_reattach_root_missing`. The next follow-up selected the failed
run as its source and failed with
`native_controller_recovery_unsupported:metadata_format`.

**Steps to reproduce**
1. Admit a continued-session follow-up on a remote sandbox. Admission
sets `sessionIdBefore` and rebinds the previous turn's checkpoint to the
run.
2. Hard-restart the server before an executor claims the run.
3. Restart recovery claims the run with `reattach_remote_runner`,
`providerAttempt: 0`, `controllerGeneration: 1`.

**Expected behavior**
Recovery restarts the bootstrap (`bootstrap_incomplete`, reason
`remote_execution_never_claimed`), as it does for an unclaimed first
run.

**Environment**
Staging, remote Daytona sandboxes, master that includes all of the
linked fixes.

## What Changed

- `native-restart-recovery.ts`: `unclaimedBootstrap` accepts
`sessionIdBefore` when all of these are true:
- `sessionIdBefore` equals the rebound checkpoint's `providerSessionId`.
- The checkpoint is continued-session-only and inherited-only: no
cursor, turns, active turn, result, terminal state, pending requests or
provider events.
- A settled earlier run of the same native session saved that exact
provider session (`carriesSettledPredecessorSession`).
- All other unclaimed-bootstrap guards stay the same: no execution-start
evidence, no own runner identity, prepared remote workspace, preparation
fencing.
- `continuedSessionOnly` and `pendingInheritedRequests` move above
`unclaimedBootstrap`. Their definitions do not change.
- `native-runner-restart-recovery.integration.test.ts`: one new
`it.each` with five cases. The rebound follow-up restarts. A session
with no settled predecessor, a carried active turn, a projected provider
event, and a `sessionIdBefore` that differs from the checkpoint all stay
held.

## Verification

- Red on master: the new `restarts an unclaimed continued-session
follow-up` case received `reattach_remote_runner`, `providerAttempt: 0`,
`controllerGeneration: 1`. These are the same values as the staging
failure.
- Green with this change: `npx vitest run
src/services/native-runtime/native-runner-restart-recovery.integration.test.ts`
(from `server/`) gives 232 passed and 22 skipped. The skipped tests need
`PAPERCLIP_TEST_RUNNER_CONTAINER`, and they skip on master too.
- Also passed locally: `heartbeat/recovery.test.ts`,
`heartbeat/live-runner-adoption.test.ts`,
`native-restart-recovery-isolation.test.ts`,
`native-stop-accounting.integration.test.ts`,
`native-warm-transition-restart.integration.test.ts`,
`native-scheduled-resume-lock.test.ts`,
`native-controller-identity.test.ts`,
`__tests__/heartbeat-native-restart-suspension.test.ts`,
`__tests__/heartbeat-native-early-hand-off.test.ts`.
- Not run locally:
`native-runner-restart-preparation.integration.test.ts`,
`remote-workspace-migration.test.ts`,
`heartbeat/workspace-preparation.test.ts`, typecheck and build. The
local sandbox could not run `git`, and those fixtures need it. CI covers
them.

## Risks

- Low risk. The change only adds one more shape to an existing restart
path. The shape needs a settled predecessor that saved the same provider
session, and the run must have no evidence of its own work.
- If the evidence is incomplete, recovery holds the run as before. It
does not reattach or restart it.

> 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

- Anthropic Claude Opus 5.5 (`claude-opus-5-5`), used as an agent with
tool use and code 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
- [ ] 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 02:23:39 +00:00
c852420baf fix(server): group setup conflicts by their detail code in run-failure reports (#23568)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - When an agent run fails, the server sends a run-failure report to
Sentry. The fingerprint of the report sets the Sentry group.
> - Setup failures without a root error code use a fallback fingerprint:
the exception name and the HTTP status.
> - The `conflict()` helper keeps its stable code in `details.code`. The
diagnostics read only `code` and `reasonCode` on the error. They ignore
`details.code`.
> - Thus every coded 409 setup conflict gets the fingerprint
`exception:Error` + `status:409`. Unrelated causes go into one Sentry
group. For example, an unfinished workspace writer and a missing remote
execution environment share one group.
> - This pull request reads a bounded identifier from `details.code`
when the error has no own code.
> - The benefit is one Sentry group for each setup conflict cause. A fix
for one cause no longer shows as a regression of another cause.

## Linked Issues or Issue Description

**What happened**
One Sentry group receives three different setup failures. They are "The
workspace still has an unfinished writer or save operation.", "This
workspace requires a supported remote execution environment." and
"Workspace ownership changed." Each one has a different cause. The first
two have a stable code in `details.code`
(`remote_workspace_writer_pending` and
`remote_workspace_execution_required`). The run-failure diagnostics do
not read that code, so all three get the same fallback fingerprint.

**Expected behavior**
A setup conflict with a stable code gets a fingerprint with that code.
Different causes go into different Sentry groups.

**Steps to reproduce**
1. Make a run fail setup with `conflict(message, { code:
"remote_workspace_writer_pending" })`.
2. Make another run fail setup with `conflict(message, { code:
"remote_workspace_execution_required" })`.
3. Look at the run-failure fingerprints. Both are `[setup_failed,
<adapter>, setup, exception:Error, status:409]`.

**Paperclip version or commit**
master at 53bebb59f.

Refs #23475, #23446, #22103 (fixes for the unfinished-writer cause; this
change lets Sentry show that cause by itself).

## What Changed

- `run-failure-diagnostics.ts`: when an exception has no `code` and no
`reasonCode`, read `details.code`. Accept it only when it is a lowercase
identifier of 2 to 100 characters (`^[a-z][a-z0-9_]{1,99}$`). Do not
read other fields of `details`.
- An own `code` or `reasonCode` on the error still has priority.
- Tests: a diagnostics test for the accepted and rejected detail values,
and a Sentry capture test that sends real `conflict()` errors through
the diagnostics and checks the fingerprints.

## Verification

- `cd server && npx vitest run
src/services/__tests__/run-failure-diagnostics.test.ts
src/__tests__/run-failure-sentry.test.ts`: 184 of 184 pass.
- Without the change to `run-failure-diagnostics.ts`, the two new tests
fail. The other 182 tests pass.
- All 19 server test files that use run-failure diagnostics or reports
pass (921 passed, 35 skipped).

## Risks

- Low risk. The change affects only Sentry run-failure reports. No other
code reads these exception codes.
- Expected behavior change: setup conflicts with a `details.code` move
from the shared fallback group to new Sentry groups, one for each code.
Uncoded conflicts stay in the fallback group.
- The code value also goes into the `root_error_code` tag and the
`run_exception_N` context. The strict pattern keeps free text and
secrets out.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), with tool use and code execution
in a sandbox.

## 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
- [ ] 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 18:13:08 -08:00
scotttong b0f682b66b Measure when users see a reply to their onboarding chat input (#23574) canary/v2026.1203.0-canary.882500 2026-12-02 18:03:08 -08:00
Devin FoleyandPaperclip 2b65b97cae fix(ui): paginate all task-list views (#23564)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Its task lists help people find and manage work across personal and
organization views.
> - Several personal views stop after 100 tasks, and Blocked stops after
200 tasks.
> - Other lists have page reads but lack a consistent way to load more
or retry a failed page.
> - This pull request makes pagination available across every task-list
view.
> - People can reach older tasks, keep filters active, and retry without
losing readable rows.

## Linked Issues or Issue Description

**What happened?**
Task lists have inconsistent pagination. Mine, Recent, and Unread stop
at the first task batch. Blocked stops at 200 tasks. Everything has the
same missing-page behavior before this PR. Some organization layouts and
searches replace paged rows with separate capped queries.

**Expected behavior**
Every task-list view can load its remaining tasks. A failed later page
keeps loaded tasks visible and offers a retry.

**Steps to reproduce**
1. Use a company and account with more tasks than a view's first batch.
2. Open Mine, Recent, Unread, Everything, or Blocked and scroll to the
bottom.
3. Try to reach older tasks. The affected views stop without a next-page
control.
4. Check organization status views, Archived, search, and board layouts
for consistent loading controls.

**Paperclip version or commit**
The affected code is present at base commit
`53bebb59f907571228dfb85a834a38536f934aa6`.

**Deployment mode**
Observed on hosted staging. Verified locally from source on macOS arm64.

GitHub searches found no duplicate open PR or directly matching issue.

## What Changed

- Apply one task pagination control to personal, organization, status,
archive, classic, and sandbox task lists.
- Make Recent, Unread, and Everything page through touched tasks. Remove
the shared 100-task display cutoff.
- Filter unread tasks on the server before paging.
- Keep Mine's coherent initial snapshot. Fetch older task pages through
the existing authorized list API.
- Add older pages to Blocked. Load Needs attention task details in
batches from its existing task index.
- Let the Tasks route supply paged search and board data to the shared
list components, so separate capped queries cannot replace loaded pages.
- Keep loaded rows visible during later-page loading and errors. Keep
the retry control available when the final attention page fails.
- Pause the classic and streamlined lists' automatic server-page reads
after a later-page error. Keep an explicit retry button available to
restart that page.
- Keep one paging and retry control inside each task-list component for
list and board layouts.
- Reuse the same request filters for the first and later Legacy Inbox
pages.
- Preserve the array cache contract for archive rollback, live updates,
and sharing the first page across tabs.
- Update product documentation and cover the additional views with
regression tests.

## Verification

- Revision: `9275d37c06dc14d00b6759ad71fb6402252db84b`, based on
`origin/master` at `53bebb59f907571228dfb85a834a38536f934aa6`.
- Environment: macOS arm64, Node v25.6.1, pnpm 9.15.4.
- From `ui/`, ran `pnpm exec vitest run
src/components/IssuesList.paging.test.tsx
src/pages/TaskListPagination.test.tsx src/pages/Issues.test.tsx
src/hooks/useInboxTouchedIssues.test.tsx src/lib/inbox.test.ts
src/lib/blockedInbox.test.ts src/lib/inboxArchiveCache.test.ts
src/lib/inboxOrderPin.test.ts src/hooks/useSharedPolling.test.ts
src/hooks/useSharedPollingSnapshot.test.tsx
src/hooks/useTaskListCollection.test.tsx`: all 133 tests passed across
11 files.
- Real IssuesList tests cover both UI modes. They verify that provided
board and search pages stay visible, capped column and search queries do
not run, and each layout has one paging and retry control. Only leaf row
and board rendering are stubbed.
- Real Inbox page tests load later Mine and Recent pages in both UI
modes. They also check Unread's server filter, first-page and later-page
filter agreement, and removal of the control after the last page.
- Page tests cover All tasks, Active, Backlog, Done, Archived, Needs
attention, Blocked, and classic Tasks with server search. Supporting UI
services and row rendering are isolated.
- Red-green regressions proved the old 100-task display cutoff and
automatic retries after a failed page. The fixed lists keep readable
rows and require an explicit retry after failure.
- The work-limit test uses 500 full task fixtures across five pages. A
deterministic counter throws above a linear task-ID read budget. Ten
unchanged rerenders per page perform no collection work.
- Tests also cover page overlap, duplicate observer events, last-page
detection, loading and retry, account and company changes, archive
rollback, live invalidation, and the fallback without
IntersectionObserver.
- Ran `pnpm --dir ui typecheck`: passed.
- Ran `node scripts/check-test-budget.mjs --base origin/master`: passed
for all four changed test files.
- Ran `git diff --check origin/master...HEAD`: passed.
- A prior `pnpm verify` attempt selected 2,319 files and started a broad
server run. It was stopped to avoid duplicating broad CI for this UI
change. That interrupted attempt is not a pass.
- Full local build and browser acceptance of the modified pages were not
run. [Greptile passed with 5/5 on this
revision](https://github.com/paperclipai/paperclip/pull/23564#issuecomment-7362362373).
Both inline review threads are resolved. [CI
typecheck](https://github.com/paperclipai/paperclip/actions/runs/47004999629/job/143907916923)
and
[build](https://github.com/paperclipai/paperclip/actions/runs/47004999629/job/143907916990)
passed. [Both required CI checks passed on this
revision](https://github.com/paperclipai/paperclip/actions/runs/47004999629):
`ci / e2e` and `ci / verify`. No CI checks remain pending or failed.
Confirmation that automated design review has cleared the prior hold is
still pending.

## Risks

- Task updates can move rows between offset pages. The merge removes
duplicate task IDs, and live refreshes update loaded pages.
- Search and task filters cover loaded rows in personal views. Use Load
more tasks to include older rows while filters are active.
- Mine keeps the existing snapshot and access behavior. The change adds
no database migration or public API contract.

## Model Used

OpenAI `gpt-6.1-sol` through the Codex harness, with xhigh reasoning
effort and tool use.

## 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>
canary/v2026.1203.0-canary.882400
2026-12-02 17:28:12 -08:00
Devin FoleyandPaperclip 2a8a0b8e18 fix(ci): retry inconsistent release admission listings (#23572)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Core release workflows admit a source revision before running full
verification.
> - Admission discovers an active image or npm release for that exact
revision.
> - One inconsistent GitHub run listing currently fails admission before
tests start.
> - This pull request rereads count mismatches within a fixed retry
budget.
> - Complete listings and fresh canonical run identity remain required.

## Linked Issues or Issue Description

**What happened?**

[Cloud readiness run
47005873736](https://github.com/paperclipai/paperclip/actions/runs/47005873736)
failed candidate admission with `Incomplete release workflow listing.`
This happened before source tests ran. The [image
workflow](https://github.com/paperclipai/paperclip/actions/runs/47005873889)
then canceled itself because source verification failed. Image consumers
could not advance to that revision.

**Expected behavior**

Admission should allow a short, bounded recovery window for an
inconsistent workflow count. It must reject persistently incomplete or
untrusted evidence.

**Steps to reproduce**

Return a workflow listing whose `total_count` differs from the number of
returned runs. Then return a complete listing for the same query. The
original script fails on the first response. The new regression test
requires admission to wait for complete evidence and revalidate the
selected run.

**Paperclip version or commit**

The reported run used `b066a3ddd39123972d0e7f5f9935c83d41303297`. This
fix starts from `6e340a3f962c60e2723c780389db878ce7ff74c7`.

**Deployment mode**

Canonical GitHub Actions master-push release workflows.

Related changes: #18869 introduced release admission; #22677 added
conditional Actions reads; #22690 added quota-aware read retries. I
searched open and closed PRs and issues for admission and
workflow-listing failures. I found no duplicate fix.

## What Changed

- Allow up to three admission listing reads when valid, bounded counts
disagree with the returned run count. Wait one second, then two seconds.
- Include safe workflow and count details if the mismatch persists.
- Preserve strict listing validation and the fresh canonical run check.
Publication and deferred-producer readers retain their existing
single-read behavior.
- Cover recovery for both release consumers, exhausted retries,
overcounts, undercounts, and a run attempt changing before admission.

## Verification

- The new admission regressions fail against the original
implementation.
- `node --test scripts/cloud-source-verification.test.mjs
scripts/github-actions-rate-limit.test.mjs
scripts/docker-image-metadata.test.mjs
.github/scripts/tests/cloud-readiness.test.mjs` — 81 tests pass on the
changed revision.
- `node --check scripts/cloud-release-admission.mjs` and `git diff
--check` pass.
- `pnpm verify --explain` exits 2 as designed: the changed script is a
global CI input. Broad typecheck, test, build, Runner, and browser
checks must run in CI. This is not a full local-suite pass.
- Reviewed the diff and scanned added lines for credentials, personal
paths, and private URLs before pushing. No findings.
- Greptile reviewed `525694ddc75e7f4c4d1e6c2e00fbc9fd15deadd5` at 5/5.
No review threads or actionable comments remain. All underlying
typecheck, build, unit, Runner, serialized-server, and 16 browser shard
checks passed in [CI run
47008128119](https://github.com/paperclipai/paperclip/actions/runs/47008128119)
on `525694ddc75e7f4c4d1e6c2e00fbc9fd15deadd5`. The final [`ci / verify`
aggregate](https://github.com/paperclipai/paperclip/actions/runs/47008128119/job/143921126471)
also passed. All checks are settled with no failures. GitHub reports the
branch clean and mergeable against current master.

## Risks

Low risk. Admission can spend up to six extra seconds across its two
consumer queries. Malformed metadata, oversized listings, and exhausted
mismatches still fail closed. No source proof or publication gate is
relaxed. No database or deployment configuration changes are required.

The original GitHub response was not retained, so its exact invalid
field remains unknown. The regression tests inject count mismatches; a
later healthy master run establishes recovery, but does not prove the
cause of the earlier response.

## Model Used

OpenAI `gpt-6.1-sol` through Codex in T3 Code, with xhigh reasoning and
shell/tool access. The runtime does not report the context window size.
No subagents were used.

## 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-12-02 17:26:18 -08:00
Devin FoleyandClaude Opus 5.5 0e9d4abcb3 docs(release): canonicalize stable notes for v2026.1202.0 (#23570)
<!-- 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 app people use to manage AI agents for
work.
> - The release process promotes a soaked beta to stable and publishes
the curated notes as the GitHub Release body.
> - After the publish, the notes must be at
`releases/v<stable-version>.md` on `master`. The website changelog and
the next release notes use that path.
> - Stable `v2026.1202.0` was published on 2026-12-03 from beta
`2026.1120.0-beta.0`. It used the candidate branch
`candidate/release-2026.1202.0`: the beta source, test and test-runner
fixes, and the notes file.
> - The notes resolved from the source tree (`notes_mode=source_tree`).
In this mode the workflow skips the `canonicalize_stable_notes` job, so
it pushed no canonicalize branch.
> - This pull request does by hand what that job does. It renames the
beta notes file on `master` to the stable path. It changes no content.
> - The benefit is that `releases/v2026.1202.0.md` exists on `master`
and is byte-identical to the published GitHub Release body.

## Linked Issues or Issue Description

Refs #23550 (the notes fix before publish)
Refs #22247 (the same manual rename for v2026.1117.0)

**Issue type**

Missing content

**Where is the issue?**

`releases/` on `master`. The stable notes for `v2026.1202.0` are only at
the beta path `releases/beta/v2026.1120.0-beta.0.md`. The canonical path
`releases/v2026.1202.0.md` does not exist on `master`.

**What's wrong?**

The GitHub Release
https://github.com/paperclipai/paperclip/releases/tag/v2026.1202.0 is
published. The website changelog sync reads `releases/v2026.1202.0.md`
on `master`. The changelog page for this release cannot appear until
this rename merges.

**Suggested fix**

Rename the beta notes file to the stable path with no content change.
This is the same step that the workflow job does in `master_beta` mode.

## What Changed

- Rename `releases/beta/v2026.1120.0-beta.0.md` to
`releases/v2026.1202.0.md`. GitHub reports a rename with 0 additions and
0 deletions.
- No line of the file changes. The blob is
`40c62079534dfa2fc90709d783053653b9744ed8`. This is the same blob as
`releases/v2026.1202.0.md` at the release source commit
`1ffe1fecb0d2dab06987d89069fe502842f75d9b` (tag `v2026.1202.0`).
- This pull request does not change the release workflow.

## Verification

- The compare API shows one file: `releases/v2026.1202.0.md`, status
`renamed` from `releases/beta/v2026.1120.0-beta.0.md`, 0 additions, 0
deletions.
- The file on this branch has blob
`40c62079534dfa2fc90709d783053653b9744ed8`. The file at tag
`v2026.1202.0` has the same blob.
- The raw `body` field of the `v2026.1202.0` GitHub Release is the same
as the file. The only difference in a `--jq` dump is the trailing
newline that `--jq` adds. v2026.1117.0 shows the same result.
- After merge,
https://github.com/paperclipai/paperclip/blob/master/releases/v2026.1202.0.md
must return 200, and the old beta path must return 404.

## Risks

- Low risk. One markdown file moves, and no content changes.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use (shell,
GitHub API).

## 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
- [ ] I have run tests locally and they pass (documentation only; no
tests apply)
- [ ] I have added or updated tests where applicable (not 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
canary/v2026.1203.0-canary.882200
2026-12-02 17:07:26 -08:00
Devin FoleyandPaperclip 6e340a3f96 Verify onboarding models and explain provider failures (#23563)
Verify deployment-configured model preferences with the selected account.
Preserve structured provider failures and show descriptive messages for known
causes through the existing onboarding error display. Keep the existing failure
buttons, account binding, and retry/sign-in behavior.

Validation: UI typecheck, 38 focused tests, four browser journeys, all applicable
CI checks, and Greptile 5/5 with no unresolved review comments.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
canary/v2026.1203.0-canary.882100
2026-12-02 16:47:58 -08:00
Dotta b066a3ddd3 fix(cloud-trial): mount internal OpenRouter proxy before actorMiddleware (#23571)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Cloud starter-inference OpenCode runs in remote plugin Runners
authenticate to `/api/internal/cloud-inference/v1/*` using an ephemeral
per-run `pctrial_` Bearer token.
> - In `server/src/app.ts`, `/api/internal/cloud-inference` was mounted
after `actorMiddleware`.
> - In authenticated deployments, `actorMiddleware` intercepted every
`Authorization: Bearer pctrial_...` request, tried to verify it as an
agent JWT/API key, and returned HTTP 401 (`Agent token did not verify`)
before the proxy route ever ran.
> - This pull request mounts `/api/internal/cloud-inference` before
`actorMiddleware` (alongside `voiceWebhookRoutes`, which uses the same
pre-`actorMiddleware` pattern) and adds a full `createApp` regression
test in `authenticated` deployment mode.
> - The benefit is that remote Cloud starter-inference OpenCode runs
authenticate cleanly through `/api/internal/cloud-inference/v1/*` and
stream real replies.

## Linked Issues or Issue Description

Refs #23401, #23559

**Summary**
Mount `cloudInferenceInternalProxyRoutes` before `actorMiddleware` in
`server/src/app.ts` so ephemeral `pctrial_` Bearer tokens are not
rejected as invalid agent tokens.

**Steps to Reproduce**
1. Run Paperclip in `authenticated` deployment mode with Cloud starter
inference enabled.
2. Start a starter-inference OpenCode run in a remote plugin Runner
environment.
3. Observe HTTP 401 (`Unauthorized: Agent token did not verify; obtain
fresh credentials and retry`) when OpenCode calls
`/api/internal/cloud-inference/v1/chat/completions`.

**Expected Behavior**
Requests to `/api/internal/cloud-inference/v1/*` reach
`cloudInferenceInternalProxyRoutes`, validate the active per-run
`pctrial_` token, and forward to OpenRouter with the server-held starter
key.

## What Changed

- `server/src/app.ts`: Moved `cloudTrialInferenceController`
initialization and `app.use("/api/internal/cloud-inference",
cloudInferenceInternalProxyRoutes(cloudTrialInferenceController))` above
`app.use(actorMiddleware(...))`, alongside `voiceWebhookRoutes`.
- `server/src/__tests__/cloud-trial-proxy-middleware-order.test.ts`:
Added a full `createApp` regression test (`deploymentMode:
"authenticated"`) verifying that unknown `pctrial_` tokens reach
`cloudInferenceInternalProxyRoutes`
(`proxy_token_not_found_on_instance`) and active `pctrial_` tokens proxy
cleanly to upstream OpenRouter with the server-held key.

## Verification

- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/cloud-trial-proxy-middleware-order.test.ts
src/__tests__/cloud-trial-inference.test.ts` — passed (7/7 tests).
- `pnpm --filter @paperclipai/server typecheck` — passed (0 errors).

## Risks

- Low risk. `/api/internal/cloud-inference` strictly authenticates every
request against active per-run `pctrial_` tokens in memory using
`timingSafeEqual` and rejects all unauthenticated or unknown tokens with
HTTP 401.

## Model Used

- Google Gemini (Antigravity agentic runtime, thinking mode with tool
use and local code 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
- [ ] 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
2026-12-02 18:45:16 -06:00
Nicky LeachandPaperclip cc2e1d9d43 Honor plugin task driver concurrency defaults on hire (#23535)
## Thinking Path

> - Paperclip schedules work for agents.
> - Each agent has a limit on simultaneous runs.
> - A task driver can provide an execution environment with its own
capacity.
> - Previously the creation form sent the same limit for every driver.
> - A driver can now declare the value Core saves when a new agent has
no explicit limit.

## Linked Issues or Issue Description

**Subsystem affected**

Agent hiring and plugin environment drivers.

**Current behavior**

The create form, API, and import flow supply the global concurrency
default before the task driver can provide one.

**Proposed behavior**

Let each task driver declare an optional per-agent concurrency default.
Apply it once during hire and honor explicit agent limits.

## What Changed

- Refreshed the three SDK source pins for the changed files.
- Added the optional driver field `defaultMaxConcurrentRuns` with
integer bounds from 1 through 50.
- Applied it during hire using the resolved task environment. Saved the
resolved runtime configuration in hire approvals.
- Removed early defaults from the creation form, routes and new-agent
imports. Preserved saved limits on export, including explicit values
equal to the global default. Kept the current limit when importing an
update with an omitted limit.

## Verification

- [Full PR
CI](https://github.com/paperclipai/paperclip/actions/runs/47000023360)
passed on `83cce42b9a`. Server shard 16 passed on retry after a
PostgreSQL connection reset on the first attempt.
- `pnpm -r typecheck` passed. The SDK source pin check passed. `pnpm
verify` selected broad CI coverage because the SDK input registry
changed.
- On rebased commit `83cce42b9a`, all 441 tests in six focused Vitest
suites passed, including the MCP rollback test corrected in #23560. The
SDK source pin check passed.

## Risks

This affects new hires on drivers that opt in. Existing agents retain
their saved configuration. Single-run provider limits still apply. An
older client that explicitly sends the global default will keep that
value.

## Model Used

OpenAI GPT-6 via Codex. Used local source inspection, code editing,
TypeScript and 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>
canary/v2026.1203.0-canary.881900
2026-12-02 16:23:42 -08:00
DottaandPaperclip 53bebb59f9 test: keep connection rollback retry drafts unbound (#23560)
Align the rollback retry test with draft resume. Preserve the catalog rollback and public identity checks.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
canary/v2026.1202.0-canary.881801
2026-12-02 22:56:20 +00:00