@nanobpm/nano-workforce 0.206.1 → 0.206.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/app/github.test.ts +43 -0
- package/app/github.ts +11 -1
- package/app/mergeLoopBehaviour.test.ts +215 -4
- package/build-info.json +4 -4
- package/package.json +1 -1
- package/resources/processes/merge-loop.bpmn +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [0.206.2](https://github.com/nanobpm/nano-workforce/compare/v0.206.1...v0.206.2) (2026-11-09)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **merge:** let a DIRTY state outrank absent required checks so a conflicting PR reaches the rebase arm ([#930](https://github.com/nanobpm/nano-workforce/issues/930)) ([71984d5](https://github.com/nanobpm/nano-workforce/commit/71984d5d607151b2c3690a12d6b05537b24c3ece)), closes [#392](https://github.com/nanobpm/nano-workforce/issues/392) [nanobpm/nano-bpm#1444](https://github.com/nanobpm/nano-bpm/issues/1444) [#929](https://github.com/nanobpm/nano-workforce/issues/929)
|
|
6
|
+
|
|
1
7
|
## [0.206.1](https://github.com/nanobpm/nano-workforce/compare/v0.206.0...v0.206.1) (2026-11-08)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/app/github.test.ts
CHANGED
|
@@ -719,6 +719,49 @@ const MERGE_CASES: MergeCase[] = [
|
|
|
719
719
|
protocol: protocolWith({ requiredChecks: reqChecks("build"), waitForChecks: true }),
|
|
720
720
|
want: "waiting",
|
|
721
721
|
},
|
|
722
|
+
// ── DIRTY outranks an ABSENT/PENDING required check (issue #929) ─────────────────────────────
|
|
723
|
+
// GitHub does not run `pull_request` workflows on a PR with merge conflicts, so a DIRTY head
|
|
724
|
+
// reports its declared-required checks as ABSENT (or skipped). Mapping that absence to `waiting`
|
|
725
|
+
// deadlocks the merge loop: the checks can never arrive until the conflict is resolved, and the
|
|
726
|
+
// conflict is never routed to the rebase arm because the checks read as "not yet run". The
|
|
727
|
+
// conflict is ground truth whose remedy (a rebase) is also exactly what re-triggers CI, so DIRTY
|
|
728
|
+
// outranks absence — but NOT a red declared-required check, which still routes to fix-ci.
|
|
729
|
+
{
|
|
730
|
+
name: "DIRTY + declared-required check ABSENT -> conflict, not waiting (the #929 deadlock)",
|
|
731
|
+
state: { mergeStateStatus: "DIRTY", rollup: [{ name: "summary", conclusion: "SKIPPED" }] },
|
|
732
|
+
protocol: protocolWith({ requiredChecks: reqChecks("typecheck + test (Node)", "whole-repo invariants") }),
|
|
733
|
+
want: "conflict",
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
name: "DIRTY + no check runs at all -> conflict (absence is a consequence of the conflict)",
|
|
737
|
+
state: { mergeStateStatus: "DIRTY" },
|
|
738
|
+
protocol: protocolWith({ requiredChecks: reqChecks("build"), waitForChecks: true }),
|
|
739
|
+
want: "conflict",
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
name: "DIRTY + declared-required check PENDING -> conflict (rebase, then CI re-runs on the new head)",
|
|
743
|
+
state: { mergeStateStatus: "DIRTY", rollup: [{ name: "build", conclusion: "QUEUED" }] },
|
|
744
|
+
protocol: protocolWith({ requiredChecks: reqChecks("build") }),
|
|
745
|
+
want: "conflict",
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
name: "DIRTY + declared-required check present-but-unconcluded -> conflict",
|
|
749
|
+
state: { mergeStateStatus: "DIRTY", rollup: [{ name: "build", conclusion: "IN_PROGRESS" }] },
|
|
750
|
+
protocol: protocolWith({ requiredChecks: reqChecks("build") }),
|
|
751
|
+
want: "conflict",
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: "DIRTY + RED declared-required check -> blocked (a red check still outranks the conflict)",
|
|
755
|
+
state: { mergeStateStatus: "DIRTY", rollup: [{ name: "build", conclusion: "FAILURE" }] },
|
|
756
|
+
protocol: protocolWith({ requiredChecks: reqChecks("build") }),
|
|
757
|
+
want: "blocked",
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: "DIRTY + green declared-required checks -> conflict (unchanged pre-#929 behaviour)",
|
|
761
|
+
state: { mergeStateStatus: "DIRTY", rollup: [{ name: "build", conclusion: "SUCCESS" }] },
|
|
762
|
+
protocol: protocolWith({ requiredChecks: reqChecks("build") }),
|
|
763
|
+
want: "conflict",
|
|
764
|
+
},
|
|
722
765
|
];
|
|
723
766
|
|
|
724
767
|
for (const c of MERGE_CASES) {
|
package/app/github.ts
CHANGED
|
@@ -1621,7 +1621,6 @@ export function classifyMergeability(s: PrState, protocol?: MergeProtocol): Merg
|
|
|
1621
1621
|
// settled-thread routing below.
|
|
1622
1622
|
const gate = requiredChecksVerdict(s, protocol);
|
|
1623
1623
|
if (gate === "blocked") return "blocked";
|
|
1624
|
-
if (gate === "waiting") return "waiting";
|
|
1625
1624
|
// A GitHub-identified merge conflict (`mergeStateStatus: "DIRTY"`) is ground truth whose remedy is
|
|
1626
1625
|
// a rebase, dispatched off the `conflict` verdict. It outranks the thread gate below (PR #922
|
|
1627
1626
|
// review, thread 1): a FAILED thread probe (`THREAD_PROBE_FAILED`) returning `waiting` here would
|
|
@@ -1630,7 +1629,18 @@ export function classifyMergeability(s: PrState, protocol?: MergeProtocol): Merg
|
|
|
1630
1629
|
// round that cannot clear it. Surface the conflict first; the threads are re-triaged once the
|
|
1631
1630
|
// rebased head is re-read. (A red declared-required check still outranks even this — see the
|
|
1632
1631
|
// backstop above — so a conflicting PR with failing CI routes to fix-ci, not a doomed rebase.)
|
|
1632
|
+
//
|
|
1633
|
+
// DIRTY also outranks a `waiting` required-checks verdict (issue #929): GitHub does NOT run
|
|
1634
|
+
// `pull_request` workflows on a PR with merge conflicts, so a conflicting head reports its
|
|
1635
|
+
// declared-required checks as ABSENT (or skipped) — and `requiredChecksVerdict` maps absence to
|
|
1636
|
+
// `waiting`. Evaluated in the old order that deadlocked the merge loop: the checks can never
|
|
1637
|
+
// arrive until the conflict is resolved, and the conflict was never routed to the rebase arm
|
|
1638
|
+
// because the absent checks read as "not yet run". The absence is a CONSEQUENCE of the conflict,
|
|
1639
|
+
// and the conflict's remedy (a rebase) is exactly what re-triggers CI on the new head — so the
|
|
1640
|
+
// conflict owns the verdict. Only a RED declared-required check (`blocked`, handled above) may
|
|
1641
|
+
// still outrank DIRTY.
|
|
1633
1642
|
if (s.mergeStateStatus === "DIRTY") return "conflict";
|
|
1643
|
+
if (gate === "waiting") return "waiting";
|
|
1634
1644
|
// The merge-stage thread gate (issue #921, PR #922 review): a read that opted into the
|
|
1635
1645
|
// review-threads probe and found ≥1 open thread (`unresolvedThreads > 0`) is NEVER merge-ready,
|
|
1636
1646
|
// whatever `mergeStateStatus` says. A repo without branch-protection
|
|
@@ -498,7 +498,9 @@ test("the 'waiting' re-poll is bounded — exhausting mergeStallMax escalates to
|
|
|
498
498
|
const engine = await boot({
|
|
499
499
|
vars: { mergeStallMax: 0 },
|
|
500
500
|
responses: {
|
|
501
|
-
|
|
501
|
+
// The probe always emits the full tri-state (a failed read reports reviewThreads: -1) — the
|
|
502
|
+
// escalation wording reads it, so the test payload must carry it.
|
|
503
|
+
"pr.merge-stall-probe": { mergeState: "waiting", failingChecks: 0, failingChecksList: "", reviewThreads: -1, pendingChecks: 0 },
|
|
502
504
|
},
|
|
503
505
|
});
|
|
504
506
|
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
@@ -509,6 +511,186 @@ test("the 'waiting' re-poll is bounded — exhausting mergeStallMax escalates to
|
|
|
509
511
|
assertThatInstance(engine, byProcessId("merge-loop")).hasCompletedElements("wait-mergeable-repoll", "merge-stall-probe", "merge-esc-conflict");
|
|
510
512
|
});
|
|
511
513
|
|
|
514
|
+
// ---------------------------------------------------------------------------
|
|
515
|
+
// #929 — a DIRTY PR whose required checks are ABSENT (GitHub skips pull_request
|
|
516
|
+
// workflows on a conflicting head) must route to the rebase arm, never to the
|
|
517
|
+
// misleading "all checks green … needs approval" escalation.
|
|
518
|
+
// ---------------------------------------------------------------------------
|
|
519
|
+
|
|
520
|
+
test("a DIRTY PR with absent required checks reaches SP_rebase via the stall probe (#929)", async () => {
|
|
521
|
+
// The incident (nanobpm/nano-bpm#1444): REST reported mergeable=false/dirty and every
|
|
522
|
+
// declared-required check was ABSENT (GitHub skips CI on a conflicting head), yet the loop
|
|
523
|
+
// escalated "needs approval" twice and never dispatched the rebase. With the classifier fix,
|
|
524
|
+
// the stall probe re-derives `conflict` and the token reaches the rebase agent.
|
|
525
|
+
const engine = await boot({
|
|
526
|
+
responses: {
|
|
527
|
+
"pr.merge-stall-probe": { mergeState: "conflict", failingChecks: 0, failingChecksList: "", reviewThreads: 0, pendingChecks: 0 },
|
|
528
|
+
"senior:rebase": { status: "rebased" },
|
|
529
|
+
},
|
|
530
|
+
});
|
|
531
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
532
|
+
// The poller's pre-fix verdict was `waiting` (absent required checks outranked DIRTY), so the
|
|
533
|
+
// instance is parked on the mergeable wait when the stall timer fires.
|
|
534
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
535
|
+
assertThatInstance(engine, byProcessId("merge-loop"))
|
|
536
|
+
.isActive()
|
|
537
|
+
.hasActiveElement("wait-mergeable")
|
|
538
|
+
.hasCompletedElements("merge-stall-probe", "rebase") // the rebase agent ran — SP_rebase was reached
|
|
539
|
+
.hasVariable("rebaseRound", 1);
|
|
540
|
+
assert(!completedElementIds(engine).has("merge-esc-conflict"), "a DIRTY PR must rebase, not escalate 'needs approval'");
|
|
541
|
+
const openTasks = await engine.searchUserTasks({});
|
|
542
|
+
assert(!openTasks.some((t) => t.elementId === "wait-merge-answer"), "no human escalation on the rebase path");
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
test("a stall escalation on a DIRTY PR never claims 'all checks green' — it names the conflict (#929)", async () => {
|
|
546
|
+
// The pre-fix escalation built "all checks green (none failing, none pending)" from
|
|
547
|
+
// `failingChecks = 0 and pendingChecks = 0` — but on a DIRTY head those zeros mean GitHub
|
|
548
|
+
// SKIPPED the required checks, not that they passed. The approval wording must stay gated on a
|
|
549
|
+
// PROBED-and-clear thread count; a DIRTY PR (whose `conflict` verdict is only reachable via the
|
|
550
|
+
// rebase arm) that still lands here keeps the conservative wording instead of the false claim.
|
|
551
|
+
const engine = await boot({
|
|
552
|
+
vars: { mergeStallMax: 0, rebaseMax: 0 },
|
|
553
|
+
responses: {
|
|
554
|
+
"pr.merge-stall-probe": { mergeState: "conflict", failingChecks: 0, failingChecksList: "", reviewThreads: -1, pendingChecks: 0 },
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
558
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
559
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
560
|
+
assertThatInstance(engine, byProcessId("merge-loop")).hasCompletedElements("merge-stall-probe", "merge-esc-conflict");
|
|
561
|
+
const q = String(escalation(engine).question ?? "");
|
|
562
|
+
assert(!q.includes("all checks green"), "absent/unprobed checks must never read as 'all checks green'");
|
|
563
|
+
assert(!q.includes("required review approval"), "a conflict must never read as a review-approval wait");
|
|
564
|
+
assertStringIncludes(q, "merge conflict", "the conflict escalation must name the conflict");
|
|
565
|
+
// PR #930 review: the verdict alone does not establish that the required checks are ABSENT —
|
|
566
|
+
// a conflicting head can carry successful required checks, and a failed read reports the same
|
|
567
|
+
// zeros — so the escalation may only note that GitHub MAY not have run them, never assert it.
|
|
568
|
+
assert(!q.includes("absent, NOT green"), "the verdict alone never establishes that the required checks are absent");
|
|
569
|
+
assertStringIncludes(q, "may not have run", "the escalation notes the check-skip caveat without asserting it");
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
test("a conflict-verdict escalation with GREEN required checks still names only the conflict (#930 review)", async () => {
|
|
573
|
+
// The mirror case the review called out: `conflict` with every required check successful. The
|
|
574
|
+
// escalation must not claim the checks are absent or not-green — only the conflict is known.
|
|
575
|
+
const engine = await boot({
|
|
576
|
+
vars: { mergeStallMax: 0, rebaseMax: 0 },
|
|
577
|
+
responses: {
|
|
578
|
+
"pr.merge-stall-probe": { mergeState: "conflict", failingChecks: 0, failingChecksList: "", reviewThreads: 0, pendingChecks: 0 },
|
|
579
|
+
},
|
|
580
|
+
});
|
|
581
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
582
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
583
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
584
|
+
const q = String(escalation(engine).question ?? "");
|
|
585
|
+
assertStringIncludes(q, "merge conflict", "the conflict escalation must name the conflict");
|
|
586
|
+
assert(!q.includes("NOT green"), "green required checks must never be described as not-green");
|
|
587
|
+
assert(!q.includes("all checks green"), "the escalation asserts the conflict, not the check state either way");
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
test("a stalled 'waiting' with clear threads and zero checks never asserts the required checks ran (#930 review)", async () => {
|
|
591
|
+
// `waiting` + reviewThreads>0 + failing=0/pending=0 is ambiguous: the required checks may be
|
|
592
|
+
// absent (never ran on a conflicting head) rather than green. The escalation must float both
|
|
593
|
+
// candidates — a conflict whose checks never ran, or a review-approval requirement — and send
|
|
594
|
+
// the human to the PR, never assert "no failing or pending checks" as if the rollup were green.
|
|
595
|
+
const engine = await boot({
|
|
596
|
+
vars: { mergeStallMax: 0 },
|
|
597
|
+
responses: {
|
|
598
|
+
"pr.merge-stall-probe": { mergeState: "waiting", failingChecks: 0, failingChecksList: "", reviewThreads: 0, pendingChecks: 0 },
|
|
599
|
+
},
|
|
600
|
+
});
|
|
601
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
602
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
603
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
604
|
+
assertThatInstance(engine, byProcessId("merge-loop")).hasCompletedElements("merge-stall-probe", "merge-esc-conflict");
|
|
605
|
+
const q = String(escalation(engine).question ?? "");
|
|
606
|
+
assert(!q.includes("all checks green"), "zero counts with clear threads must never claim green checks");
|
|
607
|
+
assert(!q.includes("NO failing or pending checks"), "zero counts do not establish that the required checks ran");
|
|
608
|
+
assert(!q.includes("required review approval is outstanding"), "an ambiguous read must never assert a verified review-approval blocker");
|
|
609
|
+
assertStringIncludes(q, "not verified", "the approval blocker must be floated, not asserted");
|
|
610
|
+
assertStringIncludes(q, "may never have run", "the escalation must allow that the required checks never ran");
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
test("a stalled 'waiting' with unresolved threads reports their count and asks to resolve them (#930 review)", async () => {
|
|
614
|
+
// Absent required checks can yield `waiting` before the thread gate runs; the verified unresolved
|
|
615
|
+
// threads must be surfaced, since resolving a conflict or approving does not clear them.
|
|
616
|
+
const engine = await boot({
|
|
617
|
+
vars: { mergeStallMax: 0 },
|
|
618
|
+
responses: {
|
|
619
|
+
"pr.merge-stall-probe": { mergeState: "waiting", failingChecks: 0, failingChecksList: "", reviewThreads: 2, pendingChecks: 0 },
|
|
620
|
+
},
|
|
621
|
+
});
|
|
622
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
623
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
624
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
625
|
+
const q = String(escalation(engine).question ?? "");
|
|
626
|
+
assertStringIncludes(q, "2 unresolved review thread(s)", "the verified thread count must be reported");
|
|
627
|
+
assertStringIncludes(q, "Resolve those conversations", "the operator must be asked to resolve the threads");
|
|
628
|
+
assertStringIncludes(q, "may never have run", "the check state stays unverified");
|
|
629
|
+
assert(!q.includes("all checks green"), "never claim green checks");
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
test("a stall escalation after a FAILED GitHub read says the state could not be read — never a confirmed conflict (#930 review)", async () => {
|
|
633
|
+
// The stall probe's catch maps a failed read to `waiting`, reviewThreads -1, zero checks — the
|
|
634
|
+
// exact payload the pre-fix wording read as a confirmed conflict. The escalation must report an
|
|
635
|
+
// unreadable state and nothing more specific.
|
|
636
|
+
const engine = await boot({
|
|
637
|
+
vars: { mergeStallMax: 0 },
|
|
638
|
+
responses: {
|
|
639
|
+
"pr.merge-stall-probe": { mergeState: "waiting", failingChecks: 0, failingChecksList: "", reviewThreads: -1, pendingChecks: 0 },
|
|
640
|
+
},
|
|
641
|
+
});
|
|
642
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
643
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
644
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
645
|
+
const q = String(escalation(engine).question ?? "");
|
|
646
|
+
assertStringIncludes(q, "could not be fully read", "a failed read must be named as such");
|
|
647
|
+
assert(!q.includes("CONFLICTING"), "a failed read must never assert a confirmed conflict");
|
|
648
|
+
assert(!q.includes("required review approval"), "a failed read must never assert a review-approval blocker");
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
test("a stall give-up with no remediation attempted never claims a remediation budget was exhausted (#930 review)", async () => {
|
|
652
|
+
for (const mergeState of ["conflict", "blocked"]) {
|
|
653
|
+
const engine = await boot({
|
|
654
|
+
vars: { mergeStallMax: 0 },
|
|
655
|
+
responses: {
|
|
656
|
+
"pr.merge-stall-probe": { mergeState, failingChecks: mergeState === "blocked" ? 1 : 0, failingChecksList: mergeState === "blocked" ? "ci" : "", reviewThreads: 0, pendingChecks: 0 },
|
|
657
|
+
},
|
|
658
|
+
});
|
|
659
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
660
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
661
|
+
const q = String(escalation(engine).question ?? "");
|
|
662
|
+
if (q === "") continue; // routed to a remediation agent rather than the direct give-up
|
|
663
|
+
assert(!/budget|exhausted/.test(q), `${mergeState}: the escalation must not claim an exhausted budget: ${q}`);
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
test("answering 'retry' on a DIRTY PR's escalation re-arms the poller, which re-derives conflict and rebases (#929)", async () => {
|
|
668
|
+
// The incident's second half: a human answered "retry" and the loop re-classified the same way
|
|
669
|
+
// and escalated again — the rebase was never reached. Post-fix the retry re-arms the poller; the
|
|
670
|
+
// next verdict for the still-DIRTY PR is `conflict`, which dispatches the rebase agent.
|
|
671
|
+
const engine = await boot({
|
|
672
|
+
vars: { mergeStallMax: 0 },
|
|
673
|
+
responses: {
|
|
674
|
+
"pr.merge-stall-probe": { mergeState: "waiting", failingChecks: 0, failingChecksList: "", reviewThreads: -1, pendingChecks: 0 },
|
|
675
|
+
"senior:rebase": { status: "rebased" },
|
|
676
|
+
},
|
|
677
|
+
});
|
|
678
|
+
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
679
|
+
await engine.advanceTime(MERGEABLE_WAIT_MS + 1);
|
|
680
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
681
|
+
// The human replies "retry" — the answer reconciles then re-arms the poller.
|
|
682
|
+
await engine.completeUserTask(await mergeAnswerTaskKey(engine), { answer: "retry" });
|
|
683
|
+
assertThatInstance(engine, byProcessId("merge-loop")).isActive().hasActiveElement("wait-mergeable");
|
|
684
|
+
// The re-armed poller now classifies the DIRTY PR as `conflict` (absent required checks no
|
|
685
|
+
// longer outrank DIRTY) and the rebase agent is dispatched.
|
|
686
|
+
await engine.publishMessage({ name: "merge-ready", correlationKey: "pr-1", variables: { mergeState: "conflict" } });
|
|
687
|
+
assertThatInstance(engine, byProcessId("merge-loop"))
|
|
688
|
+
.isActive()
|
|
689
|
+
.hasActiveElement("wait-mergeable")
|
|
690
|
+
.hasCompletedElements("record-merge-answer", "rebase")
|
|
691
|
+
.hasVariable("rebaseRound", 1);
|
|
692
|
+
});
|
|
693
|
+
|
|
512
694
|
test("an unclassified verdict routes to auto-rebase (DEFAULT), not to a human (#774)", async () => {
|
|
513
695
|
// The DEFAULT arm is a last-resort self-heal, not a page: an unexpected/garbage `mergeState` routes
|
|
514
696
|
// to the bounded rebase agent (which reconciles from ground truth), never straight to a human.
|
|
@@ -637,7 +819,7 @@ test("the 'never settled' question is reserved for a genuinely unreadable/unsett
|
|
|
637
819
|
const engine = await boot({
|
|
638
820
|
vars: { mergeStallMax: 0 },
|
|
639
821
|
responses: {
|
|
640
|
-
"pr.merge-stall-probe": { mergeState: "waiting", failingChecks: 0, failingChecksList: "", reviewThreads: -1 },
|
|
822
|
+
"pr.merge-stall-probe": { mergeState: "waiting", failingChecks: 0, failingChecksList: "", reviewThreads: -1, pendingChecks: 0 },
|
|
641
823
|
},
|
|
642
824
|
});
|
|
643
825
|
await engine.publishMessage({ name: "deps-cleared", correlationKey: "pr-1" });
|
|
@@ -645,8 +827,8 @@ test("the 'never settled' question is reserved for a genuinely unreadable/unsett
|
|
|
645
827
|
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
646
828
|
assertStringIncludes(
|
|
647
829
|
String(escalation(engine).question ?? ""),
|
|
648
|
-
"
|
|
649
|
-
"a genuinely unsettled/unreadable mergeability
|
|
830
|
+
"could not be fully read",
|
|
831
|
+
"a genuinely unsettled/unreadable mergeability names the unreadable state",
|
|
650
832
|
);
|
|
651
833
|
});
|
|
652
834
|
|
|
@@ -871,6 +1053,31 @@ test("a conflict runs the bounded rebase agent and a rebased result re-arms the
|
|
|
871
1053
|
.hasVariable("rebaseRound", 1); // the rebase counter advanced across the sub-process boundary
|
|
872
1054
|
});
|
|
873
1055
|
|
|
1056
|
+
test("a rebase agent cannot spoof the escalation verdict by returning mergeState (#930 self-review)", async () => {
|
|
1057
|
+
// The agent's result keys are hoisted into process scope, and `mergeState` now selects the
|
|
1058
|
+
// shared merge-esc-conflict wording. A rebase agent that returns a bogus `mergeState:"ready"`
|
|
1059
|
+
// must NOT be able to rewrite a "could not resolve the conflict" escalation into a
|
|
1060
|
+
// green-checks/approval message: the trusted `end_reb_blocked` end event re-stamps the verdict.
|
|
1061
|
+
const engine = await boot({ responses: { "senior:rebase": { status: "blocked", mergeState: "ready" } } });
|
|
1062
|
+
await driveToRebase(engine);
|
|
1063
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
1064
|
+
assertThatInstance(engine, byProcessId("merge-loop")).hasCompletedElements("merge-esc-attempt");
|
|
1065
|
+
assertStringIncludes(String(escalation(engine).question ?? ""), "rebase agent could not resolve", "the question must name the conflict trigger, not the spoofed verdict");
|
|
1066
|
+
assertThatInstance(engine, byProcessId("merge-loop")).hasVariable("mergeState", "conflict");
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
test("a fix-ci agent cannot spoof the escalation verdict by returning mergeState (#930 self-review)", async () => {
|
|
1070
|
+
// Same guard on the CI-fix side: a fix-ci agent that exhausts its budget after returning a bogus
|
|
1071
|
+
// `mergeState` must still escalate with the CI-fix wording — `end_ci_esc` re-stamps the verdict.
|
|
1072
|
+
const engine = await boot({ responses: { "senior:fix-ci": { status: "blocked", pushed: true, mergeState: "ready" } } });
|
|
1073
|
+
await driveToCiFix(engine);
|
|
1074
|
+
await assertThatUserTask(engine, { instance: byProcessId("merge-loop"), elementId: "wait-merge-answer" }).isCreated();
|
|
1075
|
+
assertThatInstance(engine, byProcessId("merge-loop")).hasCompletedElements("merge-esc-attempt");
|
|
1076
|
+
const q = String(escalation(engine).question ?? "");
|
|
1077
|
+
assertStringIncludes(q, "could not make the required checks green", "the question must name the CI-fix failure, not the spoofed verdict");
|
|
1078
|
+
assertThatInstance(engine, byProcessId("merge-loop")).hasVariable("mergeState", "blocked");
|
|
1079
|
+
});
|
|
1080
|
+
|
|
874
1081
|
test("a rebase that cannot resolve escalates with a conflict question", async () => {
|
|
875
1082
|
const engine = await boot({ responses: { "senior:rebase": { status: "blocked" } } });
|
|
876
1083
|
await driveToRebase(engine);
|
|
@@ -967,6 +1174,10 @@ test("the rebase agent SLA interrupts the sub-process and escalates as not-merge
|
|
|
967
1174
|
assertThatInstance(engine, byProcessId("merge-loop")).hasCompletedElements("merge-esc-conflict");
|
|
968
1175
|
// #879 regression: the trusted rebase SLA arm must deliver its job-type marker to the shared sink.
|
|
969
1176
|
assertEquals(escalation(engine).agentSlaJobType, "senior:rebase", "the rebase SLA arm must reach the recorder with its job-type marker");
|
|
1177
|
+
// The SLA escalation must never surface the stale `conflict` verdict's wording — the recorder's
|
|
1178
|
+
// SLA builder (keyed on the trusted marker) owns the question, not the verdict FEEL.
|
|
1179
|
+
const q = String(escalation(engine).question ?? "");
|
|
1180
|
+
assert(!q.includes("CONFLICTING") && !q.includes("merge conflict with the base branch"), "an SLA escalation must not read as a verdict escalation");
|
|
970
1181
|
});
|
|
971
1182
|
|
|
972
1183
|
test("a non-SLA escalation carrying a spoofed agentSlaJobType is scrubbed before the recorder (#879 fail-closed)", async () => {
|
package/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.206.
|
|
3
|
-
"gitSha": "
|
|
4
|
-
"gitTag": "v0.206.
|
|
5
|
-
"builtAt": "2026-11-
|
|
2
|
+
"version": "0.206.2",
|
|
3
|
+
"gitSha": "71984d5d607151b2c3690a12d6b05537b24c3ece",
|
|
4
|
+
"gitTag": "v0.206.2",
|
|
5
|
+
"builtAt": "2026-11-09T11:18:01.340Z"
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanobpm/nano-workforce",
|
|
3
|
-
"version": "0.206.
|
|
3
|
+
"version": "0.206.2",
|
|
4
4
|
"description": "Nano Workforce — an Agent Graph Orchestration application for Agentic SDLC: durable BPMN processes that coordinate a graph of AI agents across the software delivery lifecycle.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "main.ts",
|
|
@@ -115,6 +115,9 @@
|
|
|
115
115
|
<zeebe:output source="=null" target="status" />
|
|
116
116
|
<zeebe:output source="=null" target="ciBlockedReconciled" />
|
|
117
117
|
<zeebe:output source="=null" target="agentSlaJobType" />
|
|
118
|
+
<zeebe:output source="=null" target="reviewThreads" />
|
|
119
|
+
<zeebe:output source="=null" target="failingChecks" />
|
|
120
|
+
<zeebe:output source="=null" target="pendingChecks" />
|
|
118
121
|
</zeebe:ioMapping>
|
|
119
122
|
</bpmn:extensionElements>
|
|
120
123
|
<bpmn:incoming>f_m_deps</bpmn:incoming>
|
|
@@ -263,7 +266,7 @@
|
|
|
263
266
|
</zeebe:properties>
|
|
264
267
|
<zeebe:ioMapping>
|
|
265
268
|
<zeebe:input source="="blocked"" target="status" />
|
|
266
|
-
<zeebe:input source="=if mergeState = "draft" then "This PR is in draft and can't be merged. Mark it ready (gh pr ready), then reply to retry." else if mergeState = "waiting" and reviewThreads = 0 and failingChecks = 0 and pendingChecks = 0 then "This PR is merge-blocked with
|
|
269
|
+
<zeebe:input source="=if agentSlaJobType != null then "An automated merge-stage agent exceeded its time budget (SLA) before this PR could be merged. Check its progress or intervene, then reply to retry." else if mergeState = "draft" then "This PR is in draft and can't be merged. Mark it ready (gh pr ready), then reply to retry." else if mergeState = "conflict" then "This PR has a merge conflict with the base branch (GitHub reports the branch as CONFLICTING / mergeable_state=dirty). GitHub may not have run the pull_request checks on the conflicting head, so their state is unknown from this signal — the conflict alone is what is established. Resolve the conflict on the branch (git rebase / merge the base branch and push) — the rebase re-triggers CI — then reply to retry." else if mergeState = "blocked" then "GitHub reports failing required checks on this PR, and the merge loop could not get them green automatically. Fix the failing checks on the branch (or reply with guidance), then reply to retry." else if mergeState = "waiting" and reviewThreads = 0 and failingChecks = 0 and pendingChecks = 0 then "This PR is merge-blocked with every review thread resolved and no failing or pending checks reported. The likely cause is a required review approval (or code-owner review), but that is not verified: the declared-required checks may never have run on this head (GitHub skips pull_request workflows on a conflicting branch), so their state is not established. Check the PR on GitHub — approve it (or adjust the review requirement), or resolve any conflict (a rebase re-triggers CI) — then reply to retry." else if mergeState = "waiting" and reviewThreads != null and reviewThreads > 0 and failingChecks = 0 and pendingChecks = 0 then "This PR is merge-blocked with " + string(reviewThreads) + " unresolved review thread(s). Resolve those conversations on GitHub. Separately, no failing or pending checks were reported, but the declared-required checks may never have run on this head (GitHub skips pull_request workflows on a conflicting branch), so their state is not established — the block may also be a merge conflict whose checks never ran, or a required review approval. Resolve the threads, then resolve any conflict (a rebase re-triggers CI) or approve — then reply to retry." else if mergeState = "waiting" and (reviewThreads = null or reviewThreads < 0) and failingChecks = 0 and pendingChecks = 0 then "This PR is merge-blocked and its GitHub state could not be fully read (the review-thread probe was unreadable or failed), so neither a conflict nor the check/approval state is established. Check the PR on GitHub — resolve any conflict or failing required check if present — then reply to retry." else if mergeState = "waiting" then "GitHub never settled this PR's mergeability (still computing or checks still pending after repeated re-polls, or the state could not be read). Check the PR on GitHub — resolve any conflict or failing required check if present — then reply to retry." else "This PR is not mergeable (state: " + mergeState + "). Resolve the conflict or failing required check on the branch, then reply to retry."" target="question" />
|
|
267
270
|
</zeebe:ioMapping>
|
|
268
271
|
</bpmn:extensionElements>
|
|
269
272
|
<bpmn:incoming>f_m_mDraft</bpmn:incoming>
|
|
@@ -528,6 +531,7 @@
|
|
|
528
531
|
<zeebe:ioMapping>
|
|
529
532
|
<zeebe:output source="="escalate"" target="ciOutcome" />
|
|
530
533
|
<zeebe:output source="=null" target="agentSlaJobType" />
|
|
534
|
+
<zeebe:output source="="blocked"" target="mergeState" />
|
|
531
535
|
</zeebe:ioMapping>
|
|
532
536
|
</bpmn:extensionElements>
|
|
533
537
|
<bpmn:incoming>f_cib_esc</bpmn:incoming>
|
|
@@ -684,6 +688,7 @@
|
|
|
684
688
|
<zeebe:ioMapping>
|
|
685
689
|
<zeebe:output source="="escalate-attempt"" target="rebaseOutcome" />
|
|
686
690
|
<zeebe:output source="=null" target="agentSlaJobType" />
|
|
691
|
+
<zeebe:output source="="conflict"" target="mergeState" />
|
|
687
692
|
</zeebe:ioMapping>
|
|
688
693
|
</bpmn:extensionElements>
|
|
689
694
|
<bpmn:incoming>f_reb_blocked</bpmn:incoming>
|