## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Paperclip Runner agents can run on plugin task environments that
keep a warm Runner between turns.
> - PR #22973 changed one recovery case. When the plugin confirms that
the prior task stopped and kept no session state, Core now retires the
settled prior owner instead of refusing the follow-up.
> - The follow-up still asked the new Runner to resume the old provider
session. The new Runner has no saved state for it, so the run failed
with `native_session_recovery_failed: ... PRP provider resume state is
unavailable`.
> - A retry reads the same empty state, so the task cannot continue.
Recovery must work without a person.
> - This pull request lets that follow-up replace the provider session
only when the Runner positively proves the saved state is gone. It
continues in a fresh provider session and records a continuity break.
> - The benefit is that the task continues, and Cloud readiness `verify
/ Verify Paperclip Runner (server-integration)` passes again, which
unblocks the Core Docker image and staging deploys.
## Linked Issues or Issue Description
Refs #22973.
**What happened?**
On master, four tests failed on every run in the Cloud readiness
`server-integration` lane: the "missing state" case of
`plugin-runner-eviction-{claude,codex}-{abrupt,retired}.integration.test.ts`
("4 failed | 439 passed"). The follow-up run failed with
`native_session_recovery_failed:
NativeRunnerResumeStateUnavailableError: PRP provider resume state is
unavailable`. A temporary revert of 71d7f86293 (#22973) made the case
pass again.
**Expected behavior**
When the plugin confirms that the prior task stopped and has no session
state, the follow-up run continues. This is the stated intent of #22973
("retires cleanly into `continuity-breaks` so the new run starts
fresh").
**Steps to reproduce**
Run `pnpm --filter @paperclipai/server exec vitest run
src/services/native-runtime/plugin-runner-eviction-codex-abrupt.integration.test.ts
-t "missing state"` on master.
## What Changed
- `server/src/services/native-runtime/native-session-executor.ts`: state
migration now returns a typed result `{ binding, pluginCheckpointRetired
}`. When Core retired the prior owner because the plugin confirmed a
lost checkpoint, the executor passes
`replaceAfterConfirmedProviderStateLoss` to the runtime.
`providerSessionReplaceableAfterStateLoss` keeps this off for a session
with an unfinished goal and for Antigravity while its release is
pending.
- `packages/paperclip-runner/src/native-session-runtime.ts`: with that
option, the runtime replaces the provider session only on the Runner's
positive proof: `PROVIDER_STATE_INCOMPATIBLE` with
`resumeStateUnavailable`, no restart interruption, no active turn, and
no pending runtime request. The governed-wait path now uses the same
proof (`runnerProvedSavedStateGone`). Every other recovery failure keeps
the named refusal. The checkpoint's saved recovery policy is not
changed.
- `server/src/__tests__/helpers/plugin-runner-eviction.ts`: the "missing
state" case encoded the behavior before #22973 (a refusal). It now
expects the follow-up to succeed. It also checks that Core read the
source checkpoint once and got no state, that the prior owner was
retired, and that a provider continuity break was logged. All other
modes keep their assertions.
- New unit cases: the runtime replaces on the positive proof, and
refuses when Core did not confirm, when the Runner did not prove state
loss, for an unclassified failure, with a turn in flight, and with a
pending runtime request. The executor keeps same-session recovery for
unfinished goals and Antigravity.
## Verification
- Red: with only the test change, the codex abrupt "missing state" case
fails with `NativeProviderStateIncompatibleError:
native_session_recovery_failed: NativeRunnerResumeStateUnavailableError:
PRP provider resume state is unavailable`.
- Green: with the fix, all four files pass locally, one file at a time:
codex-abrupt 10/10, codex-retired 11/11, claude-abrupt 10/10,
claude-retired 11/11.
- `native-session-executor.test.ts -t "plugin checkpoint"`: 94 passed
(includes the #22973 unit cases).
- Each new guard was shown red by removing it: dropping the Runner proof
fails 4 runtime refusal cases; dropping the goal check or the
Antigravity check fails the executor guard case.
- `native-session-runtime.test.ts`: 310 passed.
`native-session-executor.test.ts -t "plugin checkpoint|unfinished
goal"`: 95 passed.
- `tsc --noEmit` for `packages/paperclip-runner` and `server`: clean.
## Risks
- Behavior change is limited to one case: the plugin confirmed the task
stopped with no session state, Core retired its settled owner, and the
Runner proved it holds no saved state with nothing in flight. Such a
follow-up now loses the earlier provider conversation context instead of
failing. It records a continuity break in the run log and trace.
Transient or in-flight recovery failures still refuse.
- Sessions with an unfinished goal and Antigravity sessions keep failing
closed, as before.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`), via Claude Code with tool use
(shell, file edits).
## 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>