Files
PaperClipAI/tests/runner-e2e/product-journeys/task-dependency-resume.md
T
DottaandPaperclip 1a36a8f3c0 fix(e2e): wait for agreeing dependency run observations (#22802)
## Thinking Path

> - Paperclip lets people manage AI agents and their work.
> - A blocked task must start once after its blocker is complete.
> - The dependency journey checks this through task and agent run reads.
> - These independent reads can see the same run at different stages of
completion.
> - The collector can stop while the agent read still says `running`.
> - This pull request waits for both reads to agree before it saves the
finished and reopened points.
> - The test can then measure the completed work with the existing
strict rules.

## Linked Issues or Issue Description

**What happened?**

The dependency journey can report `dependency_one_automatic_resume`
after one correct automatic run. Its completion wait accepts the task
run as `succeeded` while the agent run read still says `running`. A
later read agrees, but the saved finished point remains split.

**Expected behavior**

Wait for matching task and agent run facts within the existing campaign
deadline. Keep the two observations independent. Fail if they never
agree.

**Steps to reproduce**

Use the flow fixture to return a completed task run and a lagging agent
run detail. Run the new `agent detail still running after task detail
completed` case against the old collector. It fails with
`dependency_one_automatic_resume`.

**Paperclip version or commit**

Base: `3ca9b6d471e100fe248c650f30453db4d3bc55fb`.
Related: #21732 added valid wake producers. That repair is already
present and does not address this read timing error.

## What Changed

- Compare task and agent run facts with the same normalized facts used
by the grader.
- Require agreement before the collector ends its completion wait and
after it reopens the result.
- Tag fixture projections explicitly, with separate agent lag counters
before and after reopening.
- Share the full settled predicate between both waits; agreeing stale
reads cannot count as completion.
- Add temporary and permanent cases for agent lag, task-only and
agreeing stale run views, task status, missing document, active locks
and native phase.
- Document the completion wait. Keep the grader, run budget and deadline
unchanged.

## Verification

- Red: the new lagging-read regression fails on the base collector with
`dependency_one_automatic_resume`.
- Green: three focused dependency suites pass, 126 tests. This includes
permanent disagreement, duplicate or unrelated runs, early execution,
history and output checks.
- Command: `node /tmp/pap5740-test-tools/node_modules/vitest/vitest.mjs
run --config /tmp/pap5740-test-tools/vitest.config.mjs`. The temporary
config selects
`tests/runner-e2e/product-journeys/task-dependency-resume*.test.ts`.
Tools: Vitest 5.0.3, Playwright 1.62.1 and Zod 4.
- `pnpm verify` could not run: the managed Git storage guard rejects
`git ls-files` with `paperclip_git_storage_limit`. CI must supply
broader checks.
- No new paid journey was run. Staging acceptance remains open. No
reviewed harness pin was changed.
- Follow-up commit: `16bb94c256769fe76b014e865259b742b35773ea`. The
reopened-only regression fails on the prior commit with
`dependency_one_automatic_resume`; it passes after this repair.
- Second follow-up: `45d60118fb36fd1f426e088f263d04c91484cfee`. Ten of
twelve new stale-state cases fail on `16bb94c`; all pass after sharing
the settled predicate.
- Exact finished-run binding:
`24d7b2f67a9f51ac6d996211f651a92772ff2a55`. Both reopened projections
must match the normalized saved finished-run facts. Two additional
agreeing-but-different run-facts cases fail before this change and pass
afterward.
- CI and Greptile passed on `16bb94c`; reviews also cleared `45d6011`.
Fresh CI and reviews are pending on `24d7b2f`.

## Risks

Low risk. A mismatch now uses the remaining campaign wait rather than
reaching the grader early. Permanent disagreement still fails at the
deadline. This change does not start another agent run, alter production
state, replace either independent read, or relax the grader.

## Model Used

OpenAI GPT-6 through Codex, with reasoning and code execution. The
runtime did not expose a more specific 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>
2026-11-24 13:34:14 -06:00

4.7 KiB

Blocked task resumes after its human-owned blocker

task-dependency-resume is an explicit Product E2E journey for an authenticated existing Cloud target or a target provider with a qualified native agent. It uses the ordinary task UI and public observation APIs. Its registration is not evidence of a local or deployed pass.

The browser creates two tasks assigned to the signed-in person. The blocker holds a random review reference absent from the dependent's prompt. On the dependent, the person adds the blocker, selects Blocked, and assigns the disposable agent. Closed properties panes are opened through their visible toolbar control; mounted inert or accessibility-hidden rows cannot substitute for an interactive pane. Status choices are bound to the matching labeled glyph inside the open picker. The saved dependency, blocked status, and empty task/agent run histories must remain observable for at least ten seconds. This is a finite measured wait, not an unlimited claim that no execution can ever occur.

The person completes the blocker through the task's status control. Paperclip must then start exactly one native run automatically. Its durable wake must name the same resolved blocker, reason issue_blockers_resolved, and saved source issue.blockers_resolved; blocker_done is the producer's separate mutation payload. Manual Run or a follow-up message cannot substitute. The run starts after the saved blocker completion, uses the configured provider/model/environment, commits its result through the durable committed native phase, and completes the dependent. The public API may omit or compact resultJson; duplicate finalization metadata in that optional object is not required. A task document named dependency-proof contains the review reference and blocker identifier. Its current revision must be authored by this agent and run. Reloading the task must show that same saved revision and preserve the two tasks' descriptions, dependency, and board-owned blocker completion audit. No agent work is permitted on the human-owned blocker.

The case requires company, board-user, task-write, and agent. It declares one work run, uses the existing bounded case budget, and shares the original campaign deadline. The task and agent run reads can straddle completion. The completion wait requires both projections to agree on the same run facts before saving the finished point. After reopening, it applies the same settled check: done task, one succeeded and committed run, agreeing projections, saved document and revision, and no active locks. The reopened run facts must also match the already-settled finished run. It uses the original deadline and does not replace either independent observation. The native agent must have nonblank provider and model identifiers before any observation read or task creation. An incomplete execution identity returns unsupported without task or agent work. It saves the agent's starting run history and retains those records while checking only newly appearing runs for this case. Earlier terminal campaign work stays in the accounting and does not count as new execution. Owned-task activity reads are complete and uncapped; the separate agent-filtered activity read fails closed if its 500-row bound is reached. The agent run list likewise fails closed at the public API's 1000-row cap. Unrelated company history does not enter these completeness checks. Agent setup usage is outside task-run accounting; missing provider prices remain unknown. The owning target provider controls normal cancellation, termination, retained history, and evidence cleanup. It never changes a shared source agent, company budget, or execution environment.

The private evidence folder contains task-dependency-observations.json and observation-read-failures.json, with allowlisted owned task, run, audit, and document facts. The normal launcher captures the final owned task screenshot. Both evidence writes are attempted. A write failure retains an existing journey error and its outcome; a previously successful journey fails if required evidence cannot be saved. Diagnostics name only the affected evidence file. Runtime identity, document authorship, reload visibility, and retained history use their own observations bound to the same company, task, agent, and run. One failed control does not mark unrelated controls failed. All eight checks remain required for acceptance. There are no direct database writes, private runner hooks, manually dispatched resumption wakes, retry loops for failed model work, or fixture-authored outputs. Independent controls reject premature or duplicate execution, a never-resumed or manually started task, foreign/changed runtime identity, missing completion audit, wrong output or revision authorship, and missing or shortened observations.