Skip to content

Commit aeccb97

Browse files
fix: retire automatic live proof
Stop automatic live-proof execution, restore direct review publication, retain historical artifact compatibility, and separate retired proof/batch journeys from the default OpenClaw Bay view. Worked on by: - @brokemac79 Co-authored-by: brokemac79 <[email protected]>
1 parent a4592a0 commit aeccb97

41 files changed

Lines changed: 2986 additions & 2834 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/sweep.yml‎

Lines changed: 4 additions & 402 deletions
Large diffs are not rendered by default.

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ At a high level ClawSweeper:
3636
- reviews open issues and pull requests on a schedule and on exact GitHub events
3737
- writes one durable markdown report per item in generated state
3838
- syncs one marker-backed public review comment per issue or PR, edited in place
39-
- can record and attach deterministic browser or terminal live proof for
40-
user-visible changes in explicitly opted-in repositories
39+
- preserves validation, rendering, media publication, and retraction for
40+
historical live-proof artifacts; new reviews do not generate live proof
4141
- closes only unchanged, high-confidence, policy-allowed proposals
4242
- routes maintainer commands such as `@clawsweeper review`,
4343
`@clawsweeper fix`, `@clawsweeper autofix`, and `@clawsweeper automerge`

‎dashboard/bay-page.ts‎

Lines changed: 24 additions & 17 deletions
Large diffs are not rendered by default.

‎dashboard/exact-review-decision.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,18 @@ export function exactReviewQueueIsBatchablePublication(
900900
);
901901
}
902902

