@elvis1513/auto-coding-skill 4.2.7 → 4.2.8
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/README.md +39 -9
- package/cli/assets/agents/reviewer.toml +2 -2
- package/cli/assets/managed-install.json +1 -1
- package/cli/assets/skill/SKILL.md +6 -7
- package/cli/assets/skill/data/policies/workflow-migrations-v1.json +2 -2
- package/cli/assets/skill/data/templates/ENGINEERING.md +2 -2
- package/cli/assets/skill/data/templates/bridges/AGENTS.md +13 -16
- package/cli/assets/skill/scripts/ap.py +1274 -91
- package/cli/tests/ap_concurrency_test.py +321 -33
- package/cli/tests/ap_profiles_test.py +326 -36
- package/cli/tests/index.test.js +23 -22
- package/package.json +1 -1
|
@@ -4,12 +4,15 @@ from __future__ import annotations
|
|
|
4
4
|
import argparse
|
|
5
5
|
import base64
|
|
6
6
|
import contextlib
|
|
7
|
+
import hashlib
|
|
7
8
|
import io
|
|
8
9
|
import json
|
|
9
10
|
import os
|
|
11
|
+
import signal
|
|
10
12
|
import subprocess
|
|
11
13
|
import sys
|
|
12
14
|
import tempfile
|
|
15
|
+
import threading
|
|
13
16
|
import time
|
|
14
17
|
import tomllib
|
|
15
18
|
import unittest
|
|
@@ -780,65 +783,352 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
780
783
|
repo, _ = self.make_repo()
|
|
781
784
|
assignment_path = repo / "assignment.json"
|
|
782
785
|
result_path = repo / "result.json"
|
|
786
|
+
reviewer_config = repo / ".agents" / "agents" / "reviewer.toml"
|
|
787
|
+
reviewer_config.parent.mkdir(parents=True)
|
|
788
|
+
reviewer_config.write_text(
|
|
789
|
+
'name = "reviewer"\n'
|
|
790
|
+
'model = "vendor/reviewer-model"\n'
|
|
791
|
+
'developer_instructions = "review only the immutable artifact"\n',
|
|
792
|
+
encoding="utf-8",
|
|
793
|
+
)
|
|
783
794
|
with mock.patch.object(ap.shutil, "which", return_value="/usr/local/bin/codex"):
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
795
|
+
focused = ap._codex_reviewer_command(
|
|
796
|
+
repo,
|
|
797
|
+
assignment_path,
|
|
798
|
+
result_path,
|
|
799
|
+
review_depth="focused",
|
|
800
|
+
)
|
|
801
|
+
deep = ap._codex_reviewer_command(
|
|
802
|
+
repo,
|
|
803
|
+
assignment_path,
|
|
804
|
+
result_path,
|
|
805
|
+
review_depth="deep",
|
|
806
|
+
)
|
|
807
|
+
|
|
808
|
+
self.assertEqual("/usr/local/bin/codex", focused[0])
|
|
809
|
+
self.assertIn("--json", focused)
|
|
810
|
+
self.assertIn("--ephemeral", focused)
|
|
811
|
+
self.assertIn("--ignore-user-config", focused)
|
|
812
|
+
self.assertIn("read-only", focused)
|
|
813
|
+
self.assertIn('model_reasoning_effort="high"', focused)
|
|
814
|
+
self.assertIn('model_reasoning_effort="xhigh"', deep)
|
|
815
|
+
self.assertEqual("vendor/reviewer-model", focused[focused.index("--model") + 1])
|
|
816
|
+
prompt = focused[-1]
|
|
792
817
|
self.assertIn("docs/tools/autopipeline/ap.py review-artifact --file", prompt)
|
|
793
818
|
self.assertIn("diff_artifact_sha256", prompt)
|
|
794
819
|
self.assertIn("never substitute a live git diff", prompt)
|
|
795
820
|
developer_override = next(
|
|
796
|
-
item for item in
|
|
821
|
+
item for item in focused if item.startswith("developer_instructions=")
|
|
797
822
|
)
|
|
798
823
|
tomllib.loads(developer_override)
|
|
799
|
-
self.assertEqual(str(result_path),
|
|
824
|
+
self.assertEqual(str(result_path), focused[focused.index("-o") + 1])
|
|
800
825
|
|
|
801
826
|
def test_reviewer_process_timeout_terminates_its_process_group(self) -> None:
|
|
802
827
|
repo, _ = self.make_repo()
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
("
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
828
|
+
runner = repo / "slow-reviewer.py"
|
|
829
|
+
runner.write_text(
|
|
830
|
+
"import json, sys, time\n"
|
|
831
|
+
"print(json.dumps({'type': 'turn.started'}), flush=True)\n"
|
|
832
|
+
"print('Bearer secret-token password=hunter2', file=sys.stderr, flush=True)\n"
|
|
833
|
+
"time.sleep(30)\n",
|
|
834
|
+
encoding="utf-8",
|
|
835
|
+
)
|
|
836
|
+
started = time.monotonic()
|
|
837
|
+
with self.assertRaises(ap._ReviewerRuntimeTimeout) as raised:
|
|
838
|
+
ap._run_supervised_reviewer_process(
|
|
839
|
+
[sys.executable, str(runner)],
|
|
840
|
+
cwd=repo,
|
|
841
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
842
|
+
timeout_seconds=0.3,
|
|
843
|
+
startup_timeout_seconds=0.2,
|
|
844
|
+
)
|
|
845
|
+
self.assertLess(time.monotonic() - started, 3.0)
|
|
846
|
+
self.assertEqual(1, raised.exception.diagnostics["event_count"])
|
|
847
|
+
safe = ap._safe_reviewer_attempt(raised.exception.diagnostics, 1, "analysis-timeout")
|
|
848
|
+
self.assertNotIn("secret-token", json.dumps(safe))
|
|
849
|
+
self.assertNotIn("hunter2", json.dumps(safe))
|
|
850
|
+
|
|
851
|
+
@unittest.skipUnless(os.name == "posix", "POSIX process-group behavior")
|
|
852
|
+
def test_reviewer_timeout_kills_group_after_leader_exits(self) -> None:
|
|
853
|
+
repo, _ = self.make_repo()
|
|
854
|
+
child_pid_path = repo / "reviewer-grandchild.pid"
|
|
855
|
+
runner = repo / "leader-exits-reviewer.py"
|
|
856
|
+
runner.write_text(
|
|
857
|
+
"import json, subprocess, sys\n"
|
|
858
|
+
"from pathlib import Path\n"
|
|
859
|
+
"child = subprocess.Popen([sys.executable, '-c', 'import time; time.sleep(30)'])\n"
|
|
860
|
+
f"Path({str(child_pid_path)!r}).write_text(str(child.pid))\n"
|
|
861
|
+
"print(json.dumps({'type': 'turn.started'}), flush=True)\n",
|
|
862
|
+
encoding="utf-8",
|
|
863
|
+
)
|
|
864
|
+
started = time.monotonic()
|
|
865
|
+
with self.assertRaises(ap._ReviewerRuntimeTimeout):
|
|
866
|
+
ap._run_supervised_reviewer_process(
|
|
867
|
+
[sys.executable, str(runner)],
|
|
868
|
+
cwd=repo,
|
|
869
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
870
|
+
timeout_seconds=0.3,
|
|
871
|
+
startup_timeout_seconds=0.2,
|
|
872
|
+
)
|
|
873
|
+
self.assertLess(time.monotonic() - started, 3.0)
|
|
874
|
+
child_pid = int(child_pid_path.read_text())
|
|
875
|
+
child_gone = False
|
|
876
|
+
for _ in range(20):
|
|
877
|
+
try:
|
|
878
|
+
os.kill(child_pid, 0)
|
|
879
|
+
except ProcessLookupError:
|
|
880
|
+
child_gone = True
|
|
881
|
+
break
|
|
882
|
+
time.sleep(0.05)
|
|
883
|
+
self.assertTrue(child_gone, "Reviewer grandchild survived process-group cleanup")
|
|
884
|
+
|
|
885
|
+
@unittest.skipUnless(os.name == "posix", "POSIX detached-process behavior")
|
|
886
|
+
def test_detached_pipe_holder_cannot_extend_reviewer_deadline(self) -> None:
|
|
887
|
+
repo, _ = self.make_repo()
|
|
888
|
+
child_pid_path = repo / "detached-reviewer-child.pid"
|
|
889
|
+
runner = repo / "detached-child-reviewer.py"
|
|
890
|
+
runner.write_text(
|
|
891
|
+
"import json, subprocess, sys\n"
|
|
892
|
+
"from pathlib import Path\n"
|
|
893
|
+
"child = subprocess.Popen([sys.executable, '-c', 'import time; time.sleep(30)'], start_new_session=True)\n"
|
|
894
|
+
f"Path({str(child_pid_path)!r}).write_text(str(child.pid))\n"
|
|
895
|
+
"print(json.dumps({'type': 'turn.started'}), flush=True)\n",
|
|
896
|
+
encoding="utf-8",
|
|
897
|
+
)
|
|
898
|
+
started = time.monotonic()
|
|
899
|
+
child_pid = 0
|
|
900
|
+
try:
|
|
814
901
|
with self.assertRaises(ap._ReviewerRuntimeTimeout):
|
|
815
902
|
ap._run_supervised_reviewer_process(
|
|
816
|
-
[
|
|
903
|
+
[sys.executable, str(runner)],
|
|
904
|
+
cwd=repo,
|
|
905
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
906
|
+
timeout_seconds=0.3,
|
|
907
|
+
startup_timeout_seconds=0.2,
|
|
908
|
+
)
|
|
909
|
+
child_pid = int(child_pid_path.read_text())
|
|
910
|
+
finally:
|
|
911
|
+
if not child_pid and child_pid_path.exists():
|
|
912
|
+
child_pid = int(child_pid_path.read_text())
|
|
913
|
+
if child_pid:
|
|
914
|
+
try:
|
|
915
|
+
os.kill(child_pid, signal.SIGKILL)
|
|
916
|
+
except ProcessLookupError:
|
|
917
|
+
pass
|
|
918
|
+
self.assertLess(time.monotonic() - started, 3.0)
|
|
919
|
+
self.assertFalse(
|
|
920
|
+
any(thread.name.startswith("reviewer-stream-") for thread in threading.enumerate())
|
|
921
|
+
)
|
|
922
|
+
|
|
923
|
+
def test_reviewer_process_without_first_event_is_runtime_unavailable(self) -> None:
|
|
924
|
+
repo, _ = self.make_repo()
|
|
925
|
+
runner = repo / "silent-reviewer.py"
|
|
926
|
+
runner.write_text("import time\ntime.sleep(30)\n", encoding="utf-8")
|
|
927
|
+
with self.assertRaises(ap._ReviewerRuntimeUnavailable) as raised:
|
|
928
|
+
ap._run_supervised_reviewer_process(
|
|
929
|
+
[sys.executable, str(runner)],
|
|
930
|
+
cwd=repo,
|
|
931
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
932
|
+
timeout_seconds=1,
|
|
933
|
+
startup_timeout_seconds=0.1,
|
|
934
|
+
)
|
|
935
|
+
self.assertEqual(0, raised.exception.diagnostics["event_count"])
|
|
936
|
+
|
|
937
|
+
def test_reviewer_process_clean_exit_without_semantic_event_is_unavailable(self) -> None:
|
|
938
|
+
repo, _ = self.make_repo()
|
|
939
|
+
runner = repo / "empty-reviewer.py"
|
|
940
|
+
runner.write_text("pass\n", encoding="utf-8")
|
|
941
|
+
with self.assertRaises(ap._ReviewerRuntimeUnavailable):
|
|
942
|
+
ap._run_supervised_reviewer_process(
|
|
943
|
+
[sys.executable, str(runner)],
|
|
944
|
+
cwd=repo,
|
|
945
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
946
|
+
timeout_seconds=1,
|
|
947
|
+
startup_timeout_seconds=0.2,
|
|
948
|
+
)
|
|
949
|
+
|
|
950
|
+
def test_reviewer_event_writer_failure_stops_process_and_reader_threads(self) -> None:
|
|
951
|
+
repo, _ = self.make_repo()
|
|
952
|
+
runner = repo / "writer-failure-reviewer.py"
|
|
953
|
+
runner.write_text(
|
|
954
|
+
"import json, time\n"
|
|
955
|
+
"print(json.dumps({'type': 'turn.started'}), flush=True)\n"
|
|
956
|
+
"time.sleep(30)\n",
|
|
957
|
+
encoding="utf-8",
|
|
958
|
+
)
|
|
959
|
+
|
|
960
|
+
class FailingWriter:
|
|
961
|
+
def write(self, _: str) -> None:
|
|
962
|
+
raise OSError("event log unavailable")
|
|
963
|
+
|
|
964
|
+
def flush(self) -> None:
|
|
965
|
+
pass
|
|
966
|
+
|
|
967
|
+
started = time.monotonic()
|
|
968
|
+
with mock.patch.object(
|
|
969
|
+
ap,
|
|
970
|
+
"_terminate_reviewer_process",
|
|
971
|
+
wraps=ap._terminate_reviewer_process,
|
|
972
|
+
) as terminate:
|
|
973
|
+
with self.assertRaises(ap._ReviewerRuntimeInternalError):
|
|
974
|
+
ap._run_supervised_reviewer_process(
|
|
975
|
+
[sys.executable, str(runner)],
|
|
817
976
|
cwd=repo,
|
|
818
977
|
env={"PATH": os.environ.get("PATH", "")},
|
|
819
|
-
timeout_seconds=
|
|
978
|
+
timeout_seconds=3,
|
|
979
|
+
startup_timeout_seconds=1,
|
|
980
|
+
event_writer=FailingWriter(),
|
|
820
981
|
)
|
|
982
|
+
self.assertLess(time.monotonic() - started, 3.0)
|
|
983
|
+
terminate.assert_called_once()
|
|
984
|
+
self.assertFalse(
|
|
985
|
+
any(thread.name.startswith("reviewer-stream-") for thread in threading.enumerate())
|
|
986
|
+
)
|
|
821
987
|
|
|
822
|
-
|
|
823
|
-
self.
|
|
824
|
-
|
|
988
|
+
def test_reviewer_output_flood_is_bounded_and_cleans_reader_threads(self) -> None:
|
|
989
|
+
repo, _ = self.make_repo()
|
|
990
|
+
runner = repo / "flood-reviewer.py"
|
|
991
|
+
runner.write_text(
|
|
992
|
+
"import json\n"
|
|
993
|
+
"for index in range(10000):\n"
|
|
994
|
+
" print(json.dumps({'type': 'item.completed', 'item': {'type': 'note'}, 'i': index}), flush=True)\n",
|
|
995
|
+
encoding="utf-8",
|
|
996
|
+
)
|
|
997
|
+
started = time.monotonic()
|
|
998
|
+
with mock.patch.object(ap, "_REVIEW_OUTPUT_MAX_BYTES", 2048):
|
|
999
|
+
with self.assertRaises(ap._ReviewerRuntimeOutputLimit):
|
|
1000
|
+
ap._run_supervised_reviewer_process(
|
|
1001
|
+
[sys.executable, str(runner)],
|
|
1002
|
+
cwd=repo,
|
|
1003
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
1004
|
+
timeout_seconds=3,
|
|
1005
|
+
startup_timeout_seconds=1,
|
|
1006
|
+
)
|
|
1007
|
+
self.assertLess(time.monotonic() - started, 3.0)
|
|
1008
|
+
self.assertFalse(
|
|
1009
|
+
any(thread.name.startswith("reviewer-stream-") for thread in threading.enumerate())
|
|
1010
|
+
)
|
|
1011
|
+
|
|
1012
|
+
def test_reviewer_single_unterminated_line_is_bounded(self) -> None:
|
|
1013
|
+
repo, _ = self.make_repo()
|
|
1014
|
+
runner = repo / "long-line-reviewer.py"
|
|
1015
|
+
runner.write_text(
|
|
1016
|
+
"import sys, time\n"
|
|
1017
|
+
"sys.stdout.write('x' * 10000)\n"
|
|
1018
|
+
"sys.stdout.flush()\n"
|
|
1019
|
+
"time.sleep(30)\n",
|
|
1020
|
+
encoding="utf-8",
|
|
1021
|
+
)
|
|
1022
|
+
with mock.patch.object(ap, "_REVIEW_OUTPUT_MAX_BYTES", 2048):
|
|
1023
|
+
with self.assertRaises(ap._ReviewerRuntimeOutputLimit):
|
|
1024
|
+
ap._run_supervised_reviewer_process(
|
|
1025
|
+
[sys.executable, str(runner)],
|
|
1026
|
+
cwd=repo,
|
|
1027
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
1028
|
+
timeout_seconds=3,
|
|
1029
|
+
startup_timeout_seconds=1,
|
|
1030
|
+
)
|
|
1031
|
+
self.assertFalse(
|
|
1032
|
+
any(thread.name.startswith("reviewer-stream-") for thread in threading.enumerate())
|
|
1033
|
+
)
|
|
1034
|
+
|
|
1035
|
+
def test_reviewer_event_metadata_does_not_persist_model_or_patch_content(self) -> None:
|
|
1036
|
+
record, semantic = ap._reviewer_event_metadata(
|
|
1037
|
+
"stdout",
|
|
1038
|
+
json.dumps(
|
|
1039
|
+
{
|
|
1040
|
+
"type": "item.completed",
|
|
1041
|
+
"item": {
|
|
1042
|
+
"type": "command_execution",
|
|
1043
|
+
"text": "PATCH_SECRET_TOKEN",
|
|
1044
|
+
"output": "Bearer private-token",
|
|
1045
|
+
},
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
"2026-07-17T00:00:00+00:00",
|
|
1049
|
+
)
|
|
1050
|
+
serialized = json.dumps(record)
|
|
1051
|
+
self.assertTrue(semantic)
|
|
1052
|
+
self.assertEqual("item.completed", record["event_type"])
|
|
1053
|
+
self.assertEqual("command_execution", record["item_type"])
|
|
1054
|
+
self.assertNotIn("PATCH_SECRET_TOKEN", serialized)
|
|
1055
|
+
self.assertNotIn("private-token", serialized)
|
|
1056
|
+
|
|
1057
|
+
def test_substantive_agent_message_is_not_erased_by_later_approved_message(self) -> None:
|
|
1058
|
+
assignment = self.reviewer_assignment(
|
|
1059
|
+
review_depth="focused",
|
|
1060
|
+
timeout_seconds=150,
|
|
1061
|
+
issued_at="2026-07-17T00:00:00+00:00",
|
|
1062
|
+
deadline_at="2026-07-17T00:02:30+00:00",
|
|
1063
|
+
)
|
|
1064
|
+
stdout = "\n".join(
|
|
1065
|
+
json.dumps(
|
|
1066
|
+
{
|
|
1067
|
+
"type": "item.completed",
|
|
1068
|
+
"item": {"type": "agent_message", "text": json.dumps({"verdict": verdict})},
|
|
1069
|
+
}
|
|
1070
|
+
)
|
|
1071
|
+
for verdict in ("blocked", "approved")
|
|
1072
|
+
)
|
|
1073
|
+
result = ap._substantive_reviewer_event_result(stdout, assignment)
|
|
1074
|
+
self.assertIsNotNone(result)
|
|
1075
|
+
self.assertEqual("blocked", result["verdict"])
|
|
1076
|
+
|
|
1077
|
+
def test_reviewer_spawn_failure_is_runtime_unavailable_with_safe_diagnostics(self) -> None:
|
|
1078
|
+
repo, _ = self.make_repo()
|
|
1079
|
+
with mock.patch.object(
|
|
1080
|
+
ap.subprocess,
|
|
1081
|
+
"Popen",
|
|
1082
|
+
side_effect=OSError("permission denied token=private-value"),
|
|
1083
|
+
):
|
|
1084
|
+
with self.assertRaises(ap._ReviewerRuntimeUnavailable) as raised:
|
|
1085
|
+
ap._run_supervised_reviewer_process(
|
|
1086
|
+
["missing-reviewer"],
|
|
1087
|
+
cwd=repo,
|
|
1088
|
+
env={"PATH": os.environ.get("PATH", "")},
|
|
1089
|
+
timeout_seconds=1,
|
|
1090
|
+
)
|
|
1091
|
+
safe = ap._safe_reviewer_attempt(raised.exception.diagnostics, 1, "runtime-unavailable")
|
|
1092
|
+
self.assertEqual("spawn-failed", safe["phase"])
|
|
1093
|
+
self.assertNotIn("private-value", json.dumps(safe))
|
|
1094
|
+
|
|
1095
|
+
def test_reviewer_attempt_receipt_never_persists_raw_stderr(self) -> None:
|
|
1096
|
+
diagnostics = ap._reviewer_attempt_diagnostics(
|
|
1097
|
+
started_at="2026-07-17T00:00:00+00:00",
|
|
1098
|
+
finished_at="2026-07-17T00:00:01+00:00",
|
|
1099
|
+
stdout="",
|
|
1100
|
+
stderr="PATCH_SECRET_TOKEN\n-----BEGIN OPENSSH PRIVATE KEY-----\nprivate-material",
|
|
1101
|
+
first_event_at="",
|
|
1102
|
+
last_event_at="",
|
|
1103
|
+
last_event_type="",
|
|
1104
|
+
event_count=0,
|
|
1105
|
+
phase="spawn-failed",
|
|
1106
|
+
exit_code=None,
|
|
1107
|
+
)
|
|
1108
|
+
serialized = json.dumps(
|
|
1109
|
+
ap._safe_reviewer_attempt(diagnostics, 1, "runtime-unavailable")
|
|
1110
|
+
)
|
|
1111
|
+
self.assertNotIn("stderr_tail", serialized)
|
|
1112
|
+
self.assertNotIn("PATCH_SECRET_TOKEN", serialized)
|
|
1113
|
+
self.assertNotIn("PRIVATE KEY", serialized)
|
|
1114
|
+
self.assertIn(hashlib.sha256(diagnostics["stderr"].encode()).hexdigest(), serialized)
|
|
825
1115
|
|
|
826
1116
|
def test_reviewer_assignment_timing_contract_and_fixed_budgets(self) -> None:
|
|
827
1117
|
issued_at = "2026-07-16T00:00:00+00:00"
|
|
828
1118
|
assignment = self.reviewer_assignment(
|
|
829
1119
|
review_depth="focused",
|
|
830
|
-
timeout_seconds=
|
|
1120
|
+
timeout_seconds=150,
|
|
831
1121
|
issued_at=issued_at,
|
|
832
|
-
deadline_at="2026-07-16T00:
|
|
1122
|
+
deadline_at="2026-07-16T00:02:30+00:00",
|
|
833
1123
|
scope_revision=1,
|
|
834
1124
|
)
|
|
835
1125
|
self.assertEqual(
|
|
836
1126
|
assignment,
|
|
837
1127
|
ap._validate_orchestration_contract("assignment", assignment),
|
|
838
1128
|
)
|
|
839
|
-
self.assertEqual(("focused",
|
|
1129
|
+
self.assertEqual(("focused", 150), ap._normalized_task_review_policy(True))
|
|
840
1130
|
self.assertEqual(
|
|
841
|
-
("deep",
|
|
1131
|
+
("deep", 360),
|
|
842
1132
|
ap._normalized_task_review_policy(True, "focused", "deep"),
|
|
843
1133
|
)
|
|
844
1134
|
self.assertEqual(("none", 0), ap._normalized_task_review_policy(False, "deep"))
|
|
@@ -848,17 +1138,17 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
848
1138
|
review_depth="focused",
|
|
849
1139
|
timeout_seconds=0,
|
|
850
1140
|
issued_at=issued_at,
|
|
851
|
-
deadline_at="2026-07-16T00:
|
|
1141
|
+
deadline_at="2026-07-16T00:02:30+00:00",
|
|
852
1142
|
),
|
|
853
1143
|
self.reviewer_assignment(
|
|
854
1144
|
review_depth="focused",
|
|
855
|
-
timeout_seconds=
|
|
1145
|
+
timeout_seconds=150,
|
|
856
1146
|
issued_at="2026-07-16T00:00:00",
|
|
857
|
-
deadline_at="2026-07-16T00:
|
|
1147
|
+
deadline_at="2026-07-16T00:02:30",
|
|
858
1148
|
),
|
|
859
1149
|
self.reviewer_assignment(
|
|
860
1150
|
review_depth="focused",
|
|
861
|
-
timeout_seconds=
|
|
1151
|
+
timeout_seconds=150,
|
|
862
1152
|
issued_at=issued_at,
|
|
863
1153
|
deadline_at="2026-07-16T00:01:00+00:00",
|
|
864
1154
|
),
|
|
@@ -1100,8 +1390,8 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
1100
1390
|
deep = self.plan(repo, cfg, planned_paths=["backend/auth/service.py"])
|
|
1101
1391
|
|
|
1102
1392
|
for plan, depth, timeout in [
|
|
1103
|
-
(focused, "focused",
|
|
1104
|
-
(deep, "deep",
|
|
1393
|
+
(focused, "focused", 150),
|
|
1394
|
+
(deep, "deep", 360),
|
|
1105
1395
|
]:
|
|
1106
1396
|
with self.subTest(depth=depth):
|
|
1107
1397
|
self.assertTrue(plan["review_required"])
|
package/cli/tests/index.test.js
CHANGED
|
@@ -314,7 +314,7 @@ function testInitFullyConvergesExistingProject() {
|
|
|
314
314
|
}
|
|
315
315
|
assert(exists(path.join(repo, ".agents", "agents", "custom.toml")), "project-owned custom agents must survive init");
|
|
316
316
|
assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "obsolete.txt")), "extra Skill files must be removed");
|
|
317
|
-
assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.
|
|
317
|
+
assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.8", "docs", "legacy", "old-taskbook.md")), "removed docs must be archived outside active docs");
|
|
318
318
|
assert(fs.readFileSync(structureStandard, "utf8") === customStructureStandard, "init must preserve a project-owned structure standard");
|
|
319
319
|
assert(fs.readFileSync(path.join(repo, "docs", "architecture", "adr", "0042-project-choice.md"), "utf8").includes("Keep me"), "numbered ADR artifacts must survive init");
|
|
320
320
|
assert(fs.readFileSync(path.join(repo, "docs", "architecture", "system-context.md"), "utf8").includes("Keep me"), "architecture artifacts must survive init");
|
|
@@ -382,7 +382,7 @@ function testManagedPolicySummaryPreservesProjectConfiguration() {
|
|
|
382
382
|
const legacySummary = "- `structure` and `optimization`: advisory architecture and no-new-debt policy.";
|
|
383
383
|
const customized = current
|
|
384
384
|
.replace(/^ skill_version:.*$/m, " skill_version: 4.2.5")
|
|
385
|
-
.replace("managed-workflow:start version=4.2.
|
|
385
|
+
.replace("managed-workflow:start version=4.2.8", "managed-workflow:start version=4.2.5")
|
|
386
386
|
.replace(neutralSummary, legacySummary)
|
|
387
387
|
.replace(/^ enforcement:.*$/m, " enforcement: blocking")
|
|
388
388
|
.replace(" block_warnings: false", " block_warnings: true")
|
|
@@ -400,7 +400,7 @@ function testManagedPolicySummaryPreservesProjectConfiguration() {
|
|
|
400
400
|
run("node", [cli, "init"], { cwd: repo });
|
|
401
401
|
const upgraded = fs.readFileSync(engineering, "utf8");
|
|
402
402
|
const afterUpgrade = readEngineeringConfig(engineering);
|
|
403
|
-
assert(afterUpgrade.workflow?.skill_version === "4.2.
|
|
403
|
+
assert(afterUpgrade.workflow?.skill_version === "4.2.8", "init must upgrade the workflow version");
|
|
404
404
|
assert(canonicalJson(afterUpgrade.structure) === canonicalJson(beforeUpgrade.structure), "init must preserve the complete project structure policy");
|
|
405
405
|
assert(canonicalJson(afterUpgrade.optimization) === canonicalJson(beforeUpgrade.optimization), "init must preserve the complete project optimization policy");
|
|
406
406
|
assert(upgraded.includes(neutralSummary), "upgraded managed text must defer to frontmatter policy");
|
|
@@ -474,11 +474,11 @@ function testMinimalInitConvergesWithinBudget() {
|
|
|
474
474
|
const files = listProjectFiles(repo);
|
|
475
475
|
const lines = files.reduce((total, file) => total + fs.readFileSync(file, "utf8").split(/\r?\n/).length, 0);
|
|
476
476
|
assert(files.length <= 40, `minimal scaffold file budget exceeded: ${files.length}`);
|
|
477
|
-
// Integrity, staging, fail-closed classification, immutable Reviewer
|
|
478
|
-
//
|
|
479
|
-
// executable support code, not prompt
|
|
480
|
-
// leaving
|
|
481
|
-
assert(lines <=
|
|
477
|
+
// Integrity, staging, fail-closed classification, immutable Reviewer snapshots,
|
|
478
|
+
// bounded runtime supervision, failure-evidence binding, contract helpers, and
|
|
479
|
+
// the language-aware structure scanner are executable support code, not prompt
|
|
480
|
+
// context. Keep a measured ceiling while leaving safety checks readable.
|
|
481
|
+
assert(lines <= 17200, `minimal scaffold line budget exceeded: ${lines}`);
|
|
482
482
|
const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
|
|
483
483
|
assert(engineering.includes("profile: auto"), "engineering should enable adaptive profiles");
|
|
484
484
|
assert(engineering.includes("isolation: adaptive"), "engineering should default to adaptive clean-branch/worktree isolation");
|
|
@@ -499,8 +499,9 @@ function testMinimalInitConvergesWithinBudget() {
|
|
|
499
499
|
assert(reviewer.includes("diff_fingerprint"), "reviewer verdict should bind to a stable diff");
|
|
500
500
|
assert(reviewer.includes("agent-result-template"), "reviewer should use the complete result skeleton");
|
|
501
501
|
assert(reviewer.includes("AUTOCODING_REVIEW_ASSIGNMENT"), "reviewer should receive the supervised assignment path");
|
|
502
|
-
assert(reviewer.includes("
|
|
502
|
+
assert(reviewer.includes("150 秒"), "reviewer should enforce the focused review budget");
|
|
503
503
|
assert(agentsProtocol.includes("ap.py review-run"), "AGENTS should use the supervised Reviewer runtime");
|
|
504
|
+
assert(agentsProtocol.includes("review-runtime-override"), "AGENTS should document the audited runtime bypass");
|
|
504
505
|
assert(agentsProtocol.includes("cannot stop an in-app subagent"), "AGENTS should state the supervision boundary honestly");
|
|
505
506
|
assert(browserDebugger.includes('sandbox_mode = "read-only"'), "browser discovery should be read-only");
|
|
506
507
|
|
|
@@ -1017,7 +1018,7 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
|
|
|
1017
1018
|
|
|
1018
1019
|
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1019
1020
|
const initial = fs.readFileSync(engineering, "utf8");
|
|
1020
|
-
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.2\.
|
|
1021
|
+
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.2\.8 -->/;
|
|
1021
1022
|
const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
|
|
1022
1023
|
assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
|
|
1023
1024
|
assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
|
|
@@ -1031,21 +1032,21 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
|
|
|
1031
1032
|
const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
|
|
1032
1033
|
const dryResult = JSON.parse(dryRun.stdout).results[0];
|
|
1033
1034
|
assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
|
|
1034
|
-
assert(dryResult.managedWorkflow.version === "4.2.
|
|
1035
|
+
assert(dryResult.managedWorkflow.version === "4.2.8", "dry-run should expose the target workflow version");
|
|
1035
1036
|
assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
|
|
1036
1037
|
assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
|
|
1037
1038
|
|
|
1038
1039
|
run("node", [cli, "init"], { cwd: repo });
|
|
1039
1040
|
const updated = fs.readFileSync(engineering, "utf8");
|
|
1040
1041
|
assert(!updated.includes("project note before") && !updated.includes("project note after"), "init must remove text outside the canonical ENGINEERING body");
|
|
1041
|
-
assert(updated.includes("version=4.2.
|
|
1042
|
+
assert(updated.includes("version=4.2.8"), "init should install the current managed workflow version");
|
|
1042
1043
|
assert(updated.includes("The frontmatter contract is:"), "init should refresh stale managed workflow content");
|
|
1043
1044
|
|
|
1044
1045
|
fillRequiredAccess(repo);
|
|
1045
1046
|
const status = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
1046
1047
|
const statusResult = JSON.parse(status.stdout).results[0];
|
|
1047
1048
|
assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
|
|
1048
|
-
assert(statusResult.managedWorkflow.version === "4.2.
|
|
1049
|
+
assert(statusResult.managedWorkflow.version === "4.2.8", "status should expose the installed managed workflow version");
|
|
1049
1050
|
|
|
1050
1051
|
const beforeSecondInit = fs.readFileSync(engineering, "utf8");
|
|
1051
1052
|
run("node", [cli, "init"], { cwd: repo });
|
|
@@ -1072,7 +1073,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
|
|
|
1072
1073
|
assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
|
|
1073
1074
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1074
1075
|
const migrated = fs.readFileSync(engineering, "utf8");
|
|
1075
|
-
assert(migrated.includes("version=4.2.
|
|
1076
|
+
assert(migrated.includes("version=4.2.8"), "legacy migration should insert the current managed workflow");
|
|
1076
1077
|
assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
|
|
1077
1078
|
const stable = fs.readFileSync(engineering, "utf8");
|
|
1078
1079
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -1172,7 +1173,7 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
|
|
|
1172
1173
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1173
1174
|
const agents = path.join(repo, "AGENTS.md");
|
|
1174
1175
|
const initial = fs.readFileSync(agents, "utf8");
|
|
1175
|
-
assert(initial.includes("managed-agents:start version=4.2.
|
|
1176
|
+
assert(initial.includes("managed-agents:start version=4.2.8"), "new projects should receive the versioned root AGENTS block");
|
|
1176
1177
|
|
|
1177
1178
|
const custom = [
|
|
1178
1179
|
"# Project rules",
|
|
@@ -1191,12 +1192,12 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
|
|
|
1191
1192
|
|
|
1192
1193
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1193
1194
|
const migrated = fs.readFileSync(agents, "utf8");
|
|
1194
|
-
assert(migrated.includes("managed-agents:start version=4.2.
|
|
1195
|
+
assert(migrated.includes("managed-agents:start version=4.2.8"), "AGENTS migration should install the current managed block");
|
|
1195
1196
|
assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
|
|
1196
1197
|
assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
|
|
1197
1198
|
const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
|
|
1198
1199
|
assert(migrated === canonical, "root AGENTS must be byte-identical to the packaged canonical file");
|
|
1199
|
-
const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.2.
|
|
1200
|
+
const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.2.8.md");
|
|
1200
1201
|
assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
|
|
1201
1202
|
const stable = fs.readFileSync(agents);
|
|
1202
1203
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -1253,7 +1254,7 @@ function testEngineeringFrameworkRejectsAnyNonCanonicalWorkflowText() {
|
|
|
1253
1254
|
|
|
1254
1255
|
run("node", [cli, "init"], { cwd: repo });
|
|
1255
1256
|
assert(!fs.readFileSync(engineering, "utf8").includes("backend owns APIs"), "init must restore the canonical ENGINEERING body");
|
|
1256
|
-
const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.
|
|
1257
|
+
const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.8", "docs", "ENGINEERING.md");
|
|
1257
1258
|
assert(fs.readFileSync(archived, "utf8").includes("backend owns APIs"), "removed project text should remain in non-authoritative history");
|
|
1258
1259
|
}
|
|
1259
1260
|
|
|
@@ -1265,12 +1266,12 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
|
|
|
1265
1266
|
|
|
1266
1267
|
const manifestPath = path.join(repo, ".agents", "managed-install.json");
|
|
1267
1268
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
1268
|
-
assert(manifest.schema_version === 1 && manifest.skill_version === "4.2.
|
|
1269
|
+
assert(manifest.schema_version === 1 && manifest.skill_version === "4.2.8", "installed manifest must identify the release");
|
|
1269
1270
|
assert(manifest.entries.length > 0, "installed manifest must list managed files");
|
|
1270
1271
|
for (const entry of manifest.entries) {
|
|
1271
1272
|
assert(typeof entry.path === "string" && !path.isAbsolute(entry.path) && !entry.path.includes(".."), "manifest paths must be safe relative paths");
|
|
1272
1273
|
assert(/^[0-9a-f]{64}$/.test(entry.sha256), `${entry.path}: manifest hash must be sha256`);
|
|
1273
|
-
assert(entry.version === "4.2.
|
|
1274
|
+
assert(entry.version === "4.2.8" && typeof entry.executable === "boolean", `${entry.path}: version/executable metadata missing`);
|
|
1274
1275
|
}
|
|
1275
1276
|
assert(!manifest.managed_namespaces.some(item => item.path === ".agents" || item.path === "docs"), "manifest must not mirror entire project-owned trees");
|
|
1276
1277
|
|
|
@@ -1340,14 +1341,14 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
|
|
|
1340
1341
|
}
|
|
1341
1342
|
|
|
1342
1343
|
function testReleaseVersionMarkersStayInSync() {
|
|
1343
|
-
const expected = "4.2.
|
|
1344
|
+
const expected = "4.2.8";
|
|
1344
1345
|
const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
|
|
1345
1346
|
const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
|
|
1346
1347
|
const policy = JSON.parse(fs.readFileSync(
|
|
1347
1348
|
path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
|
|
1348
1349
|
"utf8",
|
|
1349
1350
|
));
|
|
1350
|
-
assert(pkg.version === expected, "package version must match the 4.2.
|
|
1351
|
+
assert(pkg.version === expected, "package version must match the 4.2.8 release");
|
|
1351
1352
|
assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
|
|
1352
1353
|
assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
|
|
1353
1354
|
const manifest = JSON.parse(fs.readFileSync(path.join(repoRoot, "cli", "assets", "managed-install.json"), "utf8"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvis1513/auto-coding-skill",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.8",
|
|
4
4
|
"description": "CLI installer for a delivery-first .agents workflow with adaptive Git isolation, routed changed-scope validation, risk-based review, push completion, and safe cleanup.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|