@lazyingart/agintiflow 0.20.263 → 0.20.264

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.263",
3
+ "version": "0.20.264",
4
4
  "type": "module",
5
5
  "description": "AgInTiFlow is a project-aware agent workspace for hybrid wet-dry R&D, hardware-aware intelligence, software automation, and industrial workflows.",
6
6
  "license": "Apache-2.0",
@@ -215,6 +215,40 @@ async function main() {
215
215
  )) === JSON.stringify({ type: "function", function: { name: "apply_patch" } }),
216
216
  "DeepSeek failed-test repair did not force its sole bounded mutation tool"
217
217
  );
218
+ assert(
219
+ JSON.stringify(toolChoiceForProvider(
220
+ {
221
+ provider: "deepseek",
222
+ testFailureRepairActive: true,
223
+ testFailureRepairMutationRequired: true,
224
+ testFailureRepairOptionalRereadPaths: ["service.py"],
225
+ },
226
+ [{ role: "user", content: "Apply the coherent repair from retained evidence." }],
227
+ [
228
+ { type: "function", function: { name: "read_file" } },
229
+ { type: "function", function: { name: "apply_patch" } },
230
+ { type: "function", function: { name: "finish" } },
231
+ ]
232
+ )) === JSON.stringify({ type: "function", function: { name: "apply_patch" } }),
233
+ "DeepSeek bounded reread fallback displaced the required repair mutation"
234
+ );
235
+ assert(
236
+ JSON.stringify(toolChoiceForProvider(
237
+ {
238
+ provider: "deepseek",
239
+ testFailureRepairActive: true,
240
+ testFailureRepairMutationRequired: true,
241
+ testFailureRepairNeedsPatchContext: true,
242
+ },
243
+ [{ role: "user", content: "Continue from the retained failing test evidence." }],
244
+ [
245
+ { type: "function", function: { name: "read_file" } },
246
+ { type: "function", function: { name: "apply_patch" } },
247
+ { type: "function", function: { name: "finish" } },
248
+ ]
249
+ )) === JSON.stringify({ type: "function", function: { name: "read_file" } }),
250
+ "DeepSeek failed-test repair did not force its bounded context refresh first"
251
+ );
218
252
  assert(
219
253
  toolChoiceForProvider(
220
254
  { provider: "deepseek" },
@@ -292,6 +326,61 @@ async function main() {
292
326
  !Object.hasOwn(deepSeekActionPayload || {}, "reasoning_effort"),
293
327
  "DeepSeek action-only recovery sent a conflicting reasoning effort"
294
328
  );
329
+ let deepSeekRepairReadPayload = null;
330
+ await requestNextStep(
331
+ {
332
+ chat: {
333
+ completions: {
334
+ create: async (payload) => {
335
+ deepSeekRepairReadPayload = payload;
336
+ return {
337
+ choices: [{
338
+ message: {
339
+ role: "assistant",
340
+ content: "",
341
+ tool_calls: [{
342
+ id: "deepseek-repair-read",
343
+ type: "function",
344
+ function: {
345
+ name: "read_file",
346
+ arguments: JSON.stringify({ path: "service.py" }),
347
+ },
348
+ }],
349
+ },
350
+ }],
351
+ };
352
+ },
353
+ },
354
+ },
355
+ },
356
+ {
357
+ provider: "deepseek",
358
+ model: "deepseek-v4-pro",
359
+ reasoning: "xhigh",
360
+ goal: "Repair service.py from the exact failed test evidence.",
361
+ taskProfile: "code",
362
+ allowFileTools: true,
363
+ allowShellTool: false,
364
+ allowWebSearch: false,
365
+ allowMcpTools: false,
366
+ allowWrapperTools: false,
367
+ allowAuxiliaryTools: false,
368
+ testFailureRepairActive: true,
369
+ testFailureRepairMutationRequired: true,
370
+ testFailureRepairNeedsPatchContext: true,
371
+ testFailureRepairPatchTargets: ["service.py"],
372
+ testFailureRepairContextPaths: ["service.py"],
373
+ },
374
+ [{ role: "user", content: "Continue from the retained failing test evidence." }]
375
+ );
376
+ assert(
377
+ deepSeekRepairReadPayload?.tool_choice?.function?.name === "read_file",
378
+ "DeepSeek failed-test repair request did not force the bounded context read"
379
+ );
380
+ assert(
381
+ deepSeekRepairReadPayload?.thinking?.type === "disabled",
382
+ "DeepSeek failed-test context refresh spent another unbounded reasoning pass"
383
+ );
295
384
 
296
385
  assert(!isPublicWebUrl("http://127.0.0.1/private"), "public URL guard accepted loopback");
297
386
  assert(!isPublicWebUrl("http://10.0.0.1/private"), "public URL guard accepted RFC1918 address");
@@ -2,6 +2,7 @@
2
2
  import crypto from "node:crypto";
3
3
  import { spawnSync } from "node:child_process";
4
4
  import fs from "node:fs/promises";
5
+ import net from "node:net";
5
6
  import os from "node:os";
6
7
  import path from "node:path";
7
8
  import { fileURLToPath } from "node:url";
@@ -264,7 +265,7 @@ try {
264
265
  }],
265
266
  },