903+
export function exactReviewQueueUsesLegacyBatchPath(item: Pick<ExactReviewQueueItem, "decision">) {
904+
// Terminal-finalization items are no longer batchable, but their original
905+
// publication path remains visible until command acknowledgement completes.
906+
// A projection-backed direct finalizer intentionally has no publication
907+
// payload, while both active and retained batch items keep theirs.
908+
return (
909+
exactReviewQueueIsPublication(item) &&
910+
Boolean(item.decision.publication) &&
911+
!item.decision.publication?.directLifecycle
912+
);
913+
}
914+
903915
export function exactReviewQueueHasCommandContext(item: Pick<ExactReviewQueueItem, "decision">) {
904916
const command = exactReviewQueueCommandStatusAddress(item.decision);
905917
return Boolean(command.statusMarker || command.statusCommentId);

‎dashboard/exact-review-lifecycle-telemetry.ts‎

Lines changed: 539 additions & 49 deletions
Large diffs are not rendered by default.

‎dashboard/exact-review-queue.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,7 +3020,13 @@ export class ExactReviewQueue {
30203020
supersededRevisions: [],
30213021
}
30223022
: this.directPublicationStore.accept(validated, now);
3023-
this.recordLifecycleDirectPublication({ validated, owned, accepted, now });
3023+
this.recordLifecycleDirectPublication({
3024+
validated,
3025+
owned,
3026+
accepted,
3027+
now,
3028+
publicationPath: deferredBatchCompletion ? "batch" : "direct",
3029+
});
30243030
if (!deferredBatchCompletion) {
30253031
this.recordLifecycleTelemetryDirect({
30263032
validated,
@@ -3522,6 +3528,9 @@ export class ExactReviewQueue {
35223528
const bayActiveKeys = exactReviewQueueBayActiveKeys(
35233529
url.searchParams.getAll("bay_active_key"),
35243530
);
3531+
const bayActiveLegacyKeys = exactReviewQueueBayActiveKeys(
3532+
url.searchParams.getAll("bay_active_legacy_key"),
3533+
);
35253534
const now = Date.now();
35263535
const snapshot = this.storage.transactionSync(() => {
35273536
this.pruneDeliveryReceiptsSync(now);
@@ -3622,6 +3631,7 @@ export class ExactReviewQueue {
36223631
bayPriorityKeys,
36233632
batchByItemKey,
36243633
bayActiveKeys,
3634+
bayActiveLegacyKeys,
36253635
);
36263636
return json({
36273637
...stats,
@@ -7019,7 +7029,7 @@ export class ExactReviewQueue {
70197029
this.syncBayLifecycle(terminal);
70207030
}
70217031

7022-
private recordLifecycleDirectPublication({ validated, owned, accepted, now }) {
7032+
private recordLifecycleDirectPublication({ validated, owned, accepted, now, publicationPath }) {
70237033
const sourceDecision = owned?.decision.publication
70247034
? owned.decision.publication.producerDecision
70257035
: (owned?.leaseDecision ?? owned?.decision);
@@ -7085,7 +7095,7 @@ export class ExactReviewQueue {
70857095
this.lifecycleProjectionStore.recordCanonicalReceipt({
70867096
...identity,
70877097
outcome: accepted.outcome,
7088-
receiptId: `direct:${validated.fenceKey}:${validated.revision}:${accepted.outcome}`,
7098+
receiptId: `${publicationPath === "batch" ? "batch" : "direct-v2"}:${validated.fenceKey}:${validated.revision}:${accepted.outcome}`,
70897099
observedAt: now,
70907100
});
70917101
if (accepted.outcome === "superseded") {

‎dashboard/exact-review-read-model.ts‎

Lines changed: 89 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
exactReviewQueueHasCommandContext,
44
exactReviewQueueIsBatchablePublication,
55
exactReviewQueueIsPublication,
6+
exactReviewQueueUsesLegacyBatchPath,
67
isLowPriorityExactReviewDecision,
78
} from "./exact-review-decision.ts";
89
import { numberFrom } from "./exact-review-queue-shared.ts";
@@ -187,6 +188,7 @@ type ExactReviewBayProjectionItem = {
187188
created_at: string;
188189
updated_at: string;
189190
next_attempt_at: string;
191+
legacy_batch_path: boolean;
190192
batch_id?: string;
191193
batch_created_at?: string;
192194
};
@@ -651,9 +653,24 @@ function observeExactReviewBayCandidate(
651653
updatedAt,
652654
};
653655
const previous = projected.get(itemKey);
654-
const latest = previous?.[0];
655-
if (!latest || updatedAt > latest.updatedAt) {
656+
if (!previous) {
656657
projected.set(itemKey, [candidate]);
658+
return true;
659+
}
660+
const legacyBatchPath = exactReviewQueueUsesLegacyBatchPath(item);
661+
const samePath = previous.filter(
662+
(existing) => exactReviewQueueUsesLegacyBatchPath(existing.item) === legacyBatchPath,
663+
);
664+
const latest = samePath[0];
665+
if (!latest) {
666+
previous.push(candidate);
667+
} else if (updatedAt > latest.updatedAt) {
668+
projected.set(itemKey, [
669+
...previous.filter(
670+
(existing) => exactReviewQueueUsesLegacyBatchPath(existing.item) !== legacyBatchPath,
671+
),
672+
candidate,
673+
]);
657674
} else if (updatedAt === latest.updatedAt) {
658675
previous.push(candidate);
659676
}
@@ -674,6 +691,7 @@ export function exactReviewQueueBayProjection(
674691
priorityItemKeys: string[] = [],
675692
batchByItemKey: ReadonlyMap<string, ExactReviewBayBatchOwner> = new Map(),
676693
activeItemKeys: string[] = [],
694+
activeLegacyItemKeys: string[] = [],
677695
) {
678696
const census = buildExactReviewQueueCensus(items, {
679697
state: { items: {} },
@@ -684,6 +702,7 @@ export function exactReviewQueueBayProjection(
684702
priorityItemKeys,
685703
batchByItemKey,
686704
activeItemKeys,
705+
activeLegacyItemKeys,
687706
);
688707
}
689708

@@ -692,14 +711,17 @@ function exactReviewQueueBayProjectionFromCensus(
692711
priorityItemKeys: string[] = [],
693712
batchByItemKey: ReadonlyMap<string, ExactReviewBayBatchOwner> = new Map(),
694713
activeItemKeys: string[] = [],
714+
activeLegacyItemKeys: string[] = [],
695715
) {
696716
if (!census.bayComplete) {
697717
return {
698718
complete: false as const,
699719
sample_limit: EXACT_REVIEW_BAY_SAMPLE_LIMIT,
700720
total: null,
701721
stages: null,
722+
legacy_batch_stages: null,
702723
active_overlaps: null,
724+
legacy_batch_active_overlaps: null,
703725
items: [],
704726
};
705727
}
@@ -708,6 +730,9 @@ function exactReviewQueueBayProjectionFromCensus(
708730
ExactReviewBayStage,
709731
number
710732
>;
733+
const legacyBatchStages = Object.fromEntries(
734+
EXACT_REVIEW_BAY_STAGES.map((stage) => [stage, 0]),
735+
) as Record<ExactReviewBayStage, number>;
711736
const rowsByStage: Record<ExactReviewBayStage, ExactReviewBayProjectionItem[]> = {
712737
arriving: [],
713738
"setting-up": [],
@@ -717,7 +742,10 @@ function exactReviewQueueBayProjectionFromCensus(
717742
repairing: [],
718743
};
719744
for (const candidates of census.bayCandidates.values()) {
720-
const [first, ...remaining] = candidates;
745+
const directCandidates = candidates.filter(
746+
(candidate) => !exactReviewQueueUsesLegacyBatchPath(candidate.item),
747+
);
748+
const [first, ...remaining] = directCandidates.length > 0 ? directCandidates : candidates;
721749
if (!first) continue;
722750
let selected = first;
723751
let selectedStage = exactReviewQueueBayStage(selected.item, batchByItemKey);
@@ -740,10 +768,12 @@ function exactReviewQueueBayProjectionFromCensus(
740768
created_at: new Date(selected.item.createdAt).toISOString(),
741769
updated_at: new Date(selected.item.updatedAt).toISOString(),
742770
next_attempt_at: new Date(selected.item.nextAttemptAt).toISOString(),
771+
legacy_batch_path: exactReviewQueueUsesLegacyBatchPath(selected.item),
743772
...(batch ? { batch_id: batch.batchId } : {}),
744773
};
745774
projected.set(row.item_key, row);
746775
stages[row.stage] += 1;
776+
if (row.legacy_batch_path) legacyBatchStages[row.stage] += 1;
747777
rowsByStage[row.stage].push(row);
748778
}
749779
for (const stage of EXACT_REVIEW_BAY_STAGES) {
@@ -756,37 +786,71 @@ function exactReviewQueueBayProjectionFromCensus(
756786
const activeOverlaps = Object.fromEntries(
757787
EXACT_REVIEW_BAY_STAGES.map((stage) => [stage, 0]),
758788
) as Record<ExactReviewBayStage, number>;
759-
for (const itemKey of exactReviewQueueBayActiveKeys(activeItemKeys)) {
760-
const item = projected.get(itemKey);
761-
if (item) activeOverlaps[item.stage] += 1;
789+
const legacyBatchActiveOverlaps = Object.fromEntries(
790+
EXACT_REVIEW_BAY_STAGES.map((stage) => [stage, 0]),
791+
) as Record<ExactReviewBayStage, number>;
792+
for (const [itemKeys, legacyBatchPath] of [
793+
[activeItemKeys, false],
794+
[activeLegacyItemKeys, true],
795+
] as const) {
796+
for (const itemKey of exactReviewQueueBayActiveKeys(itemKeys)) {
797+
const item = projected.get(itemKey);
798+
if (item && item.legacy_batch_path === legacyBatchPath) {
799+
activeOverlaps[item.stage] += 1;
800+
if (legacyBatchPath) legacyBatchActiveOverlaps[item.stage] += 1;
801+
}
802+
}
762803
}
763804
const priorityRows = exactReviewQueueBayPriorityKeys(priorityItemKeys)
764805
.map((itemKey) => projected.get(itemKey))
765-
.filter((item): item is ExactReviewBayProjectionItem => Boolean(item))
766-
.slice(0, EXACT_REVIEW_BAY_SAMPLE_LIMIT);
767-
const priorityKeys = new Set(priorityRows.map((item) => item.item_key));
768-
const sample = [...priorityRows];
769-
const longestStage = Math.max(
770-
...EXACT_REVIEW_BAY_STAGES.map((stage) => rowsByStage[stage].length),
771-
);
772-
for (
773-
let index = 0;
774-
sample.length < EXACT_REVIEW_BAY_SAMPLE_LIMIT && index < longestStage;
775-
index += 1
776-
) {
777-
for (const stage of EXACT_REVIEW_BAY_STAGES) {
778-
const item = rowsByStage[stage][index];
779-
if (!item || priorityKeys.has(item.item_key)) continue;
780-
sample.push(item);
781-
if (sample.length === EXACT_REVIEW_BAY_SAMPLE_LIMIT) break;
806+
.filter((item): item is ExactReviewBayProjectionItem => Boolean(item));
807+
const sampledKeys = new Set<string>();
808+
const sample: ExactReviewBayProjectionItem[] = [];
809+
const append = (item: ExactReviewBayProjectionItem | undefined, legacyBatchPath: boolean) => {
810+
if (
811+
!item ||
812+
item.legacy_batch_path !== legacyBatchPath ||
813+
sampledKeys.has(item.item_key) ||
814+
sample.length >= EXACT_REVIEW_BAY_SAMPLE_LIMIT
815+
) {
816+
return;
817+
}
818+
sampledKeys.add(item.item_key);
819+
sample.push(item);
820+
};
821+
// The default Bay view hides legacy proof/batch journeys. Sample every
822+
// available normal direct journey before legacy rows so hidden records
823+
// cannot consume the bounded public-reference budget.
824+
for (const legacyBatchPath of [false, true]) {
825+
const categoryRowsByStage = Object.fromEntries(
826+
EXACT_REVIEW_BAY_STAGES.map((stage) => [
827+
stage,
828+
rowsByStage[stage].filter((item) => item.legacy_batch_path === legacyBatchPath),
829+
]),
830+
) as Record<ExactReviewBayStage, ExactReviewBayProjectionItem[]>;
831+
const longestCategoryStage = Math.max(
832+
...EXACT_REVIEW_BAY_STAGES.map((stage) => categoryRowsByStage[stage].length),
833+
);
834+
for (const item of priorityRows) append(item, legacyBatchPath);
835+
for (
836+
let index = 0;
837+
sample.length < EXACT_REVIEW_BAY_SAMPLE_LIMIT && index < longestCategoryStage;
838+
index += 1
839+
) {
840+
for (const stage of EXACT_REVIEW_BAY_STAGES) {
841+
append(categoryRowsByStage[stage][index], legacyBatchPath);
842+
if (sample.length === EXACT_REVIEW_BAY_SAMPLE_LIMIT) break;
843+
}
782844
}
783845
}
784846
return {
785847
complete: true as const,
786848
sample_limit: EXACT_REVIEW_BAY_SAMPLE_LIMIT,
787849
total: projected.size,
788850
stages,
851+
legacy_batch_stages: legacyBatchStages,
789852
active_overlaps: activeOverlaps,
853+
legacy_batch_active_overlaps: legacyBatchActiveOverlaps,
790854
items: sample,
791855
};
792856
}
@@ -1205,6 +1269,7 @@ export function exactReviewQueueBayProjectionFromStats(
12051269
priorityItemKeys: string[] = [],
12061270
batchByItemKey: ReadonlyMap<string, ExactReviewBayBatchOwner> = new Map(),
12071271
activeItemKeys: string[] = [],
1272+
activeLegacyItemKeys: string[] = [],
12081273
) {
12091274
const census = stats[EXACT_REVIEW_STATS_CENSUS];
12101275
if (!census) throw new Error("exact-review queue stats are missing their census");
@@ -1213,6 +1278,7 @@ export function exactReviewQueueBayProjectionFromStats(
12131278
priorityItemKeys,
12141279
batchByItemKey,
12151280
activeItemKeys,
1281+
activeLegacyItemKeys,
12161282
);
12171283
Object.defineProperty(stats, "bay_projection", {
12181284
value: projection,

0 commit comments

Comments
 (0)