Files
PaperClipAI/server
DottaandClaude Opus 5.5 1363b557b9 fix(runs): stop retrying a run whose setup is too large to start (#22707)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - When a managed run fails, Paperclip classifies the failure to decide
whether to retry it
> - A run whose setup exceeded the runner's durable limits failed with
`durable_prp_canonical_json_too_large`, which was classified as an
interrupted session
> - Paperclip retried it three times and then continued the task in a
fresh session that failed the same way: one agent produced 20 failed
runs in a few minutes, and the task showed a raw internal code
> - This pull request classifies oversized run setups as a permanent
failure with a plain-language action
> - The benefit is no pointless retries, and the user learns what to
change

## Linked Issues or Issue Description

**What happened?**
An agent's run setup was larger than the runner's durable control plane
accepts. Each attempt failed in seconds with
`durable_prp_canonical_json_too_large`. Paperclip scheduled retries and
fresh-session continuations that could never succeed, and the task
showed the raw code.

**Expected behavior**
A failure that the same input will always repeat is not retried. The
user sees what to change.

**Steps to reproduce**
1. Classify `new Error("durable_prp_canonical_json_too_large")` with
`nativeSessionFailureSourceCode`.
2. The disposition is `retryable_failure` with
`native_session_interrupted`.

## What Changed

- New `native-run-payload-too-large.ts`: the
`native_run_payload_too_large` code, its user-facing action, and the
matcher for `durable_prp_canonical_json_too_large` and
`command_payload_too_large`.
- `native-session-executor.ts`: classify those errors as
`native_run_payload_too_large`, treat it as permanent, and show the
action.
- `heartbeat/retries.ts`: do not schedule a retry for it.
- `native-sandbox-disk-full.ts`: a full disk does not relabel this code.
- Tests for classification, disposition and retry scheduling.

## Verification

- `npx vitest run
src/services/native-runtime/native-run-payload-too-large.test.ts
src/__tests__/heartbeat-retry-scheduling.test.ts`: 75 passed.
- Red/green: without the change, 4 of the new assertions fail.
- The underlying size mismatch is fixed separately in
paperclipai/paperclip#22705. This change makes any future deterministic
size failure stop at once instead of looping.

## Risks

- Low. Only these two deterministic size errors change classification.
All other failures keep their existing retry behavior.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), via Claude Code, with 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
- [ ] 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>
2026-11-23 17:27:29 -06:00
..