mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 10:44:52 +01:00
## Thinking Path > - Paperclip helps people manage AI agents for work. > - Product E2E tests check real tasks and their saved results. > - The question journey must keep evidence when an agent run fails. > - It currently rejects that run before the first stable checkpoint is saved. > - The private report then has checks but no run failure code. > - This PR saves a small, bound failure receipt before rejection. > - The test still fails. The receipt helps the next diagnosis. ## Linked Issues or Issue Description **Describe the bug** When a native run fails before the first question checkpoint, `readClarificationState` throws `agent_run_failed`. The final `clarification.json` has no checkpoints. The report cannot show the run's machine error code. **Steps to reproduce** 1. Give the question journey an owned native task with a terminal failed run. 2. Read the first question state. 3. Inspect the private report after the journey fails. **Expected behavior** Keep a private receipt with the bound task and run IDs, status, and machine error code. Preserve the failed verdict and the empty checkpoint list. **Additional context** This repairs missing evidence. It does not repair or establish the cause of an agent failure. The reference-grading repair in #22949 is separate and remains unchanged. ## What Changed - Split binding checks from outcome checks in the shared journey validator. Check every run's company, task, agent, model, and environment before retaining a failure. Existing consumers still use the full validator. - Save `clarification-run-failure.json` in the private story directory when the question journey rejects a failed run. Keep only IDs, status, and a bounded machine code. Exclude raw errors, prompts, and provider state. - Keep the original failure if the receipt write fails. Add a fixed secondary cause code. - Add failure, binding, privacy, and final-grading regressions. Document the private receipt. ## Verification - Red: the initial regression had 6 failures and 4 passes on the old code. It reproduced the lost receipt and the first-error binding gap. - Green: 175 tests in 9 affected agent and clarification support files pass with the repository's Product E2E Vitest config. - `pnpm test:e2e:runner:typecheck` passes. - `pnpm verify` could not select tests. The managed Git storage guard rejects `git ls-files`. The focused checks above ran directly. Final CI must supply its required coverage. - The journey regression calls the real observer and validator, saves the private files, and reads them after final grading. It checks that all 11 checks still fail and no question checkpoint is invented. The task-creation UI boundary is simulated. - No live provider run was started. This is local report-path evidence, not a new staging pass. The reviewed harness must be adopted and checked through the authorized QA process after merge. ## Risks Low scope. Only Product E2E support code and its docs change. The shared validator now checks all bindings before it reports the first failed outcome. Foreign evidence still fails closed. The existing outcome, run limit, cancellation, and recovery checks remain in place. The private receipt is not added to the public report. ## Model Used - OpenAI Codex, based on GPT-6, with reasoning, tools, and code execution. This run does not expose a more specific provider model ID. ## 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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing>