mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-16 11:59:26 +01:00
## Thinking Path > - Paperclip lets people manage AI agents and their saved work. > - QA journeys check browser controls and the cleanup of owned agent resources. > - A recovered workspace queues sandbox destruction after its files are saved. > - The cleanup queue treated that first attempt as a retry and waited five minutes. > - Agent termination correctly waited for destruction, so QA cleanup failed first. > - This PR runs that first cleanup attempt promptly and keeps the existing safety gates. > - It also waits for task-panel transitions before the browser acts again. ## Linked Issues or Issue Description **What happened?** The full scheduled QA smoke completed with 23 passed and 1 failed. Stop/redirect passed all eleven behavior checks but failed cleanup. The cancelled run had a saved workspace and a bound stop receipt before agent termination. Its sandbox was destroyed about five minutes later. The shared cleanup schedule applied the retry delay before the first destruction attempt. The browser regressions also found that the current panel helper can consume all four actions while an opener remains visible during panel mounting. **Expected behavior** A recovered workspace's first cleanup attempt runs on the next eligible worker pass. A failed attempt retains normal backoff. Agent termination still waits for completed resource cleanup. Task-panel navigation waits for the next controls before it acts again. **Steps to reproduce** 1. Queue recovered-workspace destruction after the cleanup worker has become idle. 2. Read the next cleanup deadline and advance one normal worker pass. Before this fix, the deadline is five minutes late and no teardown runs. 3. Open task document controls with a delayed side-panel transition. Before the panel fix, both collapsed-panel controls fail. Refs #19224 and #19292 for retaining stop proof during workspace recovery. This change keeps the full cleanup requirement for agent termination. Current master supplies the shared task-panel helper; this branch uses it and retains additional browser regressions. ## What Changed - Use one shared first-attempt predicate for the cleanup deadline, sweep selection and ownership report. It now includes recovered workspace cleanup bound to the same run. - Preserve worker spacing, in-flight claims, ownership and saved-file checks, retry delays and attempt limits. - Wait for panel controls after opening the panel. Wait for the selected tab or menu action to finish. - Add real PostgreSQL cleanup regressions, keep the Chromium controls, and document the cleanup timing. ## Verification Tested on Linux x86_64, Node v25.9.0. Local commit `7c8e0f12aa4b19aaf53669141ab3299ce76db963` and published head `892c5dd4b4638796a138400d8bbe30aee19c71dd` have the same tree, `d135a98bdff58e3320cdc83976ffe1cf47f48b66`. - Red: both new real-PostgreSQL cleanup tests failed on the old code. The deadline was five minutes late and the first normal sweep made zero teardown calls. - Green: 87 cleanup, ownership and lifecycle tests pass. The restored-work case stays unconfirmed until the real cleanup worker destroys the lease; failure still backs off and the worker becomes idle again. - Red after master integration: both delayed document-panel browser cases failed. Green: all 18 Chromium support checks pass. - 77 journey contract tests pass. - Product E2E typecheck passes with the documented low-memory path. The initial ordinary attempt was killed by the local memory limit and is not counted as a pass. - The only follow-up after the passing checks removes new code comments to follow the contribution guide. Runtime and test behavior are unchanged. Final-head [CI run 43714742904](https://github.com/paperclipai/paperclip/actions/runs/43714742904) completed successfully at this exact head. All 63 PR checks are terminal: 58 success, 2 neutral and 3 conditional skips; no failures or pending checks. Typecheck, build, tests and the final verify gate pass. Greptile and Paperclip Review both score this head 5/5 with no actionable findings; both historical inline threads are resolved. - Hosted QA recovery is still unverified. No extra model run, merge, deployment or QA setting change was made. ## Risks Recovered workspace destruction starts sooner. Existing producer, file-preservation, ownership, claim and provider checks still decide whether teardown is allowed. Failed attempts retain the existing cooldown. Agent termination and purge gates are unchanged. The panel helper waits for visible controls and still fails when controls or saved values are absent. The PostgreSQL integration uses a controlled provider boundary. It does not prove a new live Daytona or deployed QA pass. That requires the fixed revision on QA and a later normal scheduled smoke. ## Model Used OpenAI GPT-6-based Codex, with tool use and code execution. The host does not expose a more specific model ID or context-window size for this run. ## 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 references) - [x] My branch name describes the change 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>
43 lines
3.0 KiB
TypeScript
43 lines
3.0 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { reopenTaskDocument } from "./product-journeys/task-document-flow.js";
|
|
import type { JourneyContext } from "./product-journeys/types.js";
|
|
|
|
for (const layout of ["collapsed", "side-panel", "artifacts", "launcher", "classic"] as const) {
|
|
test(`document reopen waits for the ${layout} task controls after reload`, async ({ page }) => {
|
|
const issue = { title: "Journey QA document navigation" };
|
|
let taskLoads = 0;
|
|
await page.route("https://document-navigation.test/**", async route => {
|
|
if (new URL(route.request().url()).pathname.endsWith("/issues")) {
|
|
await route.fulfill({ contentType: "text/html", body: `<a href="/QA/issues/QA-201">${issue.title}</a>` });
|
|
return;
|
|
}
|
|
taskLoads++;
|
|
await route.fulfill({ contentType: "text/html", body: `<main><div id="controls"></div></main><script>
|
|
const controls = document.querySelector('#controls');
|
|
function authoring() { controls.innerHTML = '<button>New document</button><section id="document-qa-note">Saved revision two</section>'; }
|
|
function panel() {
|
|
controls.innerHTML = ${JSON.stringify(layout === "artifacts" ? '<button role="tab">Artifacts</button>' : '<button>Open a new tab</button>')};
|
|
controls.querySelector('button').onclick = ${layout === "artifacts" ? "authoring" : `() => { controls.innerHTML = '<div role="option">Artifacts</div>'; controls.querySelector('[role="option"]').onclick = authoring; }`};
|
|
}
|
|
setTimeout(() => {
|
|
${layout === "classic" ? "authoring();" : layout === "collapsed" || layout === "side-panel" ? `controls.innerHTML = ${JSON.stringify(layout === "side-panel" ? '<button aria-label="Toggle side panel" aria-pressed="false">Open</button>' : '<button>Show properties</button>')}; controls.querySelector('button').onclick = () => setTimeout(panel, 100);` : "panel();"}
|
|
}, 200);
|
|
</script>` });
|
|
});
|
|
const context = { page, api: { origin: "https://document-navigation.test" }, company: { issuePrefix: "QA" } } as JourneyContext;
|
|
await reopenTaskDocument(context, issue);
|
|
await expect(page.locator("#document-qa-note")).toHaveText("Saved revision two");
|
|
expect(taskLoads).toBe(2);
|
|
});
|
|
}
|
|
|
|
test("document reopen fails when the task has no authoring controls", async ({ page }) => {
|
|
await page.route("https://document-navigation.test/**", async route => {
|
|
const list = new URL(route.request().url()).pathname.endsWith("/issues");
|
|
await route.fulfill({ contentType: "text/html", body: list ? '<a href="/QA/issues/QA-201">Journey QA document navigation</a>' : '<main>Task without document permissions</main>' });
|
|
});
|
|
const context = { page, api: { origin: "https://document-navigation.test" }, company: { issuePrefix: "QA" } } as JourneyContext;
|
|
await expect(reopenTaskDocument(context, { title: "Journey QA document navigation" })).rejects.toThrow();
|
|
await expect(page.getByRole("button", { name: "New document", exact: true })).toHaveCount(0);
|
|
});
|