mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-16 03:31:44 +01:00
test(e2e): accept every dependency wake producer for the one automatic resume (#21732)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - When a blocker task is completed, Paperclip wakes the blocked dependent task automatically > - Two producers emit that `issue_blockers_resolved` wake: the issue update route and the issue-graph liveness backstop (plus workspace finalize); they share one idempotency key and coalesce into one wake run > - The QA task-dependency-resume journey requires the run's `contextSnapshot.source` to be exactly `issue.blockers_resolved` > - On QA both producers emitted 43 ms apart; the run was created once, but the later backstop wake recorded its source on the run, so the journey failed a resume that happened exactly once > - This pull request accepts any of the three producers and keeps every other resume condition > - The benefit is that the journey tests the user-visible promise (one automatic resume caused by this blocker) instead of which internal producer won a race ## Linked Issues or Issue Description **What happened?** QA run (launch 3937) failed task-dependency-resume on `dependency_one_automatic_resume`. The dependent's activity log shows `issue.blockers_resolved_wake_emitted` from `issue_update` at 06:59:39.973 and from `issue_graph_liveness_backstop` at 06:59:40.016 with the same idempotency key and the same wake run. Exactly one run executed, started after the blocker completed, and succeeded. **Expected behavior** The journey accepts one automatic, blocker-caused resume regardless of which producer's label the coalesced run kept. **Steps to reproduce** Grade the retained evidence with `contextSnapshot.source = "issue_graph_liveness.backstop"`: `dependency-one-automatic-resume` fails although every other condition holds. ## What Changed - `task-dependency-resume-evidence.ts`: the wake source must be one of `issue.blockers_resolved`, `issue_graph_liveness.backstop`, `workspace.finalize` (the producers of this wake reason in `server/src`). - Still required: one dependent run, `invocationSource` automation / `triggerDetail` system, wake reason `issue_blockers_resolved`, the resolved blocker id, start after blocker completion, committed native run, no leftover checkout. ## Verification - Red/green: new cases "accepts the same automatic resume when the issue_graph_liveness.backstop / workspace.finalize dependency wake recorded its source" fail before and pass after. - Existing mutants still fail: "mutation name used as wake source" (`issue.blocker_done`) and "missing saved wake source". - `tests/runner-e2e` task-dependency tests: 3 files, 108 tests pass. ## Risks - Low risk: journey grading only. Separate note: the coalesced run keeps the last producer's source label; whether it should keep the first is a provenance question, not addressed here. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and code execution. ## 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
41a3520a2f
commit
7c0c116edf
2 files changed
+8
-1
No files matched your search
@@ -76,6 +76,11 @@ describe("task dependency resume evidence", () => {
|
||||
const f = dependencyEvidenceFixture(); mutate(f);
|
||||
expect(gradeTaskDependencyResume(f).some(check => !check.passed)).toBe(true);
|
||||
});
|
||||
it.each(["issue_graph_liveness.backstop", "workspace.finalize"])("accepts the same automatic resume when the %s dependency wake recorded its source", source => {
|
||||
const f = dependencyEvidenceFixture();
|
||||
for (const p of [f.finished, f.reopened]) for (const r of [...p.dependentRuns, ...p.agentRuns]) r.contextSnapshot.source = source;
|
||||
expect(gradeTaskDependencyResume(f)).toEqual(TASK_DEPENDENCY_RESUME_CHECKS.map(id => ({ id, passed: true })));
|
||||
});
|
||||
it("missing input never becomes a pass", () => { expect(gradeTaskDependencyResume(undefined).every(c => !c.passed)).toBe(true); });
|
||||
it.each([null, {}, { summary: "Compacted result" }])("accepts the public run projection without duplicate finalization metadata: %j", resultJson => {
|
||||
const f = dependencyEvidenceFixture();
|
||||
|
||||
@@ -7,6 +7,8 @@ export const TASK_DEPENDENCY_RESUME_CHECKS = [
|
||||
"dependency-history-preserved", "configured-model-and-environment",
|
||||
] as const;
|
||||
|
||||
const DEPENDENCY_WAKE_SOURCES: ReadonlySet<unknown> = new Set(["issue.blockers_resolved", "issue_graph_liveness.backstop", "workspace.finalize"]);
|
||||
|
||||
export interface DependencyScope {
|
||||
companyId: string; userId: string; agentId: string; environmentId: string; provider: string; model: string;
|
||||
blockerId: string; blockerIdentifier: string; blockerTitle: string; blockerDescription: string;
|
||||
@@ -101,7 +103,7 @@ export function gradeTaskDependencyResume(value: DependencyEvidence | undefined)
|
||||
&& nonempty(run?.id) && [reopened.dependentRuns[0], newRuns(finished)[0], newRuns(reopened)[0]].every(row => runFacts(row) === runFacts(run))
|
||||
&& run.companyId === s.companyId && run.agentId === s.agentId && dependencyRunIssueId(run) === s.dependentId
|
||||
&& run.status === "succeeded" && run.invocationSource === "automation" && run.triggerDetail === "system"
|
||||
&& run.contextSnapshot?.wakeReason === "issue_blockers_resolved" && run.contextSnapshot?.source === "issue.blockers_resolved"
|
||||
&& run.contextSnapshot?.wakeReason === "issue_blockers_resolved" && DEPENDENCY_WAKE_SOURCES.has(run.contextSnapshot?.source)
|
||||
&& run.contextSnapshot?.resolvedBlockerIssueId === s.blockerId && exactId(run.contextSnapshot?.blockerIssueIds, s.blockerId)
|
||||
&& Number.isFinite(date(run.startedAt)) && date(run.startedAt) >= date(released.blocker.completedAt);
|
||||
const boundRun = scoped && [run, reopened.dependentRuns[0], newRuns(finished)[0], newRuns(reopened)[0]].every(row =>
|
||||
|
||||
Reference in new issue
Block a user