266
267
  failedTestDiagnostic: {
267
- packetVersion: 13,
268
+ packetVersion: 15,
268
269
  mutationRevision: 0,
269
270
  failureSignature: "python-entrypoint-order",
270
271
  focuses: [{
@@ -645,6 +646,137 @@ try {
645
646
  )) === null,
646
647
  "the exact cwd-independent agent-created test harness repair was blocked"
647
648
  );
649
+ const foreignListener = net.createServer((socket) => socket.end());
650
+ await new Promise((resolve, reject) => {
651
+ foreignListener.once("error", reject);
652
+ foreignListener.listen(0, "127.0.0.1", resolve);
653
+ });
654
+ try {
655
+ const collisionPort = Number(foreignListener.address()?.port || 0);
656
+ assert(collisionPort >= 1024, "failed to allocate the foreign-listener smoke port");
657
+ await fs.writeFile(
658
+ path.join(baselineWorkspace, "service_ctl.py"),
659
+ [
660
+ "from pathlib import Path",
661
+ "",
662
+ 'GATEWAY = Path(__file__).resolve().parent / "gateway_service.py"',
663
+ "raise SystemExit(0)",
664
+ "",
665
+ ].join("\n"),
666
+ "utf8"
667
+ );
668
+ await fs.writeFile(
669
+ path.join(baselineWorkspace, "gateway_service.py"),
670
+ "print('sensor gateway fixture')\n",
671
+ "utf8"
672
+ );
673
+ const portCollisionSource = [
674
+ "import subprocess",
675
+ "import sys",
676
+ "import unittest",
677
+ "from pathlib import Path",
678
+ "",
679
+ 'SERVICE_CTL = (Path(__file__).resolve().parent / "../service_ctl.py").resolve()',
680
+ "",
681
+ "class TestLifecycle(unittest.TestCase):",
682
+ " def test_start(self):",
683
+ ` first = subprocess.run([sys.executable, SERVICE_CTL, "start", "--port", "${collisionPort}"], capture_output=True)`,
684
+ ` second = subprocess.run([sys.executable, SERVICE_CTL, "status", "--port", "${collisionPort}"], capture_output=True)`,
685
+ " self.assertEqual(first.returncode, 0)",
686
+ " self.assertEqual(second.returncode, 0)",
687
+ "",
688
+ ].join("\n");
689
+ await fs.writeFile(harnessTestPath, portCollisionSource, "utf8");
690
+ const portCollisionState = {
691
+ meta: {
692
+ projectVerification: {
693
+ mutationRevision: 5,
694
+ discoveredTests: ["tests/test_service_lifecycle.py"],
695
+ testRuns: [{
696
+ command: "python3 -m unittest discover -s tests -v",
697
+ mutationRevision: 5,
698
+ passed: false,
699
+ failureEvidenceVersion: 2,
700
+ failureSignature: "agent-created-test-foreign-port-collision",
701
+ failureSummary:
702
+ "test_start AssertionError: 1 != 0 while starting the task service",
703
+ }],
704
+ },
705
+ },
706
+ };
707
+ const portCollisionPacket = await buildFailedTestRecoveryPacket(
708
+ { commandCwd: baselineWorkspace },
709
+ portCollisionState
710
+ );
711
+ const portCollisionFocus = portCollisionState.meta.failedTestDiagnostic.focuses.find(
712
+ (focus) => focus.kind === "python-agent-test-foreign-port-collision"
713
+ );
714
+ assert(
715
+ portCollisionPacket.content.includes("Foreign listener collision") &&
716
+ portCollisionPacket.paths.includes("gateway_service.py") &&
717
+ portCollisionFocus?.path === "tests/test_service_lifecycle.py" &&
718
+ portCollisionFocus?.ports?.[0] === collisionPort &&
719
+ portCollisionFocus?.portOccurrences === 2 &&
720
+ portCollisionFocus?.listenerEvidence?.[0]?.ownership === "outside-task-workspace" &&
721
+ portCollisionFocus?.testNames?.join(",") === "test_start" &&
722
+ portCollisionFocus?.assertionCount === 2,
723
+ "a foreign hard-coded port or its exact executable dependency was not retained for repair"
724
+ );
725
+ const dynamicPortSource = [
726
+ "import socket",
727
+ "import subprocess",
728
+ "import sys",
729
+ "import unittest",
730
+ "from pathlib import Path",
731
+ "",
732
+ 'SERVICE_CTL = (Path(__file__).resolve().parent / "../service_ctl.py").resolve()',
733
+ "",
734
+ "def free_port():",
735
+ " with socket.socket() as probe:",
736
+ ' probe.bind(("127.0.0.1", 0))',
737
+ " return probe.getsockname()[1]",
738
+ "",
739
+ "class TestLifecycle(unittest.TestCase):",
740
+ " def test_start(self):",
741
+ " port = free_port()",
742
+ " first = subprocess.run([sys.executable, SERVICE_CTL, \"start\", \"--port\", str(port)], capture_output=True)",
743
+ " second = subprocess.run([sys.executable, SERVICE_CTL, \"status\", \"--port\", str(port)], capture_output=True)",
744
+ " self.assertEqual(first.returncode, 0)",
745
+ " self.assertEqual(second.returncode, 0)",
746
+ "",
747
+ ].join("\n");
748
+ assert(
749
+ (await failedTestRepairPatchBlock(
750
+ portCollisionState,
751
+ "apply_patch",
752
+ {
753
+ path: "tests/test_service_lifecycle.py",
754
+ search: portCollisionSource,
755
+ replace: dynamicPortSource.replace(
756
+ " self.assertEqual(second.returncode, 0)",
757
+ " self.assertTrue(True)"
758
+ ),
759
+ },
760
+ { commandCwd: baselineWorkspace }
761
+ ))?.category === "failed-test-regression",
762
+ "foreign-port isolation was allowed to change the assertion-method contract"
763
+ );
764
+ assert(
765
+ (await failedTestRepairPatchBlock(
766
+ portCollisionState,
767
+ "apply_patch",
768
+ {
769
+ path: "tests/test_service_lifecycle.py",
770
+ search: portCollisionSource,
771
+ replace: dynamicPortSource,
772
+ },
773
+ { commandCwd: baselineWorkspace }
774
+ )) === null,
775
+ "a complete dynamic-port rewrite of the Git-new test was blocked"
776
+ );
777
+ } finally {
778
+ await new Promise((resolve) => foreignListener.close(resolve));
779
+ }
648
780
  for (const args of [
649
781
  ["add", "service_ctl.py", "tests/test_service_lifecycle.py"],
650
782
  ["commit", "-m", "tracked harness boundary"],
@@ -667,9 +799,11 @@ try {
667
799
  );
668
800
  assert(
669
801
  !trackedHarnessState.meta.failedTestDiagnostic.focuses.some(
670
- (focus) => focus.kind === "python-agent-test-harness-path"
802
+ (focus) =>
803
+ focus.kind === "python-agent-test-harness-path" ||
804
+ focus.kind === "python-agent-test-foreign-port-collision"
671
805
  ),
672
- "the agent-created test exception was incorrectly applied to a tracked authoritative test"
806
+ "an agent-created test exception was incorrectly applied to a tracked authoritative test"
673
807
  );
674
808
  await fs.mkdir(path.join(workspace, "tests"), { recursive: true });
675
809
  await fs.writeFile(
@@ -5078,6 +5212,69 @@ try {
5078
5212
  leadingContinuationUpdate?.refreshExecutionContract,
5079
5213
  "a leading bare continuation clause followed by concrete details became a new task"
5080
5214
  );
5215
+ const activeTaskContinuationState = structuredClone(concreteContinuationState);
5216
+ const retainedActiveTaskVerification = activeTaskContinuationState.meta.projectVerification;
5217
+ const activeTaskContinuationUpdate = applyContinuationContractTransition(
5218
+ activeTaskContinuationState,
5219
+ `Continue the exact active DevOps task from the current workspace. Diagnose the retained failures from exact evidence, rerun validation, and commit the coherent repair. ${"Preserve the existing task lineage while applying this correction. ".repeat(12)}`,
5220
+ { at: "2026-08-24T09:59:30.000Z" }
5221
+ );
5222
+ assert(
5223
+ activeTaskContinuationUpdate?.preserveTaskBoundary &&
5224
+ activeTaskContinuationUpdate?.refreshExecutionContract,
5225
+ "an explicit exact active-task continuation opened a new task boundary"
5226
+ );
5227
+ assert(
5228
+ activeTaskContinuationState.meta.projectVerification === retainedActiveTaskVerification,
5229
+ "an exact active-task continuation discarded durable verification evidence"
5230
+ );
5231
+ const postMutationVerifier = "python3 -m unittest discover -s tests -v";
5232
+ const postMutationVerificationState = {
5233
+ goal: "Repair and verify the current service controller.",
5234
+ meta: {
5235
+ goalContract: {
5236
+ revision: 12,
5237
+ currentRequest: "Repair and verify the current service controller.",
5238
+ },
5239
+ activeExecutionContract: {
5240
+ revision: 12,
5241
+ startedMutationRevision: 7,
5242
+ materialMutationRevision: 8,
5243
+ requiresFileMutation: true,
5244
+ requiresSourceGrounding: true,
5245
+ },
5246
+ projectVerification: {
5247
+ mutationRevision: 8,
5248
+ testRuns: [{
5249
+ command: postMutationVerifier,
5250
+ mutationRevision: 7,
5251
+ passed: false,
5252
+ failureEvidenceVersion: 2,
5253
+ failureSignature: "pre-repair-failure",
5254
+ }],
5255
+ },
5256
+ failedTestRecoveryPacket: {
5257
+ packetVersion: 15,
5258
+ mutationRevision: 7,
5259
+ failureSignature: "pre-repair-failure",
5260
+ content: "Bounded failed-test evidence packet v15.",
5261
+ },
5262
+ },
5263
+ };
5264
+ const postMutationVerificationRuntime = nextStepRuntimeConfig(
5265
+ {
5266
+ provider: "deepseek",
5267
+ taskProfile: "devops",
5268
+ commandCwd: workspace,
5269
+ goal: postMutationVerificationState.goal,
5270
+ },
5271
+ postMutationVerificationState
5272
+ );
5273
+ assert(
5274
+ postMutationVerificationRuntime.testVerificationPending === true &&
5275
+ postMutationVerificationRuntime.testVerificationCommand === postMutationVerifier,
5276
+ "a material failed-test repair did not advance directly to its exact retained verifier"
5277
+ );
5081
5278
  const concreteGoalUpdate = applyContinuationContractTransition(
5082
5279
  concreteContinuationState,
5083
5280
  concreteContinuation,
@@ -5716,6 +5913,29 @@ try {
5716
5913
  ) === null,
5717
5914
  "the repeated-read guard blocked an exact source refresh required after a stale patch"
5718
5915
  );
5916
+ assert(
5917
+ repeatedStaticToolBlock(
5918
+ {
5919
+ meta: {
5920
+ toolLoop: {
5921
+ staticCounts: {
5922
+ [staticToolCallSignature("read_file", { path: "service_ctl.py" }, {
5923
+ commandCwd: workspace,
5924
+ })]: 1,
5925
+ },
5926
+ staticTotal: 1,
5927
+ },
5928
+ },
5929
+ },
5930
+ "read_file",
5931
+ { path: "service_ctl.py" },
5932
+ {
5933
+ commandCwd: workspace,
5934
+ testFailureRepairContextPaths: ["service_ctl.py"],
5935
+ }
5936
+ ) === null,
5937
+ "the repeated-read guard blocked an exact bounded failed-test context refresh"
5938
+ );
5719
5939
  assert(
5720
5940
  repeatedStaticToolBlock(
5721
5941
  { meta: { toolLoop: { staticCounts: { [exactReadSignature]: 1 }, staticTotal: 1 } } },
@@ -6472,8 +6692,8 @@ try {
6472
6692
  "a same-task refresh could not rebuild a missing failed-test evidence packet"
6473
6693
  );
6474
6694
  missingRecoveryPacketState.meta.failedTestRecoveryPacket = {
6475
- packetVersion: 13,
6476
- content: "Bounded failed-test evidence packet v13.",
6695
+ packetVersion: 15,
6696
+ content: "Bounded failed-test evidence packet v15.",
6477
6697
  mutationRevision: 6,
6478
6698
  failureSignature: "same-failure",
6479
6699
  };
@@ -7331,7 +7551,7 @@ try {
7331
7551
  ],
7332
7552
  },
7333
7553
  failedTestDiagnostic: {
7334
- packetVersion: 13,
7554
+ packetVersion: 15,
7335
7555
  mutationRevision: 0,
7336
7556
  failureSignature: "partial-derived-order",
7337
7557
  focuses: [
@@ -539,12 +539,12 @@ const focusedRecoveryState = {
539
539
  }],
540
540
  },
541
541
  failedTestRecoveryPacket: {
542
- packetVersion: 13,
542
+ packetVersion: 15,
543
543
  mutationRevision: 4,
544
544
  failureSignature: "missing-service-seams",
545
545
  paths: ["tests/test_service_ctl.py", "service_ctl.py"],
546
546
  content: [
547
- "Bounded failed-test evidence packet v13.",
547
+ "Bounded failed-test evidence packet v15.",
548
548
  'with mock.patch.object(service_ctl, "launch_service") as launch:',
549
549
  'with mock.patch.object(service_ctl, "wait_until_healthy", return_value=True):',
550
550
  "### service_ctl.py",
@@ -588,7 +588,7 @@ assert.match(
588
588
  focusedRecoveryText,
589
589
  /Required acceptance seams: service_ctl\.launch_service, service_ctl\.wait_until_healthy/
590
590
  );
591
- assert.match(focusedRecoveryText, /Bounded failed-test evidence packet v13/);
591
+ assert.match(focusedRecoveryText, /Bounded failed-test evidence packet v15/);
592
592
  assert.match(focusedRecoveryText, /requires one coherent source mutation before verification/i);
593
593
 
594
594
  const durablePatchArgs = {