mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 15:52:36 +01:00
refactor: remove doc/execution-semantics.md and its references (#21699)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Contributors and agents read the docs under `doc/` for background on run execution > - `doc/execution-semantics.md` grew to 6,310 lines of per-PR notes > - It was hard to read and it drifted from the code > - The code and tests are the source of truth for execution behavior > - This pull request removes the file and every reference to it > - The benefit is one less stale document that readers can mistake for a requirement ## Linked Issues or Issue Description **Issue type** Outdated or unclear documentation. **Where is the issue?** `doc/execution-semantics.md`, and the docs, rules, skills, maps, code comments and log text that link to it. **What's wrong?** The file is 6,310 lines of notes added one PR at a time. Much of it repeats or contradicts the code. Readers and agents treat it as a contract, but the code and tests decide the behavior. **Suggested fix** Delete the file. Remove each link to it. Keep the documents that link to it. Point at code where a pointer is still useful. Do not move the content to another doc. Refs #10664 (an open docs PR that edits this file; it becomes obsolete). ## What Changed - Delete `doc/execution-semantics.md`. - Remove links and pointers in `doc/PRODUCT.md`, `doc/LOW-TRUST-PRESETS.md`, `doc/TASK-WATCHDOG.md`, `doc/composer-stop.md`, `doc/native-workspace-finalization-recovery.md`, `doc/run-log-events.md`, `doc/runner-internals.md` and `doc/workspace-repositories.md`. - `doc/TASK-WATCHDOG.md` now points at `server/src/modules/active-run-watchdog/` for the silent active-run watchdog. - Remove the link in `rules/upgrade-safe-run-state.mdc` and `maps/feature-map/recovery.md`. - Update the skills `diagnose-why-work-stopped`, `fix-failed-paperclip-run` and `terminal-bench-loop`. The `fix-failed-paperclip-run` skill now points at `server/src/services/heartbeat/` and `server/src/services/recovery/`. - Remove the file from the source anchors in `.devin/wiki.json`. - Remove the doc name from four code comments in `server/` and `ui/`. - The failed-attachment log message no longer ends with a link to the removed doc. Two tests now check the message text instead of the link. - Leave two dated plan files under `doc/plans/` unchanged. They are history. ## Verification - `git grep -i execution-semantics` finds no hits outside `doc/plans/`. - Every relative Markdown link in the changed files resolves. - `node scripts/check-maps.mjs` passes. - `node --test .github/scripts/tests/*.test.mjs` passes (808 tests). - `pnpm verify` was not run locally. The worktree has no `node_modules`. CI runs the changed Vitest files. ## Risks - Low risk. Most changes are docs and comments. - One runtime log line is shorter. It no longer has a link. No logic changes. - Open PRs that edit the deleted file, such as #10664, will conflict. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and shell access. ## 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>
This commit is contained in:
1 parent
adc3356ad3
commit
11b09b7234
22 files changed
+33
-6374
No files matched your search
@@ -2888,8 +2888,7 @@ export function createHeartbeatRecovery(db: Db, dependencies: HeartbeatRecoveryD
|
||||
const shouldRetry =
|
||||
!await pendingCaseHandoffForRun(db, run.id, run.companyId) &&
|
||||
// Process loss spends the durable failure retry budget that
|
||||
// enqueueProcessLossRetry schedules against (execution-semantics
|
||||
// "Shutdown, process loss, and provider failure"). Checking it here
|
||||
// enqueueProcessLossRetry schedules against. Checking it here
|
||||
// keeps "retrying once" honest and lets an exhausted chain fall
|
||||
// through to the interaction continuation path below.
|
||||
// A conversation run that a restart ended draws on the server-restart
|
||||
|
||||
@@ -716,14 +716,14 @@ describe.skipIf(!support.supported)("heartbeat runtime execution boundary", () =
|
||||
expectCleanup(input);
|
||||
});
|
||||
|
||||
it("logs a pointer to the docs when a same-run retry follows a failed attachment", async () => {
|
||||
it("logs an explanation when a same-run retry follows a failed attachment", async () => {
|
||||
const { input, run } = await fixture(true);
|
||||
await db.update(heartbeatRuns).set({ nativeIssueId: input.task.issueId }).where(eq(heartbeatRuns.id, run.id));
|
||||
await db.insert(nativeRunFinalizations).values({ companyId: run.companyId, issueId: input.task.issueId!, runId: run.id, phase: "retryable_failure" });
|
||||
const error = new Error('native_session_recovery_failed: Error: PRP command run.attach failed: {"result":{"message":"run.attach requires a settled Codex provider session: active_turn"}}');
|
||||
vi.mocked(executePaperclipNativeSession).mockRejectedValueOnce(error);
|
||||
await expect(executeHeartbeatRuntime(db, input)).rejects.toMatchObject({ name: "NativeSessionResumeScheduledError", original: error });
|
||||
expect(input.output.onLog).toHaveBeenCalledWith("stderr", expect.stringContaining("doc/execution-semantics.md#session-settlement-after-a-run"));
|
||||
expect(input.output.onLog).toHaveBeenCalledWith("stderr", expect.stringContaining("A later run may start a new provider thread."));
|
||||
expect(input.output.onLog).toHaveBeenCalledWith("stderr", expect.stringContaining("run.attach requires a settled Codex provider session: active_turn"));
|
||||
expectCleanup(input);
|
||||
});
|
||||
|
||||
@@ -78,11 +78,11 @@ describe("settled remote warm control evidence", () => {
|
||||
.toBe("provider.notice.recorded x2, session.goal.snapshot x1");
|
||||
});
|
||||
|
||||
it("points a failed attachment at the reviewed docs with its real cause", () => {
|
||||
it("explains a failed attachment with its real cause", () => {
|
||||
const stored = 'native_session_recovery_failed: Error: PRP command run.attach failed: {"commandType":"run.attach","result":{"code":"command_execution_failed","message":"run.attach requires a settled Codex provider session: active_turn"},"status":"failed"}';
|
||||
const pointer = describeFailedAttachment(stored);
|
||||
expect(pointer).toContain("run.attach requires a settled Codex provider session: active_turn");
|
||||
expect(pointer).toContain("https://github.com/paperclipai/paperclip/blob/master/doc/execution-semantics.md#session-settlement-after-a-run");
|
||||
expect(pointer).toContain("A later run may start a new provider thread.");
|
||||
expect(describeFailedAttachment("run.attach requires the restored Codex provider process")).toContain("restored Codex provider process");
|
||||
const quoted = `PRP command run.attach failed: ${JSON.stringify({ result: { message: 'run.attach provider is invalid: unknown "value" here' } })}`;
|
||||
expect(describeFailedAttachment(quoted)).toContain('run.attach provider is invalid: unknown "value" here. A later run');
|
||||
|
||||
@@ -157,16 +157,14 @@ export function describeOwnFailedAttachment(recoveryHistory: unknown): string {
|
||||
return `runner_state_identity_mismatch: prior_attach_failed: ${typeof cause === "string" && cause ? cause : "unknown"}`;
|
||||
}
|
||||
|
||||
const SETTLEMENT_DOC = "https://github.com/paperclipai/paperclip/blob/master/doc/execution-semantics.md#session-settlement-after-a-run";
|
||||
|
||||
/** Points whoever diagnoses a failed attachment at reviewed docs. The stored
|
||||
* failure is already redacted and bounded; other failures produce no pointer. */
|
||||
/** Explains a failed attachment to whoever diagnoses it. The stored failure is
|
||||
* already redacted and bounded; other failures produce no explanation. */
|
||||
export function describeFailedAttachment(failureMessage: unknown): string | null {
|
||||
if (typeof failureMessage !== "string" || !/\brun\.attach (failed|requires)\b/.test(failureMessage)) return null;
|
||||
const encoded = /"message":("(?:[^"\\]|\\.)*")/.exec(failureMessage)?.[1];
|
||||
let cause = failureMessage;
|
||||
try { if (encoded) cause = JSON.parse(encoded) as string; } catch { /* Keep the whole failure. */ }
|
||||
return `This run could not attach to its provider session: ${cause}. A later run may start a new provider thread. See ${SETTLEMENT_DOC}`;
|
||||
return `This run could not attach to its provider session: ${cause}. A later run may start a new provider thread.`;
|
||||
}
|
||||
|
||||
type WarmRecoveryRefusal = "identity_incomplete" | "target_not_resumed_sandbox" | "owner_unsettled" | "execution_mismatch"
|
||||
|
||||
@@ -616,7 +616,7 @@ async function checkVisibleNextAction(db: Db, now: Date, limit: number): Promise
|
||||
const page = await db.select({ id: issues.id, companyId: issues.companyId, executionRunId: issues.executionRunId,
|
||||
updatedAt: issues.updatedAt })
|
||||
.from(issues).where(and(eq(issues.status, "in_progress"), isNotNull(issues.assigneeAgentId),
|
||||
// A saved monitor deadline is a first-class wait path (doc/execution-semantics.md §8).
|
||||
// A saved monitor deadline is a first-class wait path.
|
||||
or(isNull(issues.monitorNextCheckAt), lt(issues.monitorNextCheckAt, now)),
|
||||
notExists(db.select({ one: sql`1` }).from(heartbeatRuns).where(and(
|
||||
eq(heartbeatRuns.companyId, issues.companyId), inArray(heartbeatRuns.status, ACTIVE_RUN_STATUSES),
|
||||
|
||||
Reference in new issue
Block a user