Commit 76e9c17
Fix loop detection: key on agent name only, not (agent, instruction)
Production run after the previous progress-counter fix (0da531f) STILL
showed Chief Architect picked 6+ consecutive times. Root cause: the
loop detection key was (agent, instruction_text). The LLM-driven
Coordinator varies its instruction on every pick ('list source blobs',
'read xyz.yaml', 'save analysis_result.md') while latching onto the
same agent — so every selection_key was unique, the streak reset to 1
on every pick, and the 3-strike threshold was never reached.
Change: track only the agent name (lower-cased). The progress counter
(now correct after 0da531f) already encodes 'no DIFFERENT agent ran in
between', so 3 consecutive picks of the same agent with no other-agent
progress is a strong, low-false-positive loop signal.
Adds a regression test that replays the production sequence (same agent,
three different instruction strings) and verifies forced termination
fires. The earlier tests for exact-match repeats and for B-resets-the-
streak continue to pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9a85f00 commit 76e9c17
2 files changed
Lines changed: 80 additions & 17 deletions
File tree
- src/processor/src
- libs/agent_framework
- tests/unit/libs/agent_framework
Lines changed: 33 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
299 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
300 | 306 | | |
| 307 | + | |
301 | 308 | | |
302 | 309 | | |
303 | 310 | | |
| |||
1029 | 1036 | | |
1030 | 1037 | | |
1031 | 1038 | | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
| 1039 | + | |
1037 | 1040 | | |
1038 | 1041 | | |
1039 | | - | |
| 1042 | + | |
1040 | 1043 | | |
1041 | 1044 | | |
1042 | 1045 | | |
| |||
1058 | 1061 | | |
1059 | 1062 | | |
1060 | 1063 | | |
1061 | | - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1062 | 1073 | | |
1063 | 1074 | | |
1064 | 1075 | | |
1065 | 1076 | | |
1066 | 1077 | | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
1072 | 1085 | | |
1073 | 1086 | | |
1074 | 1087 | | |
| |||
1080 | 1093 | | |
1081 | 1094 | | |
1082 | 1095 | | |
1083 | | - | |
| 1096 | + | |
1084 | 1097 | | |
1085 | 1098 | | |
1086 | 1099 | | |
1087 | 1100 | | |
1088 | 1101 | | |
1089 | | - | |
| 1102 | + | |
| 1103 | + | |
1090 | 1104 | | |
1091 | 1105 | | |
1092 | 1106 | | |
1093 | | - | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1094 | 1110 | | |
1095 | 1111 | | |
1096 | 1112 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
789 | 836 | | |
790 | 837 | | |
791 | 838 | | |
| |||
0 commit comments