@@ -5202,6 +5202,98 @@ test("Worker lifecycle projection permits one command acknowledgement after dura
52025202 assert.equal(lifecycle?.acknowledgement.attempts.length, 2);
52035203});
52045204
5205+ test("signed Worker records a status-ID-only terminal acknowledgement", async () => {
5206+ const storage = new MemoryDurableStorage();
5207+ const queue = new ExactReviewQueue({ storage }, {});
5208+ const lifecycle = new ExactReviewLifecycleProjectionStore(storage);
5209+ const identity = {
5210+ canonicalTargetKey: "openclaw/openclaw#779",
5211+ fenceKey: "openclaw/openclaw#779@exact:status-id-only",
5212+ revision: 1,
5213+ };
5214+ lifecycle.recordAdmission({
5215+ ...identity,
5216+ deliveryId: "status-id-only-delivery:779",
5217+ sourceAction: "re_review",
5218+ commandOriginated: true,
5219+ statusMarker: null,
5220+ statusCommentId: 9011,
5221+ observedAt: 1_700_000_000_000,
5222+ });
5223+ lifecycle.recordCanonicalReceipt({
5224+ ...identity,
5225+ outcome: "accepted",
5226+ receiptId: "status-id-only-canonical:779",
5227+ observedAt: 1_700_000_000_001,
5228+ });
5229+ lifecycle.recordRouterReceipt({
5230+ ...identity,
5231+ outcome: "durable",
5232+ receiptId: "status-id-only-router:779",
5233+ observedAt: 1_700_000_000_002,
5234+ });
5235+ lifecycle.recordTerminalDisposition({
5236+ ...identity,
5237+ kind: "review_completed_routed",
5238+ observedAt: 1_700_000_000_003,
5239+ });
5240+ assert.equal(
5241+ lifecycle.authorizeCommandAcknowledgement({
5242+ ...identity,
5243+ statusMarker: null,
5244+ statusCommentId: 9011,
5245+ observedAt: 1_700_000_000_004,
5246+ }).allowed,
5247+ true,
5248+ );
5249+
5250+ const secret = "status-id-only-lifecycle-secret";
5251+ const payload = {
5252+ canonical_target_key: "openclaw/openclaw#779",
5253+ command_comment_id: 9010,
5254+ completion_comment_id: 9011,
5255+ observed_at: 1_700_000_000_005,
5256+ };
5257+ const body = JSON.stringify(payload);
5258+ const response = await worker.fetch(
5259+ new Request(
5260+ "https://clawsweeper.openclaw.ai/internal/exact-review/lifecycle/command-ack/observed",
5261+ {
5262+ method: "POST",
5263+ headers: {
5264+ "content-type": "application/json",
5265+ "x-clawsweeper-exact-review-signature": `sha256=${createHmac("sha256", secret)
5266+ .update(body)
5267+ .digest("hex")}`,
5268+ },
5269+ body,
5270+ },
5271+ ),
5272+ {
5273+ CLAWSWEEPER_WEBHOOK_SECRET: secret,
5274+ EXACT_REVIEW_QUEUE: new MemoryDurableNamespace(queue),
5275+ },
5276+ );
5277+
5278+ assert.deepEqual(await response.json(), {
5279+ ok: true,
5280+ accepted: true,
5281+ lifecycle_state: "completed",
5282+ acknowledgement_state: "observed",
5283+ version: 1,
5284+ });
5285+ assert.deepEqual(
5286+ lifecycle.read(identity.canonicalTargetKey, identity.fenceKey, identity.revision)
5287+ ?.acknowledgement.observed,
5288+ {
5289+ statusMarker: null,
5290+ commandCommentId: 9010,
5291+ completionCommentId: 9011,
5292+ observedAt: 1_700_000_000_005,
5293+ },
5294+ );
5295+ });
5296+
52055297test("Worker lifecycle acknowledgement preserves canonical GitHub repository casing", async () => {
52065298 const storage = new MemoryDurableStorage();
52075299 const queue = new ExactReviewQueue({ storage }, {});
0 commit comments