mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-04 04:29:01 +01:00
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>
This commit is contained in:
1 parent
0134081be8
commit
dc16c47362
12 files changed
+36
-394
No files matched your search
@@ -41,7 +41,6 @@ export function createPluginRunnerTaskOwner(input: {
|
||||
priorIdentity?: DurableRecoveryIdentity;
|
||||
/** Current authenticated lease owner; the restored PRP identity may belong to its predecessor. */
|
||||
authorityRunId?: string;
|
||||
codexSourceRecoveryVersion?: 1;
|
||||
credentialIdentity?: string;
|
||||
accountIdentity?: string;
|
||||
credential?: PluginEnvironmentTaskCredential;
|
||||
@@ -147,10 +146,7 @@ export function createPluginRunnerTaskOwner(input: {
|
||||
return recovery;
|
||||
}
|
||||
const authorityRunId = input.authorityRunId ?? input.executionContext?.execution.binding.runId;
|
||||
const sourceRecovery = !!authorityRunId && requirements.identity.runId !== authorityRunId;
|
||||
if (sourceRecovery && (input.codexSourceRecoveryVersion !== 1 || !input.resumeFrom || !input.priorIdentity || !input.accountIdentity ||
|
||||
input.harness !== "codex" || input.adoptIdentity || Object.entries(input.priorIdentity).some(([key, value]) =>
|
||||
requirements.identity[key as keyof DurableRecoveryIdentity] !== value))) {
|
||||
if (authorityRunId && requirements.identity.runId !== authorityRunId) {
|
||||
throw new Error("Plugin Runner source reconciliation unavailable");
|
||||
}
|
||||
if (input.githubBroker && input.githubCredentialBrokerVersion !== 1) {
|
||||
@@ -161,7 +157,7 @@ export function createPluginRunnerTaskOwner(input: {
|
||||
...(preparationDigest ? { preparationDigest, runDigest: runnerLaunchRunDigest(preparationDigest, requirements) } : {}),
|
||||
...(input.githubBroker ? { githubBroker: input.githubBroker } : {}),
|
||||
projectIds: [...input.projectIds], ...(recovery ? { recovery } : {}),
|
||||
...(input.resumeFrom && (!authorityRunId || !launchIdentity || launchIdentity.runId === authorityRunId || sourceRecovery)
|
||||
...(input.resumeFrom && (!authorityRunId || !launchIdentity || launchIdentity.runId === authorityRunId)
|
||||
? { resumeFrom: input.resumeFrom } : {}),
|
||||
...(input.accountIdentity ? { accountIdentity: input.accountIdentity } : {}),
|
||||
...(launched && preparedIdentity && requirements.identity.runId !== preparedIdentity.runId
|
||||
@@ -468,7 +464,6 @@ export function createPluginRunnerTaskOwner(input: {
|
||||
},
|
||||
get authorityRunId() { return input.authorityRunId ?? input.executionContext?.execution.binding.runId; },
|
||||
get relaunchReleasedRunner() { return launched && input.resumeIdentityVersion === 1 ? input.relaunch?.source : undefined; },
|
||||
get codexSourceRecoveryVersion() { return input.codexSourceRecoveryVersion; },
|
||||
prepareLaunch, authorizeRunnerAdoption, readRunnerState, runnerProcessLauncher: launcher,
|
||||
// The provider resolves the authorized retained task before each state operation.
|
||||
prepareExternalRunnerState: async () => {},
|
||||
|
||||
Reference in new issue
Block a user