mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-08 01:57:31 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Product E2E journeys grade agent work in the QA staging smoke plan > - On the current QA deployment, two journeys failed after the product had already done the requested work > - protected-actions counted a wake that the control plane retired before it started as a bound run, and failed its runtime binding check > - question-answer-resume waited for its saved document in a view that no longer exists. The wait lasted 27 minutes, until the case deadline, and starved the run queue > - This pull request grades only runs that started provider work, and reads the document where the UI now shows it, with a bounded wait > - The benefit is that both journeys measure the product, and a UI readback failure costs about two minutes instead of a whole worker ## Linked Issues or Issue Description **What happened?** - protected-actions: the task succeeded with two runs. A third automation wake for the same agent and task was cancelled before it started, with the reason "Agent cannot start work while completed runs await accounting". Its `startedAt` was null, its `resultJson.cancellation` had `source: "control_plane"` and `expected: true`, and its `executionRecovery.providerWorkStarted` was false. That run has no runtime binding, so `validateAgentTaskState` failed with `agent_run_binding_mismatch`. - question-answer-resume: the agent saved the requested document and the task was done by 19:32. The journey then navigated to `#document-<key>` and waited until 19:59 for an element that never appeared. With the task chat shell and Artifacts V1, documents render in the properties pane's Artifacts tab. The run reported `journey_operation_failed` and `evidence_collection_timeout`, and the 60-minute job ended before four other cases could run. **Expected behavior** - A wake retired before admission is kept as evidence but is not graded as provider work. - The saved document is read in its current view, and a UI readback failure ends quickly. **Steps to reproduce** QA staging smoke launch 3074 on appcb8df178c8. The stack-side run records are described above. **Paperclip version or commit** master at03eb49053f. ## What Changed - `agent-flows.ts`: add `retiredBeforeProviderStart(run)`. The run must have status `cancelled` and `startedAt === null`, a control-plane cancellation with `expected: true`, and `executionRecovery.providerWorkStarted === false`. `validateAgentTaskState` still checks such a run's company, agent and task binding and counts it toward the run limit, then skips the runtime checks. - `clarification-flow.ts`: after reload, open the Artifacts tab with the existing `openDocumentAuthoring` helper before reading the document. task-dependency-resume uses the same path and passes on this deployment. The UI readback is capped at 2 minutes after the API returned the saved document. Agent work time is not changed. - `agent-evidence.test.ts`: the retired wake is accepted. Nine variants still fail: a started run, a missing `startedAt`, a failed status, an unexpected cancellation, an operator source, `providerWorkStarted: true`, missing recovery evidence, another agent, and another task. The run limit still applies. ## Verification - `npx vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/product-journeys`: 46 files passed. - Negative control: without the skip, the new test fails. - `clarification-readback.spec.ts` (browser support): 6 tests passed. - `tsc -p tests/runner-e2e/tsconfig.json` shows no errors in the changed files. - Not verified live yet. QA uses the pinned harness, so the pin must move to a commit that contains this change. ## Risks - The exclusion is narrow, and every field it requires is positive evidence that the wake did no work. Any started or unexpected extra run still fails. - The readback cap is stricter, not looser. It applies only after the API has confirmed the document. Agent work and answer timing still use the existing deadlines. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, via Claude Code with tool use (shell, browser, code editing). Extended reasoning was used. ## 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>